validatingwebhook.yaml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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: ["v1beta1"]
  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-v1beta1-secretstore
  31. admissionReviewVersions: ["v1", "v1beta1"]
  32. sideEffects: None
  33. timeoutSeconds: 5
  34. - name: "validate.clustersecretstore.external-secrets.io"
  35. rules:
  36. - apiGroups: ["external-secrets.io"]
  37. apiVersions: ["v1beta1"]
  38. operations: ["CREATE", "UPDATE", "DELETE"]
  39. resources: ["clustersecretstores"]
  40. scope: "Cluster"
  41. clientConfig:
  42. service:
  43. namespace: {{ template "external-secrets.namespace" . }}
  44. name: {{ include "external-secrets.fullname" . }}-webhook
  45. path: /validate-external-secrets-io-v1beta1-clustersecretstore
  46. admissionReviewVersions: ["v1", "v1beta1"]
  47. sideEffects: None
  48. timeoutSeconds: 5
  49. ---
  50. apiVersion: admissionregistration.k8s.io/v1
  51. kind: ValidatingWebhookConfiguration
  52. metadata:
  53. name: externalsecret-validate
  54. labels:
  55. {{- include "external-secrets-webhook.labels" . | nindent 4 }}
  56. external-secrets.io/component: webhook
  57. {{- if or .Values.webhook.annotations (and .Values.webhook.certManager.enabled .Values.webhook.certManager.addInjectorAnnotations) }}
  58. annotations:
  59. {{- if and .Values.webhook.certManager.enabled .Values.webhook.certManager.addInjectorAnnotations }}
  60. cert-manager.io/inject-ca-from: {{ template "external-secrets.namespace" . }}/{{ include "external-secrets.fullname" . }}-webhook
  61. {{- end }}
  62. {{- if .Values.webhook.annotations }}
  63. {{- toYaml .Values.webhook.annotations | nindent 4 }}
  64. {{- end }}
  65. {{- end }}
  66. webhooks:
  67. - name: "validate.externalsecret.external-secrets.io"
  68. rules:
  69. - apiGroups: ["external-secrets.io"]
  70. apiVersions: ["v1beta1"]
  71. operations: ["CREATE", "UPDATE", "DELETE"]
  72. resources: ["externalsecrets"]
  73. scope: "Namespaced"
  74. clientConfig:
  75. service:
  76. namespace: {{ template "external-secrets.namespace" . }}
  77. name: {{ include "external-secrets.fullname" . }}-webhook
  78. path: /validate-external-secrets-io-v1beta1-externalsecret
  79. admissionReviewVersions: ["v1", "v1beta1"]
  80. sideEffects: None
  81. timeoutSeconds: 5
  82. failurePolicy: {{ .Values.webhook.failurePolicy}}
  83. {{- end }}