|  | 
|  | 1 | +apiVersion: v1 | 
|  | 2 | +kind: ServiceAccount | 
|  | 3 | +metadata: | 
|  | 4 | +  name: {{ include "nginx-gateway.fullname" . }}-cert-generator | 
|  | 5 | +  namespace: {{ .Release.Namespace }} | 
|  | 6 | +  labels: | 
|  | 7 | +  {{- include "nginx-gateway.labels" . | nindent 4 }} | 
|  | 8 | +  annotations: | 
|  | 9 | +    "helm.sh/hook": pre-install | 
|  | 10 | +{{- if or .Values.nginxGateway.serviceAccount.imagePullSecret .Values.nginxGateway.serviceAccount.imagePullSecrets }} | 
|  | 11 | +imagePullSecrets: | 
|  | 12 | +  {{- if .Values.nginxGateway.serviceAccount.imagePullSecret }} | 
|  | 13 | +  - name: {{ .Values.nginxGateway.serviceAccount.imagePullSecret }} | 
|  | 14 | +  {{- end }} | 
|  | 15 | +  {{- if .Values.nginxGateway.serviceAccount.imagePullSecrets }} | 
|  | 16 | +  {{- range .Values.nginxGateway.serviceAccount.imagePullSecrets }} | 
|  | 17 | +  - name: {{ . }} | 
|  | 18 | +  {{- end }} | 
|  | 19 | +  {{- end }} | 
|  | 20 | +{{- end }} | 
|  | 21 | +--- | 
|  | 22 | +apiVersion: rbac.authorization.k8s.io/v1 | 
|  | 23 | +kind: Role | 
|  | 24 | +metadata: | 
|  | 25 | +  name: {{ include "nginx-gateway.fullname" . }}-cert-generator | 
|  | 26 | +  namespace: {{ .Release.Namespace }} | 
|  | 27 | +  labels: | 
|  | 28 | +  {{- include "nginx-gateway.labels" . | nindent 4 }} | 
|  | 29 | +  annotations: | 
|  | 30 | +    "helm.sh/hook": pre-install | 
|  | 31 | +rules: | 
|  | 32 | +- apiGroups: | 
|  | 33 | +  - "" | 
|  | 34 | +  resources: | 
|  | 35 | +  - secrets | 
|  | 36 | +  verbs: | 
|  | 37 | +  - create | 
|  | 38 | +  - update | 
|  | 39 | +  - get | 
|  | 40 | +--- | 
|  | 41 | +apiVersion: rbac.authorization.k8s.io/v1 | 
|  | 42 | +kind: RoleBinding | 
|  | 43 | +metadata: | 
|  | 44 | +  name: {{ include "nginx-gateway.fullname" . }}-cert-generator | 
|  | 45 | +  namespace: {{ .Release.Namespace }} | 
|  | 46 | +  labels: | 
|  | 47 | +  {{- include "nginx-gateway.labels" . | nindent 4 }} | 
|  | 48 | +  annotations: | 
|  | 49 | +    "helm.sh/hook": pre-install | 
|  | 50 | +roleRef: | 
|  | 51 | +  apiGroup: rbac.authorization.k8s.io | 
|  | 52 | +  kind: Role | 
|  | 53 | +  name: {{ include "nginx-gateway.fullname" . }}-cert-generator | 
|  | 54 | +subjects: | 
|  | 55 | +- kind: ServiceAccount | 
|  | 56 | +  name: {{ include "nginx-gateway.fullname" . }}-cert-generator | 
|  | 57 | +  namespace: {{ .Release.Namespace }} | 
|  | 58 | +--- | 
|  | 59 | +apiVersion: batch/v1 | 
|  | 60 | +kind: Job | 
|  | 61 | +metadata: | 
|  | 62 | +  name: {{ include "nginx-gateway.fullname" . }}-cert-generator | 
|  | 63 | +  namespace: {{ .Release.Namespace }} | 
|  | 64 | +  labels: | 
|  | 65 | +  {{- include "nginx-gateway.labels" . | nindent 4 }} | 
|  | 66 | +  annotations: | 
|  | 67 | +  {{- with .Values.certGenerator.annotations -}} | 
|  | 68 | +  {{ toYaml . | nindent 4 }} | 
|  | 69 | +  {{- end }} | 
|  | 70 | +    "helm.sh/hook": pre-install, pre-upgrade | 
|  | 71 | +spec: | 
|  | 72 | +  template: | 
|  | 73 | +    metadata: | 
|  | 74 | +      annotations: | 
|  | 75 | +      {{- with .Values.certGenerator.annotations -}} | 
|  | 76 | +      {{ toYaml . | nindent 8 }} | 
|  | 77 | +      {{- end }} | 
|  | 78 | +    spec: | 
|  | 79 | +      containers: | 
|  | 80 | +      - args: | 
|  | 81 | +        - generate-certs | 
|  | 82 | +        - --service={{ include "nginx-gateway.fullname" . }} | 
|  | 83 | +        - --cluster-domain={{ .Values.clusterDomain }} | 
|  | 84 | +        - --server-tls-secret={{ .Values.certGenerator.serverTLSSecretName }} | 
|  | 85 | +        - --agent-tls-secret={{ .Values.certGenerator.agentTLSSecretName }} | 
|  | 86 | +        {{- if .Values.certGenerator.overwrite }} | 
|  | 87 | +        - --overwrite | 
|  | 88 | +        {{- end }} | 
|  | 89 | +        env: | 
|  | 90 | +        - name: POD_NAMESPACE | 
|  | 91 | +          valueFrom: | 
|  | 92 | +            fieldRef: | 
|  | 93 | +              fieldPath: metadata.namespace | 
|  | 94 | +        image: {{ .Values.nginxGateway.image.repository }}:{{ default .Chart.AppVersion .Values.nginxGateway.image.tag }} | 
|  | 95 | +        imagePullPolicy: {{ .Values.nginxGateway.image.pullPolicy }} | 
|  | 96 | +        name: cert-generator | 
|  | 97 | +        securityContext: | 
|  | 98 | +          seccompProfile: | 
|  | 99 | +            type: RuntimeDefault | 
|  | 100 | +          capabilities: | 
|  | 101 | +            drop: | 
|  | 102 | +            - ALL | 
|  | 103 | +          allowPrivilegeEscalation: false | 
|  | 104 | +          readOnlyRootFilesystem: true | 
|  | 105 | +          runAsUser: 101 | 
|  | 106 | +          runAsGroup: 1001 | 
|  | 107 | +      restartPolicy: Never | 
|  | 108 | +      serviceAccountName: {{ include "nginx-gateway.fullname" . }}-cert-generator | 
|  | 109 | +      securityContext: | 
|  | 110 | +        fsGroup: 1001 | 
|  | 111 | +        runAsNonRoot: true | 
|  | 112 | +  ttlSecondsAfterFinished: 0 | 
0 commit comments