webhook-deployment.yaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {{- if .Values.webhook.create }}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ include "external-secrets.fullname" . }}-webhook
  6. namespace: {{ .Release.Namespace | quote }}
  7. labels:
  8. {{- include "external-secrets-webhook.labels" . | nindent 4 }}
  9. {{- with .Values.webhook.deploymentAnnotations }}
  10. annotations:
  11. {{- toYaml . | nindent 4 }}
  12. {{- end }}
  13. spec:
  14. replicas: {{ .Values.webhook.replicaCount }}
  15. revisionHistoryLimit: {{ .Values.webhook.revisionHistoryLimit }}
  16. selector:
  17. matchLabels:
  18. {{- include "external-secrets-webhook.selectorLabels" . | nindent 6 }}
  19. template:
  20. metadata:
  21. {{- with .Values.webhook.podAnnotations }}
  22. annotations:
  23. {{- toYaml . | nindent 8 }}
  24. {{- end }}
  25. labels:
  26. {{- include "external-secrets-webhook.labels" . | nindent 8 }}
  27. {{- with .Values.webhook.podLabels }}
  28. {{- toYaml . | nindent 8 }}
  29. {{- end }}
  30. spec:
  31. {{- with .Values.webhook.imagePullSecrets }}
  32. imagePullSecrets:
  33. {{- toYaml . | nindent 8 }}
  34. {{- end }}
  35. hostNetwork: {{ .Values.webhook.hostNetwork}}
  36. serviceAccountName: {{ include "external-secrets-webhook.serviceAccountName" . }}
  37. automountServiceAccountToken: {{ .Values.webhook.serviceAccount.automount }}
  38. {{- with .Values.webhook.podSecurityContext }}
  39. securityContext:
  40. {{- toYaml . | nindent 8 }}
  41. {{- end }}
  42. containers:
  43. - name: webhook
  44. {{- with .Values.webhook.securityContext }}
  45. securityContext:
  46. {{- toYaml . | nindent 12 }}
  47. {{- end }}
  48. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.webhook.image) | trim }}
  49. imagePullPolicy: {{ .Values.webhook.image.pullPolicy }}
  50. args:
  51. - webhook
  52. - --port={{ .Values.webhook.port }}
  53. - --dns-name={{ include "external-secrets.fullname" . }}-webhook.{{ .Release.Namespace }}.svc
  54. - --cert-dir={{ .Values.webhook.certDir }}
  55. - --check-interval={{ .Values.webhook.certCheckInterval }}
  56. - --metrics-addr=:{{ .Values.webhook.metrics.listen.port }}
  57. - --healthz-addr={{ .Values.webhook.readinessProbe.address }}:{{ .Values.webhook.readinessProbe.port }}
  58. {{- if .Values.webhook.lookaheadInterval }}
  59. - --lookahead-interval={{ .Values.webhook.lookaheadInterval }}
  60. {{- end }}
  61. {{- range $key, $value := .Values.webhook.extraArgs }}
  62. {{- if $value }}
  63. - --{{ $key }}={{ $value }}
  64. {{- else }}
  65. - --{{ $key }}
  66. {{- end }}
  67. {{- end }}
  68. ports:
  69. - containerPort: {{ .Values.webhook.metrics.listen.port }}
  70. protocol: TCP
  71. name: metrics
  72. - containerPort: {{ .Values.webhook.port }}
  73. protocol: TCP
  74. name: webhook
  75. readinessProbe:
  76. httpGet:
  77. port: {{ .Values.webhook.readinessProbe.port }}
  78. path: /readyz
  79. initialDelaySeconds: 20
  80. periodSeconds: 5
  81. {{- with .Values.webhook.extraEnv }}
  82. env:
  83. {{- toYaml . | nindent 12 }}
  84. {{- end }}
  85. {{- with .Values.webhook.resources }}
  86. resources:
  87. {{- toYaml . | nindent 12 }}
  88. {{- end }}
  89. volumeMounts:
  90. - name: certs
  91. mountPath: {{ .Values.webhook.certDir }}
  92. readOnly: true
  93. {{- if .Values.webhook.extraVolumeMounts }}
  94. {{- toYaml .Values.webhook.extraVolumeMounts | nindent 12 }}
  95. {{- end }}
  96. volumes:
  97. - name: certs
  98. secret:
  99. secretName: {{ include "external-secrets.fullname" . }}-webhook
  100. {{- if .Values.webhook.extraVolumes }}
  101. {{- toYaml .Values.webhook.extraVolumes | nindent 8 }}
  102. {{- end }}
  103. {{- with .Values.webhook.nodeSelector }}
  104. nodeSelector:
  105. {{- toYaml . | nindent 8 }}
  106. {{- end }}
  107. {{- with .Values.webhook.affinity }}
  108. affinity:
  109. {{- toYaml . | nindent 8 }}
  110. {{- end }}
  111. {{- with .Values.webhook.tolerations }}
  112. tolerations:
  113. {{- toYaml . | nindent 8 }}
  114. {{- end }}
  115. {{- with .Values.webhook.topologySpreadConstraints }}
  116. topologySpreadConstraints:
  117. {{- toYaml . | nindent 8 }}
  118. {{- end }}
  119. {{- if .Values.webhook.priorityClassName }}
  120. priorityClassName: {{ .Values.webhook.priorityClassName }}
  121. {{- end }}
  122. {{- end }}