Skip to content

Commit

Permalink
Merge pull request #12562 from richard-cox/2.8-vsphere-ff
Browse files Browse the repository at this point in the history
[backport v2.8.10] CSI/CPI pre-bootstrap secrets are being created when the feature flag is disabled
  • Loading branch information
momesgin authored Nov 8, 2024
2 parents 46ac400 + d592acd commit 1e33561
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions shell/store/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const FLEET = create('continuous-delivery', true);
export const HARVESTER = create('harvester', true);
export const HARVESTER_CONTAINER = create('harvester-baremetal-container-workload', false);
export const FLEET_WORKSPACE_BACK = create('provisioningv2-fleet-workspace-back-population', false);
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 @@ -88,10 +92,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 @@ -165,6 +187,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 1e33561

Please sign in to comment.