mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
Implement longhornV2LVMSupport feature flag
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
parent
9a7ca75b74
commit
de992aa18d
@ -56,6 +56,10 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
filterCategorySettings() {
|
filterCategorySettings() {
|
||||||
return this.settings.filter((s) => {
|
return this.settings.filter((s) => {
|
||||||
|
if (!this.getFeatureEnabled(s.featureFlag)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.category !== 'advanced') {
|
if (this.category !== 'advanced') {
|
||||||
return (CATEGORY[this.category] || []).find((item) => item === s.id);
|
return (CATEGORY[this.category] || []).find((item) => item === s.id);
|
||||||
} else if (this.category === 'advanced') {
|
} 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) {
|
showActionMenu(e, setting) {
|
||||||
const actionElement = e.srcElement;
|
const actionElement = e.srcElement;
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ export const HCI_SETTING = {
|
|||||||
AUTO_ROTATE_RKE2_CERTS: 'auto-rotate-rke2-certs',
|
AUTO_ROTATE_RKE2_CERTS: 'auto-rotate-rke2-certs',
|
||||||
KUBECONFIG_DEFAULT_TOKEN_TTL_MINUTES: 'kubeconfig-default-token-ttl-minutes',
|
KUBECONFIG_DEFAULT_TOKEN_TTL_MINUTES: 'kubeconfig-default-token-ttl-minutes',
|
||||||
LONGHORN_V2_DATA_ENGINE_ENABLED: 'longhorn-v2-data-engine-enabled',
|
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 = {
|
export const HCI_ALLOWED_SETTINGS = {
|
||||||
@ -85,7 +85,11 @@ export const HCI_ALLOWED_SETTINGS = {
|
|||||||
kind: 'json', from: 'import', canReset: true
|
kind: 'json', from: 'import', canReset: true
|
||||||
},
|
},
|
||||||
[HCI_SETTING.KUBECONFIG_DEFAULT_TOKEN_TTL_MINUTES]: {},
|
[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' },
|
[HCI_SETTING.ADDITIONAL_GUEST_MEMORY_OVERHEAD_RATIO]: { kind: 'string', from: 'import' },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -9,9 +9,7 @@ import ArrayListGrouped from '@shell/components/form/ArrayListGrouped';
|
|||||||
import ButtonDropdown from '@shell/components/ButtonDropdown';
|
import ButtonDropdown from '@shell/components/ButtonDropdown';
|
||||||
import CreateEditView from '@shell/mixins/create-edit-view';
|
import CreateEditView from '@shell/mixins/create-edit-view';
|
||||||
import { HCI as HCI_LABELS_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
import { HCI as HCI_LABELS_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
||||||
import {
|
import { LONGHORN, SECRET, LONGHORN_DRIVER, LONGHORN_VERSION_V1 } from '@shell/config/types';
|
||||||
LONGHORN, SECRET, LONGHORN_DRIVER, LONGHORN_VERSION_V1, LONGHORN_VERSION_V2
|
|
||||||
} from '@shell/config/types';
|
|
||||||
import { allHash } from '@shell/utils/promise';
|
import { allHash } from '@shell/utils/promise';
|
||||||
import { formatSi } from '@shell/utils/units';
|
import { formatSi } from '@shell/utils/units';
|
||||||
import { findBy } from '@shell/utils/array';
|
import { findBy } from '@shell/utils/array';
|
||||||
@ -75,10 +73,13 @@ export default {
|
|||||||
longhornNodes: this.$store.dispatch(`${ inStore }/findAll`, { type: LONGHORN.NODES }),
|
longhornNodes: this.$store.dispatch(`${ inStore }/findAll`, { type: LONGHORN.NODES }),
|
||||||
blockDevices: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.BLOCK_DEVICE }),
|
blockDevices: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.BLOCK_DEVICE }),
|
||||||
addons: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.ADD_ONS }),
|
addons: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.ADD_ONS }),
|
||||||
secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET }),
|
secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET })
|
||||||
longhornV2DataEngine: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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)) {
|
if (this.$store.getters[`${ inStore }/schemaFor`](HCI.INVENTORY)) {
|
||||||
hash.inventories = this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.INVENTORY });
|
hash.inventories = this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.INVENTORY });
|
||||||
}
|
}
|
||||||
@ -161,6 +162,10 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapGetters({ t: 'i18n/t' }),
|
...mapGetters({ t: 'i18n/t' }),
|
||||||
|
|
||||||
|
longhornV2LVMSupport() {
|
||||||
|
return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport');
|
||||||
|
},
|
||||||
|
|
||||||
removedDisks() {
|
removedDisks() {
|
||||||
const out = this.disks.filter((d) => {
|
const out = this.disks.filter((d) => {
|
||||||
return !findBy(this.newDisks, 'name', d.name);
|
return !findBy(this.newDisks, 'name', d.name);
|
||||||
@ -169,13 +174,6 @@ export default {
|
|||||||
return out;
|
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() {
|
longhornDisks() {
|
||||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||||
const longhornNode = this.$store.getters[`${ inStore }/byId`](LONGHORN.NODES, `${ LONGHORN_SYSTEM }/${ this.value.id }`);
|
const longhornNode = this.$store.getters[`${ inStore }/byId`](LONGHORN.NODES, `${ LONGHORN_SYSTEM }/${ this.value.id }`);
|
||||||
|
|||||||
@ -124,14 +124,19 @@ export default {
|
|||||||
async fetch() {
|
async fetch() {
|
||||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||||
|
|
||||||
await allHash({
|
const hash = {
|
||||||
namespaces: this.$store.dispatch(`${ inStore }/findAll`, { type: NAMESPACE }),
|
namespaces: this.$store.dispatch(`${ inStore }/findAll`, { type: NAMESPACE }),
|
||||||
secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET }),
|
secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET }),
|
||||||
storages: this.$store.dispatch(`${ inStore }/findAll`, { type: STORAGE_CLASS }),
|
storages: this.$store.dispatch(`${ inStore }/findAll`, { type: STORAGE_CLASS }),
|
||||||
longhornNodes: this.$store.dispatch(`${ inStore }/findAll`, { type: LONGHORN.NODES }),
|
longhornNodes: this.$store.dispatch(`${ inStore }/findAll`, { type: LONGHORN.NODES }),
|
||||||
csiDrivers: this.$store.dispatch(`${ inStore }/findAll`, { type: CSI_DRIVER }),
|
csiDrivers: this.$store.dispatch(`${ inStore }/findAll`, { type: CSI_DRIVER })
|
||||||
longhornV2DataEngine: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }),
|
};
|
||||||
});
|
|
||||||
|
if (this.longhornV2LVMSupport) {
|
||||||
|
hash.longhornV2DataEngine = this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE });
|
||||||
|
}
|
||||||
|
|
||||||
|
await allHash(hash);
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
@ -145,6 +150,10 @@ export default {
|
|||||||
return this.isCreate ? _CREATE : _VIEW;
|
return this.isCreate ? _CREATE : _VIEW;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
longhornV2LVMSupport() {
|
||||||
|
return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport');
|
||||||
|
},
|
||||||
|
|
||||||
provisioners() {
|
provisioners() {
|
||||||
const out = [];
|
const out = [];
|
||||||
|
|
||||||
|
|||||||
@ -106,6 +106,10 @@ export default {
|
|||||||
return this.source === 'url';
|
return this.source === 'url';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
longhornV2LVMSupport() {
|
||||||
|
return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport');
|
||||||
|
},
|
||||||
|
|
||||||
sourceOption() {
|
sourceOption() {
|
||||||
return [{
|
return [{
|
||||||
value: 'blank',
|
value: 'blank',
|
||||||
@ -233,6 +237,10 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getAccessMode() {
|
getAccessMode() {
|
||||||
|
if (!this.longhornV2LVMSupport) {
|
||||||
|
return ['ReadWriteMany'];
|
||||||
|
}
|
||||||
|
|
||||||
const storageClassName = this.value.spec.storageClassName;
|
const storageClassName = this.value.spec.storageClassName;
|
||||||
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
|
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
|
||||||
|
|
||||||
|
|||||||
@ -65,6 +65,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
longhornV2LVMSupport() {
|
||||||
|
return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport');
|
||||||
|
},
|
||||||
|
|
||||||
encryptionValue() {
|
encryptionValue() {
|
||||||
return ucFirst(String(this.value.isEncrypted));
|
return ucFirst(String(this.value.isEncrypted));
|
||||||
},
|
},
|
||||||
@ -146,6 +150,10 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getAccessMode(storageClassName) {
|
getAccessMode(storageClassName) {
|
||||||
|
if (!this.longhornV2LVMSupport) {
|
||||||
|
return 'ReadWriteMany';
|
||||||
|
}
|
||||||
|
|
||||||
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
|
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
|
||||||
|
|
||||||
let readWriteOnce = this.value.pvc?.isLvm || this.value.pvc?.isLonghornV2;
|
let readWriteOnce = this.value.pvc?.isLvm || this.value.pvc?.isLonghornV2;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user