webhook-deployment.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. 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. {{- if and (.enabled) (gt (keys . | len) 1) }}
  40. securityContext:
  41. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 8 }}
  42. {{- end }}
  43. {{- end }}
  44. containers:
  45. - name: webhook
  46. {{- with .Values.webhook.securityContext }}
  47. {{- if and (.enabled) (gt (keys . | len) 1) }}
  48. securityContext:
  49. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 12 }}
  50. {{- end }}
  51. {{- end }}
  52. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.webhook.image) | trim }}
  53. imagePullPolicy: {{ .Values.webhook.image.pullPolicy }}
  54. args:
  55. - webhook
  56. - --port={{ .Values.webhook.port }}
  57. - --dns-name={{ include "external-secrets.fullname" . }}-webhook.{{ template "external-secrets.namespace" . }}.svc
  58. - --cert-dir={{ .Values.webhook.certDir }}
  59. - --check-interval={{ .Values.webhook.certCheckInterval }}
  60. - --metrics-addr=:{{ .Values.webhook.metrics.listen.port }}
  61. - --healthz-addr={{ .Values.webhook.readinessProbe.address }}:{{ .Values.webhook.readinessProbe.port }}
  62. - --loglevel={{ .Values.webhook.log.level }}
  63. - --zap-time-encoding={{ .Values.webhook.log.timeEncoding }}
  64. {{- if .Values.webhook.lookaheadInterval }}
  65. - --lookahead-interval={{ .Values.webhook.lookaheadInterval }}
  66. {{- end }}
  67. {{- range $key, $value := .Values.webhook.extraArgs }}
  68. {{- if $value }}
  69. - --{{ $key }}={{ $value }}
  70. {{- else }}
  71. - --{{ $key }}
  72. {{- end }}
  73. {{- end }}
  74. ports:
  75. - containerPort: {{ .Values.webhook.metrics.listen.port }}
  76. protocol: TCP
  77. name: metrics
  78. - containerPort: {{ .Values.webhook.port }}
  79. protocol: TCP
  80. name: webhook
  81. readinessProbe:
  82. httpGet:
  83. port: {{ .Values.webhook.readinessProbe.port }}
  84. path: /readyz
  85. initialDelaySeconds: 20
  86. periodSeconds: 5
  87. {{- with .Values.webhook.extraEnv }}
  88. env:
  89. {{- toYaml . | nindent 12 }}
  90. {{- end }}
  91. {{- with .Values.webhook.resources }}
  92. resources:
  93. {{- toYaml . | nindent 12 }}
  94. {{- end }}
  95. volumeMounts:
  96. - name: certs
  97. mountPath: {{ .Values.webhook.certDir }}
  98. readOnly: true
  99. {{- if .Values.webhook.extraVolumeMounts }}
  100. {{- toYaml .Values.webhook.extraVolumeMounts | nindent 12 }}
  101. {{- end }}
  102. volumes:
  103. - name: certs
  104. secret:
  105. secretName: {{ include "external-secrets.fullname" . }}-webhook
  106. {{- if .Values.webhook.extraVolumes }}
  107. {{- toYaml .Values.webhook.extraVolumes | nindent 8 }}
  108. {{- end }}
  109. {{- with .Values.webhook.nodeSelector | default .Values.global.nodeSelector }}
  110. nodeSelector:
  111. {{- toYaml . | nindent 8 }}
  112. {{- end }}
  113. {{- with .Values.webhook.affinity | default .Values.global.affinity }}
  114. affinity:
  115. {{- toYaml . | nindent 8 }}
  116. {{- end }}
  117. {{- with .Values.webhook.tolerations | default .Values.global.tolerations }}
  118. tolerations:
  119. {{- toYaml . | nindent 8 }}
  120. {{- end }}
  121. {{- with .Values.webhook.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  122. topologySpreadConstraints:
  123. {{- toYaml . | nindent 8 }}
  124. {{- end }}
  125. {{- if .Values.webhook.priorityClassName }}
  126. priorityClassName: {{ .Values.webhook.priorityClassName }}
  127. {{- end }}
  128. {{- end }}