webhook-deployment.yaml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. {{- if .Values.webhook.lookaheadInterval }}
  63. - --lookahead-interval={{ .Values.webhook.lookaheadInterval }}
  64. {{- end }}
  65. {{- range $key, $value := .Values.webhook.extraArgs }}
  66. {{- if $value }}
  67. - --{{ $key }}={{ $value }}
  68. {{- else }}
  69. - --{{ $key }}
  70. {{- end }}
  71. {{- end }}
  72. ports:
  73. - containerPort: {{ .Values.webhook.metrics.listen.port }}
  74. protocol: TCP
  75. name: metrics
  76. - containerPort: {{ .Values.webhook.port }}
  77. protocol: TCP
  78. name: webhook
  79. readinessProbe:
  80. httpGet:
  81. port: {{ .Values.webhook.readinessProbe.port }}
  82. path: /readyz
  83. initialDelaySeconds: 20
  84. periodSeconds: 5
  85. {{- with .Values.webhook.extraEnv }}
  86. env:
  87. {{- toYaml . | nindent 12 }}
  88. {{- end }}
  89. {{- with .Values.webhook.resources }}
  90. resources:
  91. {{- toYaml . | nindent 12 }}
  92. {{- end }}
  93. volumeMounts:
  94. - name: certs
  95. mountPath: {{ .Values.webhook.certDir }}
  96. readOnly: true
  97. {{- if .Values.webhook.extraVolumeMounts }}
  98. {{- toYaml .Values.webhook.extraVolumeMounts | nindent 12 }}
  99. {{- end }}
  100. volumes:
  101. - name: certs
  102. secret:
  103. secretName: {{ include "external-secrets.fullname" . }}-webhook
  104. {{- if .Values.webhook.extraVolumes }}
  105. {{- toYaml .Values.webhook.extraVolumes | nindent 8 }}
  106. {{- end }}
  107. {{- with .Values.webhook.nodeSelector | default .Values.global.nodeSelector }}
  108. nodeSelector:
  109. {{- toYaml . | nindent 8 }}
  110. {{- end }}
  111. {{- with .Values.webhook.affinity | default .Values.global.affinity }}
  112. affinity:
  113. {{- toYaml . | nindent 8 }}
  114. {{- end }}
  115. {{- with .Values.webhook.tolerations | default .Values.global.tolerations }}
  116. tolerations:
  117. {{- toYaml . | nindent 8 }}
  118. {{- end }}
  119. {{- with .Values.webhook.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  120. topologySpreadConstraints:
  121. {{- toYaml . | nindent 8 }}
  122. {{- end }}
  123. {{- if .Values.webhook.priorityClassName }}
  124. priorityClassName: {{ .Values.webhook.priorityClassName }}
  125. {{- end }}
  126. {{- end }}