Skip to content

Commit

Permalink
add user-defined options into Cilium ConfigMap
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
aanm authored and tklauser committed Mar 28, 2022
1 parent 6b00d68 commit aede6a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const (

IngressClassName = "cilium"
IngressControllerName = "cilium.io/ingress-controller"

ExtraConfigMapUserOptsKey = "io.cilium.cilium-cli"
)

var (
Expand Down
11 changes: 11 additions & 0 deletions install/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aede6a7

Please sign in to comment.