validatingwebhook.yaml 3.4 KB

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