From a9fa9289127af7d07556f83b334aa8205548e7fb Mon Sep 17 00:00:00 2001 From: Nick Chung Date: Mon, 21 Jul 2025 17:25:51 +0800 Subject: [PATCH] feat: Remove guest cluster in Rancher (#391) * feat: Remove guest cluster in Rancher Signed-off-by: Nick Chung * feat: add feature flag 1.6.0 Signed-off-by: Nick Chung * feat: update for review Signed-off-by: Nick Chung * chore: fix for review Signed-off-by: Nick Chung * chore: fix for review Signed-off-by: Nick Chung * refactor: reduce redundant code Signed-off-by: Andy Lee * chore: change text area to yaml editor Signed-off-by: Nick Chung * refactor: change radio and yaml editor position Signed-off-by: Andy Lee --------- Signed-off-by: Nick Chung Signed-off-by: Andy Lee Co-authored-by: Andy Lee --- .../components/settings/rancher-cluster.vue | 214 ++++++++++++++++++ pkg/harvester/config/feature-flags.js | 3 +- pkg/harvester/config/settings.ts | 5 +- pkg/harvester/l10n/en-us.yaml | 15 ++ 4 files changed, 234 insertions(+), 3 deletions(-) create mode 100644 pkg/harvester/components/settings/rancher-cluster.vue diff --git a/pkg/harvester/components/settings/rancher-cluster.vue b/pkg/harvester/components/settings/rancher-cluster.vue new file mode 100644 index 00000000..f711dc8a --- /dev/null +++ b/pkg/harvester/components/settings/rancher-cluster.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/pkg/harvester/config/feature-flags.js b/pkg/harvester/config/feature-flags.js index ee702552..6898bd06 100644 --- a/pkg/harvester/config/feature-flags.js +++ b/pkg/harvester/config/feature-flags.js @@ -43,7 +43,8 @@ const FEATURE_FLAGS = { 'customSupportBundle', 'csiOnlineExpandValidation', 'vmNetworkMigration', - 'kubeovnVpcSubnet' + 'kubeovnVpcSubnet', + 'rancherClusterSetting' ] }; diff --git a/pkg/harvester/config/settings.ts b/pkg/harvester/config/settings.ts index ff19fc50..84f6b78f 100644 --- a/pkg/harvester/config/settings.ts +++ b/pkg/harvester/config/settings.ts @@ -37,6 +37,7 @@ export const HCI_SETTING = { ADDITIONAL_GUEST_MEMORY_OVERHEAD_RATIO: 'additional-guest-memory-overhead-ratio', UPGRADE_CONFIG: 'upgrade-config', VM_MIGRATION_NETWORK: 'vm-migration-network', + RANCHER_CLUSTER: 'rancher-cluster', }; export const HCI_ALLOWED_SETTINGS = { @@ -108,8 +109,8 @@ export const HCI_ALLOWED_SETTINGS = { featureFlag: 'upgradeConfigSetting', docPath: 'UPGRADE_CONFIG_URL' }, - [HCI_SETTING.VM_MIGRATION_NETWORK]: { - kind: 'json', from: 'import', canReset: true, featureFlag: 'vmNetworkMigration', + [HCI_SETTING.RANCHER_CLUSTER]: { + kind: 'custom', from: 'import', canReset: true, featureFlag: 'rancherClusterSetting' }, }; diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml index d0e76f6b..1b15f898 100644 --- a/pkg/harvester/l10n/en-us.yaml +++ b/pkg/harvester/l10n/en-us.yaml @@ -1126,6 +1126,20 @@ harvester: publicCertificate: Public Certificate privateKey: Private Key ca: CA + rancherCluster: + description: Configure Rancher cluster integration for guest cluster management. This setting allows you to specify a Rancher KubeConfig and configure automatic cleanup behavior. + kubeConfig: Rancher KubeConfig + kubeConfigPlaceholder: Paste your Rancher KubeConfig content here... + removeUpstreamClusterWhenNamespaceIsDeleted: Remove Upstream Cluster When Namespace Is Deleted + createSecret: Create Rancher KubeConfig Secret + updateSecret: Update Rancher KubeConfig Secret + creatingSecret: Creating Secret... + updatingSecret: Updating Secret... + secretExists: A Rancher KubeConfig secret already exists and will be updated + secretCreated: Rancher KubeConfig secret created successfully + secretUpdated: Rancher KubeConfig secret updated successfully + secretCreationFailed: Failed to create Rancher KubeConfig secret + invalidKubeConfig: Invalid KubeConfig format. Please ensure it's a valid JSON kubeConfig file with apiVersion and kind fields. storageNetwork: range: placeholder: e.g. 172.16.0.0/24 @@ -1708,6 +1722,7 @@ advancedSettings: 'harv-additional-guest-memory-overhead-ratio': 'The ratio for kubevirt to adjust the VM overhead memory. The value could be zero, empty value or floating number between 1.0 and 10.0, default to 1.5.' 'harv-upgrade-config': 'Configure image preloading and VM restore options for upgrades. See related fields in settings/upgrade-config' 'harv-vm-migration-network': 'Segregated network for VM migration traffic.' + 'harv-rancher-cluster': 'Configure Rancher cluster integration settings for guest cluster management.' typeLabel: kubevirt.io.virtualmachine: |-