job-createSecret.yaml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {{- if and .Values.controller.admissionWebhooks.enabled .Values.controller.admissionWebhooks.patch.enabled -}}
  2. apiVersion: batch/v1
  3. kind: Job
  4. metadata:
  5. name: {{ include "ingress-nginx.fullname" . }}-admission-create
  6. namespace: {{ .Release.Namespace }}
  7. annotations:
  8. "helm.sh/hook": pre-install,pre-upgrade
  9. "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
  10. {{- with .Values.controller.admissionWebhooks.annotations }}
  11. {{- toYaml . | nindent 4 }}
  12. {{- end }}
  13. labels:
  14. {{- include "ingress-nginx.labels" . | nindent 4 }}
  15. app.kubernetes.io/component: admission-webhook
  16. {{- with .Values.controller.admissionWebhooks.patch.labels }}
  17. {{- toYaml . | nindent 4 }}
  18. {{- end }}
  19. spec:
  20. {{- if .Capabilities.APIVersions.Has "batch/v1alpha1" }}
  21. # Alpha feature since k8s 1.12
  22. ttlSecondsAfterFinished: 0
  23. {{- end }}
  24. template:
  25. metadata:
  26. name: {{ include "ingress-nginx.fullname" . }}-admission-create
  27. {{- if .Values.controller.admissionWebhooks.patch.podAnnotations }}
  28. annotations: {{ toYaml .Values.controller.admissionWebhooks.patch.podAnnotations | nindent 8 }}
  29. {{- end }}
  30. labels:
  31. {{- include "ingress-nginx.labels" . | nindent 8 }}
  32. app.kubernetes.io/component: admission-webhook
  33. {{- with .Values.controller.admissionWebhooks.patch.labels }}
  34. {{- toYaml . | nindent 8 }}
  35. {{- end }}
  36. spec:
  37. {{- if .Values.controller.admissionWebhooks.patch.priorityClassName }}
  38. priorityClassName: {{ .Values.controller.admissionWebhooks.patch.priorityClassName }}
  39. {{- end }}
  40. {{- if .Values.imagePullSecrets }}
  41. imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 8 }}
  42. {{- end }}
  43. containers:
  44. - name: create
  45. {{- with .Values.controller.admissionWebhooks.patch.image }}
  46. image: "{{- if .repository -}}{{ .repository }}{{ else }}{{ .registry }}/{{ .image }}{{- end -}}:{{ .tag }}{{- if (.digest) -}} @{{.digest}} {{- end -}}"
  47. {{- end }}
  48. imagePullPolicy: {{ .Values.controller.admissionWebhooks.patch.image.pullPolicy }}
  49. args:
  50. - create
  51. - --host={{ include "ingress-nginx.controller.fullname" . }}-admission,{{ include "ingress-nginx.controller.fullname" . }}-admission.$(POD_NAMESPACE).svc
  52. - --namespace=$(POD_NAMESPACE)
  53. - --secret-name={{ include "ingress-nginx.fullname" . }}-admission
  54. env:
  55. - name: POD_NAMESPACE
  56. valueFrom:
  57. fieldRef:
  58. fieldPath: metadata.namespace
  59. {{- if .Values.controller.admissionWebhooks.extraEnvs }}
  60. {{- toYaml .Values.controller.admissionWebhooks.extraEnvs | nindent 12 }}
  61. {{- end }}
  62. {{- if .Values.controller.admissionWebhooks.createSecretJob.securityContext }}
  63. securityContext: {{ toYaml .Values.controller.admissionWebhooks.createSecretJob.securityContext | nindent 12 }}
  64. {{- end }}
  65. {{- if .Values.controller.admissionWebhooks.createSecretJob.resources }}
  66. resources: {{ toYaml .Values.controller.admissionWebhooks.createSecretJob.resources | nindent 12 }}
  67. {{- end }}
  68. restartPolicy: OnFailure
  69. serviceAccountName: {{ include "ingress-nginx.fullname" . }}-admission
  70. {{- if .Values.controller.admissionWebhooks.patch.nodeSelector }}
  71. nodeSelector: {{ toYaml .Values.controller.admissionWebhooks.patch.nodeSelector | nindent 8 }}
  72. {{- end }}
  73. {{- if .Values.controller.admissionWebhooks.patch.tolerations }}
  74. tolerations: {{ toYaml .Values.controller.admissionWebhooks.patch.tolerations | nindent 8 }}
  75. {{- end }}
  76. {{- if .Values.controller.admissionWebhooks.patch.securityContext }}
  77. securityContext:
  78. {{- toYaml .Values.controller.admissionWebhooks.patch.securityContext | nindent 8 }}
  79. {{- end }}
  80. {{- end }}