From aede6a7e26586f08032b228c4fde2f833102ed9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Martins?= Date: Sat, 5 Mar 2022 03:53:39 +0100 Subject: [PATCH] add user-defined options into Cilium ConfigMap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to keep the cilium-cli options set by the user we should store it as part of a special key in Cilium's ConfigMap. This will allow cilium-cli to know the intent from the user for the current cluster installation without requiring to set helm flags every time the user interacts with the cluster via cilium-cli. Signed-off-by: André Martins --- defaults/defaults.go | 2 ++ install/helm.go | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/defaults/defaults.go b/defaults/defaults.go index 2af0e7f064..4fa51c9e32 100644 --- a/defaults/defaults.go +++ b/defaults/defaults.go @@ -93,6 +93,8 @@ const ( IngressClassName = "cilium" IngressControllerName = "cilium.io/ingress-controller" + + ExtraConfigMapUserOptsKey = "io.cilium.cilium-cli" ) var ( diff --git a/install/helm.go b/install/helm.go index e90c5101f0..cc4fa16734 100644 --- a/install/helm.go +++ b/install/helm.go @@ -264,6 +264,17 @@ func (k *K8sInstaller) generateManifests(ctx context.Context) error { k.Log("ℹ️ helm template --namespace %s cilium cilium/cilium --version %s --set %s", k.params.Namespace, ciliumVer, valsStr) } + // Store the current helm-opts used in this installation in Cilium's + // ConfigMap + extraConfig := map[string]interface{}{ + "extraConfig": map[string]interface{}{ + defaults.ExtraConfigMapUserOptsKey: valsStr, + }, + } + + // User-defined helm options will overwrite the default cilium-cli helm options + vals = mergeMaps(extraConfig, vals) + rel, err := helmClient.RunWithContext(ctx, helmChart, vals) if err != nil { return err