webhook-deployment.yaml 4.2 KB

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