From f06e7f27b080eba1ba9d8770d42bcb0e240117e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Wed, 7 Apr 2021 13:44:50 +0200 Subject: [PATCH 1/2] cli/cmd/cluster: allow to skip the control plane update When the cluster is not fully set up and lokoctl is run again to fix that problem, the user may want to avoid the control plane update happen at the same time, because it can cause issues. --- cli/cmd/cluster-apply.go | 4 ++++ cli/cmd/cluster/apply.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/cmd/cluster-apply.go b/cli/cmd/cluster-apply.go index c34849082..c6d7e08c1 100644 --- a/cli/cmd/cluster-apply.go +++ b/cli/cmd/cluster-apply.go @@ -26,6 +26,7 @@ var ( verbose bool skipComponents bool skipPreUpdateHealthCheck bool + skipControlPlaneUpdate bool upgradeKubelets bool ) @@ -47,6 +48,8 @@ func init() { pf.BoolVarP(&skipPreUpdateHealthCheck, "skip-pre-update-health-check", "", false, "Skip ensuring that cluster is healthy before updating (not recommended)") + pf.BoolVarP(&skipControlPlaneUpdate, "skip-control-plane-update", "", false, + "Skip updating the control plane (not recommended)") pf.BoolVarP(&upgradeKubelets, "upgrade-kubelets", "", false, "Experimentally upgrade self-hosted kubelets") } @@ -62,6 +65,7 @@ func runClusterApply(cmd *cobra.Command, args []string) { UpgradeKubelets: upgradeKubelets, SkipComponents: skipComponents, SkipPreUpdateHealthCheck: skipPreUpdateHealthCheck, + SkipControlPlaneUpdate: skipControlPlaneUpdate, Verbose: verbose, ConfigPath: viper.GetString("lokocfg"), ValuesPath: viper.GetString("lokocfg-vars"), diff --git a/cli/cmd/cluster/apply.go b/cli/cmd/cluster/apply.go index 3b838e68f..bc74e9b7b 100644 --- a/cli/cmd/cluster/apply.go +++ b/cli/cmd/cluster/apply.go @@ -31,6 +31,7 @@ type ApplyOptions struct { UpgradeKubelets bool SkipComponents bool SkipPreUpdateHealthCheck bool + SkipControlPlaneUpdate bool Verbose bool ConfigPath string ValuesPath string @@ -126,7 +127,7 @@ func Apply(contextLogger *log.Entry, options ApplyOptions) error { } // Do controlplane upgrades only if cluster already exists and it is not a managed platform. - if exists && !c.platform.Meta().Managed { + if exists && !options.SkipControlPlaneUpdate && !c.platform.Meta().Managed { fmt.Printf("\nEnsuring that cluster controlplane is up to date.\n") if err := c.upgradeControlPlane(contextLogger, kubeconfig); err != nil { From 955edbe21a88ef5ff54bc256fcea37048ec22564 Mon Sep 17 00:00:00 2001 From: Imran Pochi Date: Fri, 4 Jun 2021 11:15:21 +0530 Subject: [PATCH 2/2] docs: update cli docs Updates the cli flags to reflect the new flag `--skip-control-plane-update`. Signed-off-by: Imran Pochi --- docs/cli/lokoctl_cluster_apply.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/cli/lokoctl_cluster_apply.md b/docs/cli/lokoctl_cluster_apply.md index 19bce7ebe..63e07a518 100644 --- a/docs/cli/lokoctl_cluster_apply.md +++ b/docs/cli/lokoctl_cluster_apply.md @@ -21,6 +21,7 @@ lokoctl cluster apply [flags] --confirm Upgrade cluster without asking for confirmation -h, --help help for apply --skip-components Skip applying component configuration + --skip-control-plane-update Skip updating the control plane (not recommended) --skip-pre-update-health-check Skip ensuring that cluster is healthy before updating (not recommended) --upgrade-kubelets Experimentally upgrade self-hosted kubelets -v, --verbose Show output from Terraform