From eab44398941ae251a7efe01110d471b4ac3bd3d7 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Mon, 4 Nov 2024 17:04:55 -0500 Subject: [PATCH] Allow embedded cluster installs to complete if config values are passed in (#4971) * automatically deploy embedded cluster apps with provided config values * expand comment * undo logic changes * add admin-console confirm-management command * actually include the command * f * return to 'deploy the app if --config-values are set in embedded cluster' --- pkg/airgap/airgap.go | 10 ++++++++-- pkg/kotsadmconfig/config.go | 2 ++ pkg/online/online.go | 10 ++++++++-- pkg/util/util.go | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/pkg/airgap/airgap.go b/pkg/airgap/airgap.go index 5600e0c9e5..7de2044ba4 100644 --- a/pkg/airgap/airgap.go +++ b/pkg/airgap/airgap.go @@ -281,8 +281,14 @@ func CreateAppFromAirgap(opts CreateAirgapAppOpts) (finalError error) { } if status == storetypes.VersionPendingClusterManagement { - // if pending cluster management, we don't want to deploy the app - return nil + if configFile != "" { + // if there is a config file, then we should proceed with the installation normally, not wait for the user + // to click through the UI to add nodes and configure the app + status = storetypes.VersionPendingConfig + } else { + // if pending cluster management, we don't want to deploy the app + return nil + } } hasStrictPreflights, err := store.GetStore().HasStrictPreflights(a.ID, newSequence) diff --git a/pkg/kotsadmconfig/config.go b/pkg/kotsadmconfig/config.go index 3b335ffa38..100534ae3a 100644 --- a/pkg/kotsadmconfig/config.go +++ b/pkg/kotsadmconfig/config.go @@ -48,6 +48,7 @@ func IsUnsetItem(item kotsv1beta1.ConfigItem) bool { return true } +// NeedsConfiguration returns true if the app has required config values that are not set func NeedsConfiguration(appSlug string, sequence int64, isAirgap bool, kotsKinds *kotsutil.KotsKinds, registrySettings registrytypes.RegistrySettings) (bool, error) { log := logger.NewCLILogger(os.Stdout) @@ -166,6 +167,7 @@ func UpdateAppConfigValues(values map[string]kotsv1beta1.ConfigValue, configGrou return values } +// this is where config values that are passed to the install command are read from func ReadConfigValuesFromInClusterSecret() (string, error) { log := logger.NewCLILogger(os.Stdout) diff --git a/pkg/online/online.go b/pkg/online/online.go index 0b707bcb27..7767874e45 100644 --- a/pkg/online/online.go +++ b/pkg/online/online.go @@ -220,8 +220,14 @@ func CreateAppFromOnline(opts CreateOnlineAppOpts) (_ *kotsutil.KotsKinds, final } if status == storetypes.VersionPendingClusterManagement { - // if pending cluster management, we don't want to deploy the app - return kotsKinds, nil + if configFile != "" { + // if there is a config file, then we should proceed with the installation normally, not wait for the user + // to click through the UI to add nodes and configure the app + status = storetypes.VersionPendingConfig + } else { + // if pending cluster management, we don't want to deploy the app + return kotsKinds, nil + } } hasStrictPreflights, err := store.GetStore().HasStrictPreflights(opts.PendingApp.ID, newSequence) diff --git a/pkg/util/util.go b/pkg/util/util.go index abe7e2bcb8..9924d4186a 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -161,7 +161,7 @@ func HomeDir() string { } func IsEmbeddedCluster() bool { - return os.Getenv("EMBEDDED_CLUSTER_ID") != "" + return EmbeddedClusterID() != "" } func EmbeddedClusterID() string {