mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
Latest changes from Harvester master - e6796a6fc0cffe03f47f6081c09469d59b97faf9
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
@@ -13,21 +13,18 @@ import Loading from '@shell/components/Loading';
|
||||
|
||||
import { _CREATE, _VIEW } from '@shell/config/query-params';
|
||||
import { mapFeature, UNSUPPORTED_STORAGE_DRIVERS } from '@shell/store/features';
|
||||
import {
|
||||
STORAGE_CLASS, LONGHORN, LONGHORN_DRIVER, SECRET, NAMESPACE
|
||||
import {
|
||||
STORAGE_CLASS, LONGHORN, LONGHORN_DRIVER, SECRET, NAMESPACE
|
||||
} from '@shell/config/types';
|
||||
import { allHash } from '@shell/utils/promise';
|
||||
import { clone } from '@shell/utils/object';
|
||||
import { CSI_DRIVER } from '../../types';
|
||||
import Tags from '../../components/DiskTags';
|
||||
|
||||
import { DATA_ENGINE_V1, DATA_ENGINE_V2 } from '../../models/harvester/persistentvolumeclaim';
|
||||
import { LVM_DRIVER } from '../../models/harvester/storage.k8s.io.storageclass';
|
||||
|
||||
const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';
|
||||
|
||||
export const DATA_ENGINE_V1 = 'v1';
|
||||
export const DATA_ENGINE_V2 = 'v2';
|
||||
|
||||
export const LVM_TOPOLOGY_LABEL = 'topology.lvm.csi/node';
|
||||
|
||||
const VOLUME_BINDING_MODE_IMMEDIATE = 'Immediate';
|
||||
@@ -304,10 +301,10 @@ export default {
|
||||
class="mb-20"
|
||||
/>
|
||||
<Tabbed :side-tabs="true">
|
||||
<Tab
|
||||
name="parameters"
|
||||
:label="t('storageClass.parameters.label')"
|
||||
:weight="2"
|
||||
<Tab
|
||||
name="parameters"
|
||||
:label="t('storageClass.parameters.label')"
|
||||
:weight="2"
|
||||
>
|
||||
<component
|
||||
:is="getComponent(provisioner)"
|
||||
@@ -317,9 +314,9 @@ export default {
|
||||
:real-mode="realMode"
|
||||
/>
|
||||
</Tab>
|
||||
<Tab
|
||||
name="customize"
|
||||
:label="t('storageClass.customize.label')"
|
||||
<Tab
|
||||
name="customize"
|
||||
:label="t('storageClass.customize.label')"
|
||||
>
|
||||
<div class="row mt-20">
|
||||
<div class="col span-6">
|
||||
|
||||
@@ -8,7 +8,7 @@ import { _CREATE, _VIEW } from '@shell/config/query-params';
|
||||
import { CSI_SECRETS } from '@pkg/harvester/config/harvester-map';
|
||||
import { clone } from '@shell/utils/object';
|
||||
import { uniq } from '@shell/utils/array';
|
||||
import { DATA_ENGINE_V1 } from '../index.vue';
|
||||
import { DATA_ENGINE_V1 } from '../../../models/harvester/persistentvolumeclaim';
|
||||
|
||||
// UI components for Longhorn storage class parameters
|
||||
const DEFAULT_PARAMETERS = [
|
||||
@@ -282,9 +282,9 @@ export default {
|
||||
:mode="mode"
|
||||
>
|
||||
<template #no-options="{ searching }">
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
>
|
||||
{{ t('harvester.storage.parameters.nodeSelector.no-options', null, true) }}
|
||||
</span>
|
||||
@@ -301,9 +301,9 @@ export default {
|
||||
:mode="mode"
|
||||
>
|
||||
<template #no-options="{ searching }">
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
>
|
||||
{{ t('harvester.storage.parameters.diskSelector.no-options', null, true) }}
|
||||
</span>
|
||||
@@ -329,9 +329,9 @@ export default {
|
||||
:options="volumeEncryptionOptions"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="value.parameters.encrypted === 'true'"
|
||||
class="row mt-20"
|
||||
<div
|
||||
v-if="value.parameters.encrypted === 'true'"
|
||||
class="row mt-20"
|
||||
>
|
||||
<div class="col span-6">
|
||||
<LabeledSelect
|
||||
|
||||
@@ -8,7 +8,7 @@ import { _CREATE, _VIEW } from '@shell/config/query-params';
|
||||
import { CSI_SECRETS } from '@pkg/harvester/config/harvester-map';
|
||||
import { clone } from '@shell/utils/object';
|
||||
import { uniq } from '@shell/utils/array';
|
||||
import { DATA_ENGINE_V2 } from '../index.vue';
|
||||
import { DATA_ENGINE_V2 } from '../../../models/harvester/persistentvolumeclaim';
|
||||
|
||||
// UI components for Longhorn storage class parameters
|
||||
const DEFAULT_PARAMETERS = [
|
||||
@@ -282,9 +282,9 @@ export default {
|
||||
:mode="mode"
|
||||
>
|
||||
<template #no-options="{ searching }">
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
>
|
||||
{{ t('harvester.storage.parameters.nodeSelector.no-options', null, true) }}
|
||||
</span>
|
||||
@@ -301,9 +301,9 @@ export default {
|
||||
:mode="mode"
|
||||
>
|
||||
<template #no-options="{ searching }">
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
>
|
||||
{{ t('harvester.storage.parameters.diskSelector.no-options', null, true) }}
|
||||
</span>
|
||||
@@ -331,9 +331,9 @@ export default {
|
||||
:disabled="true"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="value.parameters.encrypted === 'true'"
|
||||
class="row mt-20"
|
||||
<div
|
||||
v-if="value.parameters.encrypted === 'true'"
|
||||
class="row mt-20"
|
||||
>
|
||||
<div class="col span-6">
|
||||
<LabeledSelect
|
||||
|
||||
@@ -20,7 +20,7 @@ import { STATE, NAME, AGE, NAMESPACE } from '@shell/config/table-headers';
|
||||
import { InterfaceOption, VOLUME_DATA_SOURCE_KIND } from '../config/harvester-map';
|
||||
import { HCI, VOLUME_SNAPSHOT } from '../types';
|
||||
import { LVM_DRIVER } from '../models/harvester/storage.k8s.io.storageclass';
|
||||
import { DATA_ENGINE_V2 } from './harvesterhci.io.storage/index.vue';
|
||||
import { DATA_ENGINE_V2 } from '../models/harvester/persistentvolumeclaim';
|
||||
|
||||
export default {
|
||||
name: 'HarvesterVolume',
|
||||
@@ -228,14 +228,22 @@ export default {
|
||||
|
||||
rebuildStatus() {
|
||||
return this.value.longhornEngine?.status?.rebuildStatus;
|
||||
},
|
||||
|
||||
isLonghornV2() {
|
||||
return this.value.storageClass?.isLonghornV2;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getAccessMode() {
|
||||
const storageClassName = this.value.spec.storageClassName;
|
||||
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
|
||||
|
||||
let readWriteOnce = this.value.isLvm || this.value.isLonghornV2;
|
||||
|
||||
if (storageClass) {
|
||||
readWriteOnce = storageClass.provisioner === LVM_DRIVER || storageClass.parameters?.dataEngine === DATA_ENGINE_V2;
|
||||
}
|
||||
|
||||
return readWriteOnce ? ['ReadWriteOnce'] : ['ReadWriteMany'];
|
||||
},
|
||||
willSave() {
|
||||
this.update();
|
||||
},
|
||||
@@ -243,10 +251,6 @@ export default {
|
||||
let imageAnnotations = '';
|
||||
let storageClassName = this.value.spec.storageClassName;
|
||||
|
||||
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
|
||||
const storageClassProvisioner = storageClass?.provisioner;
|
||||
const storageClassDataEngine = storageClass?.parameters?.dataEngine;
|
||||
|
||||
if (this.isVMImage && this.imageId) {
|
||||
const images = this.$store.getters['harvester/all'](HCI.IMAGE);
|
||||
|
||||
@@ -263,7 +267,7 @@ export default {
|
||||
...this.value.spec,
|
||||
resources: { requests: { storage: this.storage } },
|
||||
storageClassName,
|
||||
accessModes: storageClassProvisioner === LVM_DRIVER || storageClassDataEngine === DATA_ENGINE_V2 ? ['ReadWriteOnce'] : ['ReadWriteMany'],
|
||||
accessModes: this.getAccessMode(),
|
||||
};
|
||||
|
||||
this.value.setAnnotations(imageAnnotations);
|
||||
@@ -362,14 +366,14 @@ export default {
|
||||
:output-modifier="true"
|
||||
:increment="1024"
|
||||
:mode="mode"
|
||||
:disabled="isLonghornV2 && isEdit"
|
||||
:disabled="value?.isLonghornV2 && isEdit"
|
||||
required
|
||||
class="mb-20"
|
||||
@update:value="update"
|
||||
/>
|
||||
|
||||
<Banner
|
||||
v-if="isLonghornV2 && isEdit"
|
||||
v-if="value?.isLonghornV2 && isEdit"
|
||||
color="warning"
|
||||
>
|
||||
<span>{{ t('harvester.volume.longhorn.disableResize') }}</span>
|
||||
|
||||
@@ -259,7 +259,7 @@ export default {
|
||||
},
|
||||
|
||||
isLonghornV2(volume) {
|
||||
return volume?.pvc?.storageClass?.isLonghornV2;
|
||||
return volume?.pvc?.isLonghornV2 || volume?.pvc?.storageClass?.isLonghornV2;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -117,7 +117,7 @@ export default {
|
||||
},
|
||||
|
||||
isLonghornV2() {
|
||||
return this.value.pvc?.storageClass?.isLonghornV2;
|
||||
return this.value.pvc?.isLonghornV2 || this.value.pvc?.storageClass?.isLonghornV2;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { _VIEW } from '@shell/config/query-params';
|
||||
import LabelValue from '@shell/components/LabelValue';
|
||||
import { ucFirst } from '@shell/utils/string';
|
||||
import { LVM_DRIVER } from '../../../../models/harvester/storage.k8s.io.storageclass';
|
||||
import { DATA_ENGINE_V2 } from '../../../../edit/harvesterhci.io.storage/index.vue';
|
||||
import { DATA_ENGINE_V2 } from '../../../../models/harvester/persistentvolumeclaim';
|
||||
|
||||
export default {
|
||||
name: 'HarvesterEditVolume',
|
||||
@@ -105,7 +105,7 @@ export default {
|
||||
},
|
||||
|
||||
isLonghornV2() {
|
||||
return this.value.pvc?.storageClass?.isLonghornV2;
|
||||
return this.value.pvc?.isLonghornV2 || this.value.pvc?.storageClass?.isLonghornV2;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -113,11 +113,7 @@ export default {
|
||||
'value.storageClassName': {
|
||||
immediate: true,
|
||||
handler(neu) {
|
||||
const storageClass = this.storageClasses.find((sc) => sc.name === neu);
|
||||
const provisioner = storageClass?.provisioner;
|
||||
const engine = storageClass?.parameters?.dataEngine;
|
||||
|
||||
this.value.accessMode = provisioner === LVM_DRIVER || engine === DATA_ENGINE_V2 ? 'ReadWriteOnce' : 'ReadWriteMany';
|
||||
this.value.accessMode = this.getAccessMode(neu);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -149,6 +145,18 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
getAccessMode(storageClassName) {
|
||||
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
|
||||
|
||||
let readWriteOnce = this.value.pvc?.isLvm || this.value.pvc?.isLonghornV2;
|
||||
|
||||
if (storageClass) {
|
||||
readWriteOnce = storageClass.provisioner === LVM_DRIVER || storageClass.parameters?.dataEngine === DATA_ENGINE_V2;
|
||||
}
|
||||
|
||||
return readWriteOnce ? 'ReadWriteOnce' : 'ReadWriteMany';
|
||||
},
|
||||
|
||||
update() {
|
||||
this.$emit('update');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user