validatingwebhook.yaml 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {{- if .Values.webhook.create }}
  2. apiVersion: admissionregistration.k8s.io/v1
  3. kind: ValidatingWebhookConfiguration
  4. metadata:
  5. name: secretstore-validate
  6. labels:
  7. {{- include "external-secrets-webhook.labels" . | nindent 4 }}
  8. external-secrets.io/component: webhook
  9. {{- if or .Values.webhook.annotations (and .Values.webhook.certManager.enabled .Values.webhook.certManager.addInjectorAnnotations) }}
  10. annotations:
  11. {{- if and .Values.webhook.certManager.enabled .Values.webhook.certManager.addInjectorAnnotations }}
  12. cert-manager.io/inject-ca-from: {{ template "external-secrets.namespace" . }}/{{ include "external-secrets.fullname" . }}-webhook
  13. {{- end }}
  14. {{- if .Values.webhook.annotations }}
  15. {{- toYaml .Values.webhook.annotations | nindent 4 }}
  16. {{- end }}
  17. {{- end }}
  18. webhooks:
  19. - name: "validate.secretstore.external-secrets.io"
  20. rules:
  21. - apiGroups: ["external-secrets.io"]
  22. apiVersions: ["v1"]
  23. operations: ["CREATE", "UPDATE", "DELETE"]
  24. resources: ["secretstores"]
  25. scope: "Namespaced"
  26. clientConfig:
  27. service:
  28. namespace: {{ template "external-secrets.namespace" . }}
  29. name: {{ include "external-secrets.fullname" . }}-webhook
  30. path: /validate-external-secrets-io-v1-secretstore
  31. admissionReviewVersions: ["v1", "v1beta1"]
  32. sideEffects: None
  33. timeoutSeconds: 5
  34. failurePolicy: {{ .Values.webhook.failurePolicy }}
  35. - name: "validate.clustersecretstore.external-secrets.io"
  36. rules:
  37. - apiGroups: ["external-secrets.io"]
  38. apiVersions: ["v1"]
  39. operations: ["CREATE", "UPDATE", "DELETE"]
  40. resources: ["clustersecretstores"]
  41. scope: "Cluster"
  42. clientConfig:
  43. service:
  44. namespace: {{ template "external-secrets.namespace" . }}
  45. name: {{ include "external-secrets.fullname" . }}-webhook
  46. path: /validate-external-secrets-io-v1-clustersecretstore
  47. admissionReviewVersions: ["v1", "v1beta1"]
  48. sideEffects: None
  49. timeoutSeconds: 5
  50. ---
  51. apiVersion: admissionregistration.k8s.io/v1
  52. kind: ValidatingWebhookConfiguration
  53. metadata:
  54. name: externalsecret-validate
  55. labels:
  56. {{- include "external-secrets-webhook.labels" . | nindent 4 }}
  57. external-secrets.io/component: webhook
  58. {{- if or .Values.webhook.annotations (and .Values.webhook.certManager.enabled .Values.webhook.certManager.addInjectorAnnotations) }}
  59. annotations:
  60. {{- if and .Values.webhook.certManager.enabled .Values.webhook.certManager.addInjectorAnnotations }}
  61. cert-manager.io/inject-ca-from: {{ template "external-secrets.namespace" . }}/{{ include "external-secrets.fullname" . }}-webhook
  62. {{- end }}
  63. {{- if .Values.webhook.annotations }}
  64. {{- toYaml .Values.webhook.annotations | nindent 4 }}
  65. {{- end }}
  66. {{- end }}
  67. webhooks:
  68. - name: "validate.externalsecret.external-secrets.io"
  69. rules:
  70. - apiGroups: ["external-secrets.io"]
  71. apiVersions: ["v1"]
  72. operations: ["CREATE", "UPDATE", "DELETE"]
  73. resources: ["externalsecrets"]
  74. scope: "Namespaced"
  75. clientConfig:
  76. service:
  77. namespace: {{ template "external-secrets.namespace" . }}
  78. name: {{ include "external-secrets.fullname" . }}-webhook
  79. path: /validate-external-secrets-io-v1-externalsecret
  80. admissionReviewVersions: ["v1", "v1beta1"]
  81. sideEffects: None
  82. timeoutSeconds: 5
  83. failurePolicy: {{ .Values.webhook.failurePolicy}}
  84. {{- end }}