webhook-deployment.yaml 4.1 KB

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