|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: tmp-nginx-deployment |
| 5 | + namespace: {{ .Release.Namespace }} |
| 6 | +spec: |
| 7 | + selector: |
| 8 | + matchLabels: |
| 9 | + app.kubernetes.io/name: tmp-nginx-deployment |
| 10 | + app.kubernetes.io/instance: {{ .Release.Name }} |
| 11 | + template: |
| 12 | + metadata: |
| 13 | + labels: |
| 14 | + app.kubernetes.io/name: tmp-nginx-deployment |
| 15 | + app.kubernetes.io/instance: {{ .Release.Name }} |
| 16 | + spec: |
| 17 | + initContainers: |
| 18 | + - name: sleep # wait for a bit for control plane to be ready |
| 19 | + image: {{ .Values.nginxGateway.image.repository }}:{{ default .Chart.AppVersion .Values.nginxGateway.image.tag }} |
| 20 | + imagePullPolicy: {{ .Values.nginxGateway.image.pullPolicy }} |
| 21 | + command: |
| 22 | + - /usr/bin/gateway |
| 23 | + - sleep |
| 24 | + - --duration=15s |
| 25 | + - name: init |
| 26 | + image: {{ .Values.nginxGateway.image.repository }}:{{ default .Chart.AppVersion .Values.nginxGateway.image.tag }} |
| 27 | + imagePullPolicy: {{ .Values.nginxGateway.image.pullPolicy }} |
| 28 | + command: |
| 29 | + - /usr/bin/gateway |
| 30 | + - initialize |
| 31 | + - --source |
| 32 | + - /includes/main.conf |
| 33 | + {{- if .Values.nginx.plus }} |
| 34 | + - --source |
| 35 | + - /includes/mgmt.conf |
| 36 | + - --nginx-plus |
| 37 | + {{- end }} |
| 38 | + - --destination |
| 39 | + - /etc/nginx/main-includes |
| 40 | + env: |
| 41 | + - name: POD_UID |
| 42 | + valueFrom: |
| 43 | + fieldRef: |
| 44 | + fieldPath: metadata.uid |
| 45 | + securityContext: |
| 46 | + seccompProfile: |
| 47 | + type: RuntimeDefault |
| 48 | + capabilities: |
| 49 | + drop: |
| 50 | + - ALL |
| 51 | + readOnlyRootFilesystem: true |
| 52 | + runAsUser: 102 |
| 53 | + runAsGroup: 1001 |
| 54 | + volumeMounts: |
| 55 | + - name: nginx-includes-bootstrap |
| 56 | + mountPath: /includes |
| 57 | + - name: nginx-main-includes |
| 58 | + mountPath: /etc/nginx/main-includes |
| 59 | + containers: |
| 60 | + - image: {{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag | default .Chart.AppVersion }} |
| 61 | + imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} |
| 62 | + name: nginx |
| 63 | + {{- if .Values.nginx.lifecycle }} |
| 64 | + lifecycle: |
| 65 | + {{- toYaml .Values.nginx.lifecycle | nindent 10 }} |
| 66 | + {{- end }} |
| 67 | + ports: |
| 68 | + - containerPort: 80 |
| 69 | + name: http |
| 70 | + - containerPort: 443 |
| 71 | + name: https |
| 72 | + securityContext: |
| 73 | + seccompProfile: |
| 74 | + type: RuntimeDefault |
| 75 | + allowPrivilegeEscalation: {{ .Values.nginx.securityContext.allowPrivilegeEscalation }} |
| 76 | + capabilities: |
| 77 | + add: |
| 78 | + - NET_BIND_SERVICE |
| 79 | + drop: |
| 80 | + - ALL |
| 81 | + readOnlyRootFilesystem: true |
| 82 | + runAsUser: 101 |
| 83 | + runAsGroup: 1001 |
| 84 | + volumeMounts: |
| 85 | + - name: nginx-agent |
| 86 | + mountPath: /etc/nginx-agent |
| 87 | + - name: nginx-conf |
| 88 | + mountPath: /etc/nginx/conf.d |
| 89 | + - name: nginx-stream-conf |
| 90 | + mountPath: /etc/nginx/stream-conf.d |
| 91 | + - name: nginx-main-includes |
| 92 | + mountPath: /etc/nginx/main-includes |
| 93 | + - name: nginx-secrets |
| 94 | + mountPath: /etc/nginx/secrets |
| 95 | + - name: nginx-run |
| 96 | + mountPath: /var/run/nginx |
| 97 | + - name: nginx-cache |
| 98 | + mountPath: /var/cache/nginx |
| 99 | + - name: nginx-includes |
| 100 | + mountPath: /etc/nginx/includes |
| 101 | + {{- if .Values.nginx.plus }} |
| 102 | + - name: nginx-lib |
| 103 | + mountPath: /var/lib/nginx/state |
| 104 | + {{- if .Values.nginx.usage.secretName }} |
| 105 | + - name: nginx-plus-license |
| 106 | + mountPath: /etc/nginx/license.jwt |
| 107 | + subPath: license.jwt |
| 108 | + {{- end }} |
| 109 | + {{- if or .Values.nginx.usage.caSecretName .Values.nginx.usage.clientSSLSecretName }} |
| 110 | + - name: nginx-plus-usage-certs |
| 111 | + mountPath: /etc/nginx/certs-bootstrap/ |
| 112 | + {{- end }} |
| 113 | + {{- end }} |
| 114 | + {{- with .Values.nginx.extraVolumeMounts -}} |
| 115 | + {{ toYaml . | nindent 8 }} |
| 116 | + {{- end }} |
| 117 | + {{- if .Values.nginx.debug }} |
| 118 | + command: |
| 119 | + - "/bin/sh" |
| 120 | + args: |
| 121 | + - "-c" |
| 122 | + - "rm -rf /var/run/nginx/*.sock && nginx-debug -g 'daemon off;'" |
| 123 | + {{- end }} |
| 124 | + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} |
| 125 | + {{- if .Values.affinity }} |
| 126 | + affinity: |
| 127 | + {{- toYaml .Values.affinity | nindent 8 }} |
| 128 | + {{- end }} |
| 129 | + serviceAccountName: {{ include "nginx-gateway.serviceAccountName" . }} |
| 130 | + securityContext: |
| 131 | + fsGroup: 1001 |
| 132 | + runAsNonRoot: true |
| 133 | + {{- if .Values.tolerations }} |
| 134 | + tolerations: |
| 135 | + {{- toYaml .Values.tolerations | nindent 6 }} |
| 136 | + {{- end }} |
| 137 | + {{- if .Values.nodeSelector }} |
| 138 | + nodeSelector: |
| 139 | + {{- toYaml .Values.nodeSelector | nindent 8 }} |
| 140 | + {{- end }} |
| 141 | + volumes: |
| 142 | + - name: nginx-agent |
| 143 | + configMap: |
| 144 | + name: nginx-agent-config |
| 145 | + - name: nginx-conf |
| 146 | + emptyDir: {} |
| 147 | + - name: nginx-stream-conf |
| 148 | + emptyDir: {} |
| 149 | + - name: nginx-main-includes |
| 150 | + emptyDir: {} |
| 151 | + - name: nginx-secrets |
| 152 | + emptyDir: {} |
| 153 | + - name: nginx-run |
| 154 | + emptyDir: {} |
| 155 | + - name: nginx-cache |
| 156 | + emptyDir: {} |
| 157 | + - name: nginx-includes |
| 158 | + emptyDir: {} |
| 159 | + - name: nginx-includes-bootstrap |
| 160 | + configMap: |
| 161 | + name: nginx-includes-bootstrap |
| 162 | + {{- if .Values.nginx.plus }} |
| 163 | + - name: nginx-lib |
| 164 | + emptyDir: {} |
| 165 | + {{- if .Values.nginx.usage.secretName }} |
| 166 | + - name: nginx-plus-license |
| 167 | + secret: |
| 168 | + secretName: {{ .Values.nginx.usage.secretName }} |
| 169 | + {{- end }} |
| 170 | + {{- if or .Values.nginx.usage.caSecretName .Values.nginx.usage.clientSSLSecretName }} |
| 171 | + - name: nginx-plus-usage-certs |
| 172 | + projected: |
| 173 | + sources: |
| 174 | + {{- if .Values.nginx.usage.caSecretName }} |
| 175 | + - secret: |
| 176 | + name: {{ .Values.nginx.usage.caSecretName }} |
| 177 | + {{- end }} |
| 178 | + {{- if .Values.nginx.usage.clientSSLSecretName }} |
| 179 | + - secret: |
| 180 | + name: {{ .Values.nginx.usage.clientSSLSecretName }} |
| 181 | + {{- end }} |
| 182 | + {{- end }} |
| 183 | + {{- end }} |
| 184 | + {{- with .Values.extraVolumes -}} |
| 185 | + {{ toYaml . | nindent 6 }} |
| 186 | + {{- end }} |
0 commit comments