webhook-deployment.yaml 3.9 KB

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