diff --git a/templates/deployment.yaml b/templates/deployment.yaml new file mode 100644 index 0000000..3b50775 --- /dev/null +++ b/templates/deployment.yaml @@ -0,0 +1,79 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nginx-redirect.fullname" . }} + labels: + {{- include "nginx-redirect.labels" . | nindent 4 }} + {{- with .Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "nginx-redirect.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- with .Values.annotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nginx-redirect.selectorLabels" . | nindent 8 }} + spec: + securityContext: + runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }} + runAsUser: {{ .Values.securityContext.runAsUser }} + runAsGroup: {{ .Values.securityContext.runAsGroup }} + fsGroup: {{ .Values.securityContext.fsGroup }} + seccompProfile: + type: {{ .Values.securityContext.seccompProfile.type }} + containers: + - name: nginx + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 10 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 10 }} + resources: + {{- toYaml .Values.resources | nindent 10 }} + securityContext: + allowPrivilegeEscalation: {{ .Values.securityContext.allowPrivilegeEscalation }} + capabilities: + drop: + {{- range .Values.securityContext.capabilities.drop }} + - {{ . }} + {{- end }} + readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFilesystem }} + volumeMounts: + - name: nginx-config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + readOnly: true + - name: cache + mountPath: /var/cache/nginx + - name: run + mountPath: /var/run + - name: tmp + mountPath: /tmp + volumes: + - name: nginx-config + configMap: + name: {{ include "nginx-redirect.fullname" . }} + - name: cache + emptyDir: {} + - name: run + emptyDir: {} + - name: tmp + emptyDir: {} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file