diff --git a/shell/edit/provisioning.cattle.io.cluster/rke2.vue b/shell/edit/provisioning.cattle.io.cluster/rke2.vue index c1757fed9ca..903f39dd734 100644 --- a/shell/edit/provisioning.cattle.io.cluster/rke2.vue +++ b/shell/edit/provisioning.cattle.io.cluster/rke2.vue @@ -64,14 +64,12 @@ import AddOnConfig from '@shell/edit/provisioning.cattle.io.cluster/tabs/AddOnCo import Advanced from '@shell/edit/provisioning.cattle.io.cluster/tabs/Advanced'; import ClusterAppearance from '@shell/components/form/ClusterAppearance'; import AddOnAdditionalManifest from '@shell/edit/provisioning.cattle.io.cluster/tabs/AddOnAdditionalManifest'; -import VsphereUtils from '@shell/utils/v-sphere'; +import VsphereUtils, { VMWARE_VSPHERE } from '@shell/utils/v-sphere'; const HARVESTER = 'harvester'; const HARVESTER_CLOUD_PROVIDER = 'harvester-cloud-provider'; const NETBIOS_TRUNCATION_LENGTH = 15; -const VMWARE_VSPHERE = 'vmwarevsphere'; - /** * Classes to be adopted by the node badges in Machine pools */ diff --git a/shell/store/features.js b/shell/store/features.js index 6789ecfd8a5..35df2b09cb6 100644 --- a/shell/store/features.js +++ b/shell/store/features.js @@ -35,6 +35,7 @@ export const HARVESTER_CONTAINER = create('harvester-baremetal-container-workloa export const FLEET_WORKSPACE_BACK = create('provisioningv2-fleet-workspace-back-population', false); export const STEVE_CACHE = create('ui-sql-cache', false); export const UIEXTENSION = create('uiextension', true); +export const PROVISIONING_PRE_BOOTSTRAP = create('provisioningprebootstrap', false); // Not currently used.. no point defining ones we don't use // export const EMBEDDED_CLUSTER_API = create('embedded-cluster-api', true); diff --git a/shell/utils/v-sphere.ts b/shell/utils/v-sphere.ts index 4e1efbdf439..09f895b10d5 100644 --- a/shell/utils/v-sphere.ts +++ b/shell/utils/v-sphere.ts @@ -1,5 +1,8 @@ import merge from 'lodash/merge'; import { SECRET } from '@shell/config/types'; +import { PROVISIONING_PRE_BOOTSTRAP } from '@shell/store/features'; + +export const VMWARE_VSPHERE = 'vmwarevsphere'; type Rke2Component = { versionInfo: any; @@ -7,6 +10,7 @@ type Rke2Component = { chartVersionKey: (chartName: string) => string; value: any; isEdit: boolean; + provider: string; $store: any, } @@ -88,10 +92,33 @@ class VSphereUtils { }; } + /** + * Check that system is setup to handle vsphere secrets syncing downstream + * + * Do this via checking the provider and that the required FF is enabled. + */ + private handleVsphereSecret({ $store, provider }: { $store: any, provider: string}): boolean { + if (provider !== VMWARE_VSPHERE) { + return false; + } + + const isPrebootstrapEnabled = $store.getters['features/get'](PROVISIONING_PRE_BOOTSTRAP); + + if (!isPrebootstrapEnabled) { + return false; + } + + return true; + } + /** * Create upstream vsphere cpi secret to sync downstream */ async handleVsphereCpiSecret(rke2Component: Rke2Component) { + if (!this.handleVsphereSecret(rke2Component)) { + return; + } + const generateName = `${ rootGenerateName }cpi-`; const downstreamName = 'rancher-vsphere-cpi-credentials'; const downstreamNamespace = 'kube-system'; @@ -165,6 +192,10 @@ class VSphereUtils { * Create upstream vsphere csi secret to sync downstream */ async handleVsphereCsiSecret(rke2Component: Rke2Component) { + if (!this.handleVsphereSecret(rke2Component)) { + return; + } + const generateName = `${ rootGenerateName }csi-`; const downstreamName = 'rancher-vsphere-csi-credentials'; const downstreamNamespace = 'kube-system';