webhook-deployment.yaml 4.2 KB

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