diff --git a/charts/kubeslice-worker/templates/webhook.yaml b/charts/kubeslice-worker/templates/webhook.yaml index 39de641..cbee59a 100644 --- a/charts/kubeslice-worker/templates/webhook.yaml +++ b/charts/kubeslice-worker/templates/webhook.yaml @@ -74,3 +74,49 @@ webhooks: - spire - {{ .Release.Namespace | quote }} - {{ .Values.controllerNamespace | quote }} +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + creationTimestamp: null + name: kubeslice-validating-webhook-configuration +webhooks: +- admissionReviewVersions: + - v1 + clientConfig: + caBundle: {{ $ca.Cert | b64enc }} + service: + name: kubeslice-webhook-service + namespace: {{ .Release.Namespace }} + path: /validate-webhook + failurePolicy: Fail + name: webhook.kubeslice.io + rules: + - apiGroups: + - networking.kubeslice.io + apiVersions: + - v1beta1 + operations: + - CREATE + - UPDATE + resources: + - serviceexports + sideEffects: NoneOnDryRun + namespaceSelector: + matchExpressions: + - key: kubeslice.io/slice + operator: Exists + - key: name + operator: NotIn + values: + - kube-system + - spire + - {{ .Release.Namespace | quote}} + - {{ .Values.controllerNamespace | quote }} + - key: kubernetes.io/metadata.name + operator: NotIn + values: + - kube-system + - spire + - {{ .Release.Namespace | quote }} + - {{ .Values.controllerNamespace | quote }} \ No newline at end of file