diff --git a/pkg/harvester/components/SettingList.vue b/pkg/harvester/components/SettingList.vue index 459d6430..c7e98160 100644 --- a/pkg/harvester/components/SettingList.vue +++ b/pkg/harvester/components/SettingList.vue @@ -56,6 +56,10 @@ export default { methods: { filterCategorySettings() { return this.settings.filter((s) => { + if (!this.getFeatureEnabled(s.featureFlag)) { + return false; + } + if (this.category !== 'advanced') { return (CATEGORY[this.category] || []).find((item) => item === s.id); } else if (this.category === 'advanced') { @@ -65,6 +69,11 @@ export default { } }) || []; }, + + getFeatureEnabled(id) { + return id ? this.$store.getters['harvester-common/getFeatureEnabled'](id) : true; + }, + showActionMenu(e, setting) { const actionElement = e.srcElement; diff --git a/pkg/harvester/config/settings.js b/pkg/harvester/config/settings.ts similarity index 96% rename from pkg/harvester/config/settings.js rename to pkg/harvester/config/settings.ts index 1bec2d45..3dc8c295 100644 --- a/pkg/harvester/config/settings.js +++ b/pkg/harvester/config/settings.ts @@ -33,7 +33,7 @@ export const HCI_SETTING = { AUTO_ROTATE_RKE2_CERTS: 'auto-rotate-rke2-certs', KUBECONFIG_DEFAULT_TOKEN_TTL_MINUTES: 'kubeconfig-default-token-ttl-minutes', LONGHORN_V2_DATA_ENGINE_ENABLED: 'longhorn-v2-data-engine-enabled', - ADDITIONAL_GUEST_MEMORY_OVERHEAD_RATIO: 'additional-guest-memory-overhead-ratio' + ADDITIONAL_GUEST_MEMORY_OVERHEAD_RATIO: 'additional-guest-memory-overhead-ratio', }; export const HCI_ALLOWED_SETTINGS = { @@ -85,7 +85,11 @@ export const HCI_ALLOWED_SETTINGS = { kind: 'json', from: 'import', canReset: true }, [HCI_SETTING.KUBECONFIG_DEFAULT_TOKEN_TTL_MINUTES]: {}, - [HCI_SETTING.LONGHORN_V2_DATA_ENGINE_ENABLED]: { kind: 'boolean', experimental: true }, + [HCI_SETTING.LONGHORN_V2_DATA_ENGINE_ENABLED]: { + kind: 'boolean', + experimental: true, + featureFlag: 'longhornV2LVMSupport' + }, [HCI_SETTING.ADDITIONAL_GUEST_MEMORY_OVERHEAD_RATIO]: { kind: 'string', from: 'import' }, }; diff --git a/pkg/harvester/edit/harvesterhci.io.host/index.vue b/pkg/harvester/edit/harvesterhci.io.host/index.vue index 9ba60f46..4cd03be5 100644 --- a/pkg/harvester/edit/harvesterhci.io.host/index.vue +++ b/pkg/harvester/edit/harvesterhci.io.host/index.vue @@ -9,9 +9,7 @@ import ArrayListGrouped from '@shell/components/form/ArrayListGrouped'; import ButtonDropdown from '@shell/components/ButtonDropdown'; import CreateEditView from '@shell/mixins/create-edit-view'; import { HCI as HCI_LABELS_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; -import { - LONGHORN, SECRET, LONGHORN_DRIVER, LONGHORN_VERSION_V1, LONGHORN_VERSION_V2 -} from '@shell/config/types'; +import { LONGHORN, SECRET, LONGHORN_DRIVER, LONGHORN_VERSION_V1 } from '@shell/config/types'; import { allHash } from '@shell/utils/promise'; import { formatSi } from '@shell/utils/units'; import { findBy } from '@shell/utils/array'; @@ -75,10 +73,13 @@ export default { longhornNodes: this.$store.dispatch(`${ inStore }/findAll`, { type: LONGHORN.NODES }), blockDevices: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.BLOCK_DEVICE }), addons: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.ADD_ONS }), - secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET }), - longhornV2DataEngine: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }), + secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET }) }; + if (this.longhornV2LVMSupport) { + hash.longhornV2DataEngine = this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }); + } + if (this.$store.getters[`${ inStore }/schemaFor`](HCI.INVENTORY)) { hash.inventories = this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.INVENTORY }); } @@ -161,6 +162,10 @@ export default { computed: { ...mapGetters({ t: 'i18n/t' }), + longhornV2LVMSupport() { + return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport'); + }, + removedDisks() { const out = this.disks.filter((d) => { return !findBy(this.newDisks, 'name', d.name); @@ -169,13 +174,6 @@ export default { return out; }, - longhornSystemVersion() { - const inStore = this.$store.getters['currentProduct'].inStore; - const v2DataEngine = this.$store.getters[`${ inStore }/byId`](LONGHORN.SETTINGS, LONGHORN_V2_DATA_ENGINE) || {}; - - return v2DataEngine.value === 'true' ? LONGHORN_VERSION_V2 : LONGHORN_VERSION_V1; - }, - longhornDisks() { const inStore = this.$store.getters['currentProduct'].inStore; const longhornNode = this.$store.getters[`${ inStore }/byId`](LONGHORN.NODES, `${ LONGHORN_SYSTEM }/${ this.value.id }`); diff --git a/pkg/harvester/edit/harvesterhci.io.storage/index.vue b/pkg/harvester/edit/harvesterhci.io.storage/index.vue index 1ee1dc1d..f512ffe1 100644 --- a/pkg/harvester/edit/harvesterhci.io.storage/index.vue +++ b/pkg/harvester/edit/harvesterhci.io.storage/index.vue @@ -124,14 +124,19 @@ export default { async fetch() { const inStore = this.$store.getters['currentProduct'].inStore; - await allHash({ + const hash = { namespaces: this.$store.dispatch(`${ inStore }/findAll`, { type: NAMESPACE }), secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET }), storages: this.$store.dispatch(`${ inStore }/findAll`, { type: STORAGE_CLASS }), longhornNodes: this.$store.dispatch(`${ inStore }/findAll`, { type: LONGHORN.NODES }), - csiDrivers: this.$store.dispatch(`${ inStore }/findAll`, { type: CSI_DRIVER }), - longhornV2DataEngine: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }), - }); + csiDrivers: this.$store.dispatch(`${ inStore }/findAll`, { type: CSI_DRIVER }) + }; + + if (this.longhornV2LVMSupport) { + hash.longhornV2DataEngine = this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }); + } + + await allHash(hash); }, computed: { @@ -145,6 +150,10 @@ export default { return this.isCreate ? _CREATE : _VIEW; }, + longhornV2LVMSupport() { + return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport'); + }, + provisioners() { const out = []; diff --git a/pkg/harvester/edit/harvesterhci.io.volume.vue b/pkg/harvester/edit/harvesterhci.io.volume.vue index d448bcff..d5072d32 100644 --- a/pkg/harvester/edit/harvesterhci.io.volume.vue +++ b/pkg/harvester/edit/harvesterhci.io.volume.vue @@ -106,6 +106,10 @@ export default { return this.source === 'url'; }, + longhornV2LVMSupport() { + return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport'); + }, + sourceOption() { return [{ value: 'blank', @@ -233,6 +237,10 @@ export default { methods: { getAccessMode() { + if (!this.longhornV2LVMSupport) { + return ['ReadWriteMany']; + } + const storageClassName = this.value.spec.storageClassName; const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName); diff --git a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/volume.vue b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/volume.vue index c4e24858..be5ebef6 100644 --- a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/volume.vue +++ b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/volume.vue @@ -65,6 +65,10 @@ export default { }, computed: { + longhornV2LVMSupport() { + return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport'); + }, + encryptionValue() { return ucFirst(String(this.value.isEncrypted)); }, @@ -146,6 +150,10 @@ export default { methods: { getAccessMode(storageClassName) { + if (!this.longhornV2LVMSupport) { + return 'ReadWriteMany'; + } + const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName); let readWriteOnce = this.value.pvc?.isLvm || this.value.pvc?.isLonghornV2;