webhook-deployment.yaml 3.4 KB

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