From 92a5d3d164dfc003848cb04b814c9c2138a3fd69 Mon Sep 17 00:00:00 2001 From: Marco Orovecchia Date: Tue, 29 Oct 2024 14:43:44 +0100 Subject: [PATCH 1/2] feat: allow setting mutating webhook failurepolicy fixes https://github.com/open-feature/open-feature-operator/issues/654 Signed-off-by: Marco Orovecchia --- chart/open-feature-operator/values.yaml | 6 ++++++ config/overlays/helm/kustomization.yaml | 1 + config/overlays/helm/mutatingwebhook.yaml | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 config/overlays/helm/mutatingwebhook.yaml diff --git a/chart/open-feature-operator/values.yaml b/chart/open-feature-operator/values.yaml index 9a4034966..411ed7d04 100644 --- a/chart/open-feature-operator/values.yaml +++ b/chart/open-feature-operator/values.yaml @@ -18,6 +18,12 @@ labels: {} ## @param annotations Annotations to apply to all of the pods in the operator. annotations: {} +## @section Mutating Webhook configuration +mutatingWebhook: + ## @param mutatingWebhook.failurePolicy FailurePolicy when the webhook does not respond + failurePolicy: Ignore + ## @param mutatingWebhook.objectSelector ObjectSelector on which pods the mutatingWebhook will run + objectSelector: {} ## @section Sidecar configuration sidecarConfiguration: ## @param sidecarConfiguration.port Sets the value of the `XXX_PORT` environment variable for the injected sidecar. diff --git a/config/overlays/helm/kustomization.yaml b/config/overlays/helm/kustomization.yaml index 809ecf305..8c6c16dd9 100644 --- a/config/overlays/helm/kustomization.yaml +++ b/config/overlays/helm/kustomization.yaml @@ -16,6 +16,7 @@ patchesStrategicMerge: - manager.yaml - exclude-webhook-server-container-port.yaml - exclude-validatingwebhook.yaml + - mutatingwebhook.yaml configMapGenerator: - name: manager-config diff --git a/config/overlays/helm/mutatingwebhook.yaml b/config/overlays/helm/mutatingwebhook.yaml new file mode 100644 index 000000000..0486f64a9 --- /dev/null +++ b/config/overlays/helm/mutatingwebhook.yaml @@ -0,0 +1,8 @@ +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + name: mutating-webhook-configuration +webhooks: + - name: mutate.openfeature.dev + failurePolicy: "___{{ .Values.mutatingWebhook.failurePolicy }}___" + objectSelector: "___{{ toYaml .Values.mutatingWebhook.objectSelector | nindent 4 }}___" From 0d59028f6654d0b338c25e1c4e0fd54df4644de3 Mon Sep 17 00:00:00 2001 From: Marco Orovecchia Date: Mon, 4 Nov 2024 09:16:52 +0100 Subject: [PATCH 2/2] docs: add mutating webhook config Signed-off-by: Marco Orovecchia --- chart/open-feature-operator/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chart/open-feature-operator/README.md b/chart/open-feature-operator/README.md index c25984031..76922f8f1 100644 --- a/chart/open-feature-operator/README.md +++ b/chart/open-feature-operator/README.md @@ -108,6 +108,13 @@ The command removes all the Kubernetes components associated with the chart and | `labels` | Labels to apply to all of the pods in the operator. | `{}` | | `annotations` | Annotations to apply to all of the pods in the operator. | `{}` | +### Mutating Webhook configuration + +| Name | Description | Value | +| -------------------------------- | --------------------------------------------------------- | -------- | +| `mutatingWebhook.failurePolicy` | FailurePolicy when the webhook does not respond | `Ignore` | +| `mutatingWebhook.objectSelector` | ObjectSelector on which pods the mutatingWebhook will run | `{}` | + ### Sidecar configuration | Name | Description | Value |