Skip to content

Commit

Permalink
Merge pull request #12547 from momesgin/12530-prebootstrap-flag
Browse files Browse the repository at this point in the history
Take `prebootstrap` flag into account before creating vSphere secrets
  • Loading branch information
richard-cox authored Nov 8, 2024
2 parents f9cdb12 + 8ccfffc commit 413828f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
4 changes: 1 addition & 3 deletions shell/edit/provisioning.cattle.io.cluster/rke2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ import Advanced from '@shell/edit/provisioning.cattle.io.cluster/tabs/Advanced';
import { DEFAULT_COMMON_BASE_PATH, DEFAULT_SUBDIRS } from '@shell/edit/provisioning.cattle.io.cluster/tabs/DirectoryConfig';
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
*/
Expand Down
1 change: 1 addition & 0 deletions shell/store/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
26 changes: 26 additions & 0 deletions shell/utils/v-sphere.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
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;
userChartValues: any;
chartVersionKey: (chartName: string) => string;
value: any;
isEdit: boolean;
provider: string;
$store: any,
}

Expand Down Expand Up @@ -91,10 +95,28 @@ class VSphereUtils {
};
}

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';
Expand Down Expand Up @@ -168,6 +190,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';
Expand Down

0 comments on commit 413828f

Please sign in to comment.