mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-06-13 13:32:20 +00:00
feat: add volume expansion checkbox in storage class configuration (#911)
* feat: add support for volume expansion in storage configuration Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: update volume expansion wording Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: hide checkbox if feature flag is not enabled Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: revert unneeded change Signed-off-by: Andy Lee <andy.lee@suse.com> --------- Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
parent
ce2adbdc3b
commit
55918232a6
@ -72,6 +72,7 @@ const FEATURE_FLAGS = {
|
|||||||
'v1.9.0': [
|
'v1.9.0': [
|
||||||
'supportFilesystem',
|
'supportFilesystem',
|
||||||
'disableResourcePooling',
|
'disableResourcePooling',
|
||||||
|
'expandOnlineEncryptedVolume'
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -88,6 +88,8 @@ export const CSI_SECRETS = {
|
|||||||
CSI_NODE_PUBLISH_SECRET_NAMESPACE: 'csi.storage.k8s.io/node-publish-secret-namespace',
|
CSI_NODE_PUBLISH_SECRET_NAMESPACE: 'csi.storage.k8s.io/node-publish-secret-namespace',
|
||||||
CSI_NODE_STAGE_SECRET_NAME: 'csi.storage.k8s.io/node-stage-secret-name',
|
CSI_NODE_STAGE_SECRET_NAME: 'csi.storage.k8s.io/node-stage-secret-name',
|
||||||
CSI_NODE_STAGE_SECRET_NAMESPACE: 'csi.storage.k8s.io/node-stage-secret-namespace',
|
CSI_NODE_STAGE_SECRET_NAMESPACE: 'csi.storage.k8s.io/node-stage-secret-namespace',
|
||||||
|
CSI_NODE_EXPAND_SECRET_NAME: 'csi.storage.k8s.io/node-expand-secret-name',
|
||||||
|
CSI_NODE_EXPAND_SECRET_NAMESPACE: 'csi.storage.k8s.io/node-expand-secret-namespace'
|
||||||
};
|
};
|
||||||
|
|
||||||
// Some harvester CRD type is not equal to model file name, define the mapping here
|
// Some harvester CRD type is not equal to model file name, define the mapping here
|
||||||
|
|||||||
@ -3,8 +3,9 @@ import KeyValue from '@shell/components/form/KeyValue';
|
|||||||
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
||||||
import { LabeledInput } from '@components/Form/LabeledInput';
|
import { LabeledInput } from '@components/Form/LabeledInput';
|
||||||
import RadioGroup from '@components/Form/Radio/RadioGroup';
|
import RadioGroup from '@components/Form/Radio/RadioGroup';
|
||||||
|
import Checkbox from '@components/Form/Checkbox/Checkbox';
|
||||||
import { SECRET, LONGHORN } from '@shell/config/types';
|
import { SECRET, LONGHORN } from '@shell/config/types';
|
||||||
import { _CREATE, _VIEW } from '@shell/config/query-params';
|
import { _CREATE, _VIEW, _EDIT } from '@shell/config/query-params';
|
||||||
import { CSI_SECRETS } from '@pkg/harvester/config/harvester-map';
|
import { CSI_SECRETS } from '@pkg/harvester/config/harvester-map';
|
||||||
import { clone } from '@shell/utils/object';
|
import { clone } from '@shell/utils/object';
|
||||||
import { uniq } from '@shell/utils/array';
|
import { uniq } from '@shell/utils/array';
|
||||||
@ -16,7 +17,9 @@ const {
|
|||||||
CSI_NODE_PUBLISH_SECRET_NAME,
|
CSI_NODE_PUBLISH_SECRET_NAME,
|
||||||
CSI_NODE_PUBLISH_SECRET_NAMESPACE,
|
CSI_NODE_PUBLISH_SECRET_NAMESPACE,
|
||||||
CSI_NODE_STAGE_SECRET_NAME,
|
CSI_NODE_STAGE_SECRET_NAME,
|
||||||
CSI_NODE_STAGE_SECRET_NAMESPACE
|
CSI_NODE_STAGE_SECRET_NAMESPACE,
|
||||||
|
CSI_NODE_EXPAND_SECRET_NAME,
|
||||||
|
CSI_NODE_EXPAND_SECRET_NAMESPACE
|
||||||
} = CSI_SECRETS;
|
} = CSI_SECRETS;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -27,6 +30,7 @@ export default {
|
|||||||
LabeledSelect,
|
LabeledSelect,
|
||||||
LabeledInput,
|
LabeledInput,
|
||||||
RadioGroup,
|
RadioGroup,
|
||||||
|
Checkbox,
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@ -57,7 +61,10 @@ export default {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return { };
|
const hasExpandSecret = !!(this.value.parameters?.[CSI_NODE_EXPAND_SECRET_NAME] && this.value.parameters?.[CSI_NODE_EXPAND_SECRET_NAMESPACE]);
|
||||||
|
const volumeExpansionCheckBoxEnabled = this.realMode === _CREATE ? true : hasExpandSecret;
|
||||||
|
|
||||||
|
return { volumeExpansionCheckBoxEnabled };
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
@ -98,8 +105,11 @@ export default {
|
|||||||
}, []);
|
}, []);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isEdit() {
|
||||||
|
return this.realMode === _EDIT;
|
||||||
|
},
|
||||||
isView() {
|
isView() {
|
||||||
return this.mode === _VIEW;
|
return this.realMode === _VIEW;
|
||||||
},
|
},
|
||||||
|
|
||||||
migratableOptions() {
|
migratableOptions() {
|
||||||
@ -152,6 +162,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
enableOnlineExpansionVolumeEncryption() {
|
||||||
|
return this.value.expandOnlineEncryptedVolumeFeatureEnabled;
|
||||||
|
},
|
||||||
|
|
||||||
volumeEncryption: {
|
volumeEncryption: {
|
||||||
set(neu) {
|
set(neu) {
|
||||||
this.value['parameters'] = {
|
this.value['parameters'] = {
|
||||||
@ -180,6 +194,11 @@ export default {
|
|||||||
set(selectedSecret) {
|
set(selectedSecret) {
|
||||||
const [namespace, name] = selectedSecret.split('/');
|
const [namespace, name] = selectedSecret.split('/');
|
||||||
|
|
||||||
|
const expandSecretParams = (this.enableOnlineExpansionVolumeEncryption && this.volumeExpansionCheckBoxEnabled) ? {
|
||||||
|
[CSI_NODE_EXPAND_SECRET_NAME]: name,
|
||||||
|
[CSI_NODE_EXPAND_SECRET_NAMESPACE]: namespace,
|
||||||
|
} : {};
|
||||||
|
|
||||||
this.value['parameters'] = {
|
this.value['parameters'] = {
|
||||||
...this.value.parameters,
|
...this.value.parameters,
|
||||||
[CSI_PROVISIONER_SECRET_NAME]: name,
|
[CSI_PROVISIONER_SECRET_NAME]: name,
|
||||||
@ -187,7 +206,8 @@ export default {
|
|||||||
[CSI_NODE_STAGE_SECRET_NAME]: name,
|
[CSI_NODE_STAGE_SECRET_NAME]: name,
|
||||||
[CSI_PROVISIONER_SECRET_NAMESPACE]: namespace,
|
[CSI_PROVISIONER_SECRET_NAMESPACE]: namespace,
|
||||||
[CSI_NODE_PUBLISH_SECRET_NAMESPACE]: namespace,
|
[CSI_NODE_PUBLISH_SECRET_NAMESPACE]: namespace,
|
||||||
[CSI_NODE_STAGE_SECRET_NAMESPACE]: namespace
|
[CSI_NODE_STAGE_SECRET_NAMESPACE]: namespace,
|
||||||
|
...expandSecretParams,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -240,6 +260,32 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
volumeExpansionCheckBoxEnabled(enabled) {
|
||||||
|
const currentSecret = this.secret;
|
||||||
|
|
||||||
|
if (!currentSecret) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [namespace, name] = currentSecret.split('/');
|
||||||
|
|
||||||
|
if (enabled && this.enableOnlineExpansionVolumeEncryption) {
|
||||||
|
this.value['parameters'] = {
|
||||||
|
...this.value.parameters,
|
||||||
|
[CSI_NODE_EXPAND_SECRET_NAME]: name,
|
||||||
|
[CSI_NODE_EXPAND_SECRET_NAMESPACE]: namespace,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
const params = { ...this.value.parameters };
|
||||||
|
|
||||||
|
delete params[CSI_NODE_EXPAND_SECRET_NAME];
|
||||||
|
delete params[CSI_NODE_EXPAND_SECRET_NAMESPACE];
|
||||||
|
this.value['parameters'] = params;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
@ -337,6 +383,16 @@ export default {
|
|||||||
:mode="mode"
|
:mode="mode"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="enableOnlineExpansionVolumeEncryption"
|
||||||
|
class="col span-6 flex items-center mt-20"
|
||||||
|
>
|
||||||
|
<Checkbox
|
||||||
|
v-model:value="volumeExpansionCheckBoxEnabled"
|
||||||
|
:label="t('harvester.storage.volumeExpansionCheckbox')"
|
||||||
|
:disabled="isEdit || isView"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<KeyValue
|
<KeyValue
|
||||||
|
|||||||
@ -1534,6 +1534,7 @@ harvester:
|
|||||||
useDefault: Use the default storage
|
useDefault: Use the default storage
|
||||||
volumeEncryption: Volume Encryption
|
volumeEncryption: Volume Encryption
|
||||||
secret: Secret
|
secret: Secret
|
||||||
|
volumeExpansionCheckbox: Enable Expansion
|
||||||
migratable:
|
migratable:
|
||||||
label: Migratable
|
label: Migratable
|
||||||
numberOfReplicas:
|
numberOfReplicas:
|
||||||
|
|||||||
@ -96,6 +96,10 @@ export default class HciStorageClass extends StorageClass {
|
|||||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption');
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get expandOnlineEncryptedVolumeFeatureEnabled() {
|
||||||
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('expandOnlineEncryptedVolume');
|
||||||
|
}
|
||||||
|
|
||||||
get thirdPartyStorageFeatureEnabled() {
|
get thirdPartyStorageFeatureEnabled() {
|
||||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user