webhook-deployment.yaml 3.5 KB

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