webhook-deployment.yaml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. {{- if .Values.webhook.create }}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ include "external-secrets.fullname" . }}-webhook
  6. namespace: {{ template "external-secrets.namespace" . }}
  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. {{- with .Values.webhook.strategy }}
  20. strategy:
  21. {{- toYaml . | nindent 4 }}
  22. {{- end }}
  23. template:
  24. metadata:
  25. {{- with .Values.webhook.podAnnotations }}
  26. annotations:
  27. {{- toYaml . | nindent 8 }}
  28. {{- end }}
  29. labels:
  30. {{- include "external-secrets-webhook.labels" . | nindent 8 }}
  31. {{- with .Values.webhook.podLabels }}
  32. {{- toYaml . | nindent 8 }}
  33. {{- end }}
  34. spec:
  35. {{- with .Values.webhook.imagePullSecrets }}
  36. imagePullSecrets:
  37. {{- toYaml . | nindent 8 }}
  38. {{- end }}
  39. hostNetwork: {{ .Values.webhook.hostNetwork}}
  40. serviceAccountName: {{ include "external-secrets-webhook.serviceAccountName" . }}
  41. automountServiceAccountToken: {{ .Values.webhook.serviceAccount.automount }}
  42. {{- with .Values.webhook.podSecurityContext }}
  43. {{- if and (.enabled) (gt (keys . | len) 1) }}
  44. securityContext:
  45. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 8 }}
  46. {{- end }}
  47. {{- end }}
  48. containers:
  49. - name: webhook
  50. {{- with .Values.webhook.securityContext }}
  51. {{- if and (.enabled) (gt (keys . | len) 1) }}
  52. securityContext:
  53. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 12 }}
  54. {{- end }}
  55. {{- end }}
  56. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.webhook.image) | trim }}
  57. imagePullPolicy: {{ .Values.webhook.image.pullPolicy }}
  58. args:
  59. - webhook
  60. - --port={{ .Values.webhook.port }}
  61. - --dns-name={{ include "external-secrets.fullname" . }}-webhook.{{ template "external-secrets.namespace" . }}.svc
  62. - --cert-dir={{ .Values.webhook.certDir }}
  63. - --check-interval={{ .Values.webhook.certCheckInterval }}
  64. - --metrics-addr=:{{ .Values.webhook.metrics.listen.port }}
  65. - --healthz-addr={{ .Values.webhook.readinessProbe.address }}:{{ .Values.webhook.readinessProbe.port }}
  66. - --loglevel={{ .Values.webhook.log.level }}
  67. - --zap-time-encoding={{ .Values.webhook.log.timeEncoding }}
  68. {{- if .Values.webhook.lookaheadInterval }}
  69. - --lookahead-interval={{ .Values.webhook.lookaheadInterval }}
  70. {{- end }}
  71. {{- range $key, $value := .Values.webhook.extraArgs }}
  72. {{- if $value }}
  73. - --{{ $key }}={{ $value }}
  74. {{- else }}
  75. - --{{ $key }}
  76. {{- end }}
  77. {{- end }}
  78. ports:
  79. - containerPort: {{ .Values.webhook.metrics.listen.port }}
  80. protocol: TCP
  81. name: metrics
  82. - containerPort: {{ .Values.webhook.port }}
  83. protocol: TCP
  84. name: webhook
  85. readinessProbe:
  86. httpGet:
  87. port: {{ .Values.webhook.readinessProbe.port }}
  88. path: /readyz
  89. initialDelaySeconds: 20
  90. periodSeconds: 5
  91. {{- with .Values.webhook.extraEnv }}
  92. env:
  93. {{- toYaml . | nindent 12 }}
  94. {{- end }}
  95. {{- with .Values.webhook.resources }}
  96. resources:
  97. {{- toYaml . | nindent 12 }}
  98. {{- end }}
  99. volumeMounts:
  100. - name: certs
  101. mountPath: {{ .Values.webhook.certDir }}
  102. readOnly: true
  103. {{- if .Values.webhook.extraVolumeMounts }}
  104. {{- toYaml .Values.webhook.extraVolumeMounts | nindent 12 }}
  105. {{- end }}
  106. {{- with .Values.webhook.extraInitContainers }}
  107. initContainers:
  108. {{- tpl (toYaml . | nindent 8) $ }}
  109. {{- end }}
  110. volumes:
  111. - name: certs
  112. secret:
  113. secretName: {{ include "external-secrets.fullname" . }}-webhook
  114. {{- if .Values.webhook.extraVolumes }}
  115. {{- toYaml .Values.webhook.extraVolumes | nindent 8 }}
  116. {{- end }}
  117. {{- with .Values.webhook.nodeSelector | default .Values.global.nodeSelector }}
  118. nodeSelector:
  119. {{- toYaml . | nindent 8 }}
  120. {{- end }}
  121. {{- with .Values.webhook.affinity | default .Values.global.affinity }}
  122. affinity:
  123. {{- toYaml . | nindent 8 }}
  124. {{- end }}
  125. {{- with .Values.webhook.tolerations | default .Values.global.tolerations }}
  126. tolerations:
  127. {{- toYaml . | nindent 8 }}
  128. {{- end }}
  129. {{- with .Values.webhook.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  130. topologySpreadConstraints:
  131. {{- toYaml . | nindent 8 }}
  132. {{- end }}
  133. {{- if .Values.webhook.priorityClassName }}
  134. priorityClassName: {{ .Values.webhook.priorityClassName }}
  135. {{- end }}
  136. {{- end }}