mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-06 22:26:05 +08:00
Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55918232a6 | ||
|
|
ce2adbdc3b | ||
|
|
ae65037083 | ||
|
|
b4ea7c8f98 | ||
|
|
836b04f222 | ||
|
|
0908c7fc6b | ||
|
|
b34d618c7c | ||
|
|
8945b9f158 | ||
|
|
c5af2b576b | ||
|
|
45872cef3b | ||
|
|
3e5ee422ce | ||
|
|
75202a9e55 | ||
|
|
5f5ce291fb | ||
|
|
a27e38fc81 | ||
|
|
89e1484884 | ||
|
|
eacca055c7 | ||
|
|
56c1738055 | ||
|
|
8f4b335cae |
@@ -33,7 +33,7 @@ module.exports = {
|
|||||||
'subject-full-stop': [2, 'never', '.'],
|
'subject-full-stop': [2, 'never', '.'],
|
||||||
'subject-max-length': [0, 'never'],
|
'subject-max-length': [0, 'never'],
|
||||||
'body-leading-blank': [2, 'always'],
|
'body-leading-blank': [2, 'always'],
|
||||||
'body-max-line-length': [2, 'always', 100],
|
'body-max-line-length': [0, 'always', 100],
|
||||||
'footer-leading-blank': [2, 'always'],
|
'footer-leading-blank': [2, 'always'],
|
||||||
'footer-max-line-length': [2, 'always', 100],
|
'footer-max-line-length': [2, 'always', 100],
|
||||||
},
|
},
|
||||||
|
|||||||
+5
-5
@@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/plugin-transform-class-static-block": "7.28.6",
|
"@babel/plugin-transform-class-static-block": "7.28.6",
|
||||||
"@rancher/shell": "3.0.12-rc.1",
|
"@rancher/shell": "3.0.12-rc.3",
|
||||||
"@vue-flow/background": "^1.3.0",
|
"@vue-flow/background": "^1.3.0",
|
||||||
"@vue-flow/controls": "^1.1.1",
|
"@vue-flow/controls": "^1.1.1",
|
||||||
"@vue-flow/core": "^1.33.5",
|
"@vue-flow/core": "^1.33.5",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
"yaml": "^2.5.1"
|
"yaml": "^2.5.1"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@types/node": "25.6.2",
|
"@types/node": "25.9.1",
|
||||||
"cronstrue": "2.59.0",
|
"cronstrue": "2.59.0",
|
||||||
"d3-color": "3.1.0",
|
"d3-color": "3.1.0",
|
||||||
"ejs": "3.1.10",
|
"ejs": "3.1.10",
|
||||||
@@ -33,9 +33,9 @@
|
|||||||
"merge": "2.1.1",
|
"merge": "2.1.1",
|
||||||
"node-forge": "1.4.0",
|
"node-forge": "1.4.0",
|
||||||
"nth-check": "2.1.1",
|
"nth-check": "2.1.1",
|
||||||
"qs": "6.15.1",
|
"qs": "6.15.2",
|
||||||
"roarr": "7.21.4",
|
"roarr": "7.21.5",
|
||||||
"semver": "7.8.0",
|
"semver": "7.8.1",
|
||||||
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
|
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -58,11 +58,14 @@ export default {
|
|||||||
|
|
||||||
const url = `https://${ host }${ prefix }/${ PRODUCT_NAME }/c/${ params.cluster }/console/${ uid }/${ type }`;
|
const url = `https://${ host }${ prefix }/${ PRODUCT_NAME }/c/${ params.cluster }/console/${ uid }/${ type }`;
|
||||||
|
|
||||||
window.open(
|
// Defer so v-select can finish closing the dropdown before the popup steals focus
|
||||||
url,
|
this.$nextTick(() => {
|
||||||
'_blank',
|
window.open(
|
||||||
`toolbars=0,width=${ screen.width - 200 },height=${ screen.height - 200 },left=0,top=0,noreferrer`
|
url,
|
||||||
);
|
'_blank',
|
||||||
|
`toolbars=0,width=${ screen.width - 200 },height=${ screen.height - 200 },left=0,top=0,noreferrer`
|
||||||
|
);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
isEmpty(o) {
|
isEmpty(o) {
|
||||||
|
|||||||
@@ -66,10 +66,14 @@ const FEATURE_FLAGS = {
|
|||||||
'instanceManagerResourcesSetting',
|
'instanceManagerResourcesSetting',
|
||||||
'rwxNetworkSetting',
|
'rwxNetworkSetting',
|
||||||
'createPVCWithDataVolume',
|
'createPVCWithDataVolume',
|
||||||
'clusterPodSecurityStandardSetting'
|
'clusterPodSecurityStandardSetting',
|
||||||
],
|
],
|
||||||
'v1.8.1': [],
|
'v1.8.1': [],
|
||||||
'v1.9.0': [],
|
'v1.9.0': [
|
||||||
|
'supportFilesystem',
|
||||||
|
'disableResourcePooling',
|
||||||
|
'expandOnlineEncryptedVolume'
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateFeatureFlags = () => {
|
const generateFeatureFlags = () => {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export const HCI = {
|
|||||||
NETWORK_TYPE: 'network.harvesterhci.io/type',
|
NETWORK_TYPE: 'network.harvesterhci.io/type',
|
||||||
VM_NAME: 'harvesterhci.io/vmName',
|
VM_NAME: 'harvesterhci.io/vmName',
|
||||||
VM_NAME_PREFIX: 'harvesterhci.io/vmNamePrefix',
|
VM_NAME_PREFIX: 'harvesterhci.io/vmNamePrefix',
|
||||||
|
VM_DISPLAY_NAME: 'harvesterhci.io/vmDisplayName',
|
||||||
VM_RESERVED_MEMORY: 'harvesterhci.io/reservedMemory',
|
VM_RESERVED_MEMORY: 'harvesterhci.io/reservedMemory',
|
||||||
MAINTENANCE_STATUS: 'harvesterhci.io/maintain-status',
|
MAINTENANCE_STATUS: 'harvesterhci.io/maintain-status',
|
||||||
HOST_CUSTOM_NAME: 'harvesterhci.io/host-custom-name',
|
HOST_CUSTOM_NAME: 'harvesterhci.io/host-custom-name',
|
||||||
|
|||||||
@@ -46,3 +46,9 @@ export const CDI_POPULATOR_KIND = {
|
|||||||
VOLUME_IMPORT_SOURCE: 'VolumeImportSource',
|
VOLUME_IMPORT_SOURCE: 'VolumeImportSource',
|
||||||
VOLUME_CLONE_SOURCE: 'VolumeCloneSource',
|
VOLUME_CLONE_SOURCE: 'VolumeCloneSource',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const FILESYSTEM_SOURCE_TYPE = {
|
||||||
|
CONFIGMAP: 'configmap',
|
||||||
|
SECRET: 'secret',
|
||||||
|
SERVICEACCOUNT: 'serviceaccount',
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
import { Banner } from '@components/Banner';
|
||||||
import { Card } from '@components/Card';
|
import { Card } from '@components/Card';
|
||||||
|
import { Checkbox } from '@components/Form/Checkbox';
|
||||||
import AsyncButton from '@shell/components/AsyncButton';
|
import AsyncButton from '@shell/components/AsyncButton';
|
||||||
import { escapeHtml } from '@shell/utils/string';
|
import { escapeHtml } from '@shell/utils/string';
|
||||||
import { HCI } from '../types';
|
import { HCI } from '../types';
|
||||||
@@ -13,7 +15,9 @@ export default {
|
|||||||
|
|
||||||
components: {
|
components: {
|
||||||
AsyncButton,
|
AsyncButton,
|
||||||
|
Banner,
|
||||||
Card,
|
Card,
|
||||||
|
Checkbox,
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@@ -24,10 +28,16 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return { disableResourcePooling: false };
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: { ...mapGetters({ t: 'i18n/t' }) },
|
computed: {
|
||||||
|
...mapGetters({ t: 'i18n/t' }),
|
||||||
|
|
||||||
|
disableResourcePoolingEnabled() {
|
||||||
|
return this.$store.getters['harvester-common/getFeatureEnabled']('disableResourcePooling');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
close() {
|
close() {
|
||||||
@@ -52,9 +62,10 @@ export default {
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
spec: {
|
spec: {
|
||||||
address: actionResource.status.address,
|
address: actionResource.status.address,
|
||||||
nodeName: actionResource.status.nodeName,
|
nodeName: actionResource.status.nodeName,
|
||||||
userName
|
userName,
|
||||||
|
disableResourcePooling: this.disableResourcePooling,
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@@ -85,7 +96,19 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #body>
|
<template #body>
|
||||||
{{ t('harvester.pci.enablePassthroughWarning') }}
|
<p class="mb-20">
|
||||||
|
{{ t('harvester.pci.enablePassthroughWarning') }}
|
||||||
|
</p>
|
||||||
|
<template v-if="disableResourcePoolingEnabled">
|
||||||
|
<Checkbox
|
||||||
|
v-model:value="disableResourcePooling"
|
||||||
|
label-key="harvester.pci.disableResourcePooling"
|
||||||
|
/>
|
||||||
|
<Banner
|
||||||
|
color="info"
|
||||||
|
:label="t('harvester.pci.disableResourcePoolingDescription')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #actions>
|
<template #actions>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import CpuMemory from './kubevirt.io.virtualmachine/VirtualMachineCpuMemory';
|
|||||||
import CpuModel from './kubevirt.io.virtualmachine/VirtualMachineCpuModel';
|
import CpuModel from './kubevirt.io.virtualmachine/VirtualMachineCpuModel';
|
||||||
import CloudConfig from './kubevirt.io.virtualmachine/VirtualMachineCloudConfig';
|
import CloudConfig from './kubevirt.io.virtualmachine/VirtualMachineCloudConfig';
|
||||||
import SSHKey from './kubevirt.io.virtualmachine/VirtualMachineSSHKey';
|
import SSHKey from './kubevirt.io.virtualmachine/VirtualMachineSSHKey';
|
||||||
|
import Filesystem from './kubevirt.io.virtualmachine/VirtualMachineFilesystem';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HarvesterEditVMTemplate',
|
name: 'HarvesterEditVMTemplate',
|
||||||
@@ -51,6 +52,7 @@ export default {
|
|||||||
UnitInput,
|
UnitInput,
|
||||||
Banner,
|
Banner,
|
||||||
KeyValue,
|
KeyValue,
|
||||||
|
Filesystem,
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [CreateEditView, VM_MIXIN],
|
mixins: [CreateEditView, VM_MIXIN],
|
||||||
@@ -95,6 +97,10 @@ export default {
|
|||||||
secretNamePrefix() {
|
secretNamePrefix() {
|
||||||
return this.templateValue?.metadata?.name;
|
return this.templateValue?.metadata?.name;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filesystemEnabled() {
|
||||||
|
return this.$store.getters['harvester-common/getFeatureEnabled']('supportFilesystem');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
@@ -154,6 +160,7 @@ export default {
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.imageId = this.diskRows[0]?.image || '';
|
this.imageId = this.diskRows[0]?.image || '';
|
||||||
|
this['filesystemRows'] = this.getFilesystemRows(this.value.spec.vm);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -349,6 +356,19 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
|
<Tab
|
||||||
|
v-if="filesystemEnabled"
|
||||||
|
name="filesystem"
|
||||||
|
:label="t('harvester.tab.filesystem')"
|
||||||
|
:weight="-8"
|
||||||
|
>
|
||||||
|
<Filesystem
|
||||||
|
v-model:value="filesystemRows"
|
||||||
|
:mode="mode"
|
||||||
|
:namespace="templateValue.metadata.namespace"
|
||||||
|
/>
|
||||||
|
</Tab>
|
||||||
|
|
||||||
<Tab
|
<Tab
|
||||||
name="labels"
|
name="labels"
|
||||||
:label="t('generic.labels')"
|
:label="t('generic.labels')"
|
||||||
|
|||||||
@@ -43,18 +43,20 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
const vpc = this.$route.query.vpc || '';
|
const vpc = this.$route.query.vpc || '';
|
||||||
const enableDHCP = this.value?.spec?.enableDHCP || false;
|
const enableDHCP = this.value?.spec?.enableDHCP || false;
|
||||||
|
const natOutgoing = this.value?.spec?.natOutgoing || false;
|
||||||
|
|
||||||
set(this.value.spec, 'enableDHCP', enableDHCP);
|
set(this.value.spec, 'enableDHCP', enableDHCP);
|
||||||
set(this.value, 'spec', this.value.spec || {
|
set(this.value, 'spec', this.value.spec || {
|
||||||
cidrBlock: '',
|
cidrBlock: '',
|
||||||
protocol: NETWORK_PROTOCOL.IPv4,
|
protocol: NETWORK_PROTOCOL.IPv4,
|
||||||
provider: '',
|
provider: '',
|
||||||
vpc,
|
vpc,
|
||||||
gatewayIP: '',
|
gateway: '',
|
||||||
excludeIps: [],
|
excludeIps: [],
|
||||||
private: false,
|
private: false,
|
||||||
enableDHCP,
|
enableDHCP,
|
||||||
acls: []
|
natOutgoing,
|
||||||
|
acls: []
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -129,6 +131,10 @@ export default {
|
|||||||
label: n.id,
|
label: n.id,
|
||||||
value: n.id,
|
value: n.id,
|
||||||
}));
|
}));
|
||||||
|
},
|
||||||
|
natOutgoingDisabled() {
|
||||||
|
// Disable the NAT Outgoing option when the subnet belongs to the ovn-cluster VPC and its name is join or ovn-default.
|
||||||
|
return this.value?.spec?.vpc === 'ovn-cluster' && ['join', 'ovn-default'].includes(this.value?.metadata?.name);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -304,6 +310,20 @@ export default {
|
|||||||
</Banner>
|
</Banner>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mt-20">
|
||||||
|
<div class="col span-6">
|
||||||
|
<RadioGroup
|
||||||
|
v-model:value="value.spec.natOutgoing"
|
||||||
|
name="enableExternalConnectivity"
|
||||||
|
:disabled="natOutgoingDisabled"
|
||||||
|
:options="[true, false]"
|
||||||
|
:label="t('harvester.subnet.externalConnectivity.label')"
|
||||||
|
:labels="[t('generic.enabled'), t('generic.disabled')]"
|
||||||
|
:mode="mode"
|
||||||
|
:tooltip="t('harvester.subnet.externalConnectivity.tooltip')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row mt-20">
|
<div class="row mt-20">
|
||||||
<div class="col span-6">
|
<div class="col span-6">
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
|
|||||||
@@ -0,0 +1,310 @@
|
|||||||
|
<script>
|
||||||
|
import { mapGetters } from 'vuex';
|
||||||
|
import { Banner } from '@components/Banner';
|
||||||
|
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
||||||
|
import { LabeledInput } from '@components/Form/LabeledInput';
|
||||||
|
import { CONFIG_MAP, SECRET, SERVICE_ACCOUNT } from '@shell/config/types';
|
||||||
|
import { _VIEW } from '@shell/config/query-params';
|
||||||
|
import CopyToClipboard from '@shell/components/CopyToClipboard';
|
||||||
|
import MessageLink from '@shell/components/MessageLink';
|
||||||
|
import { FILESYSTEM_SOURCE_TYPE } from '@pkg/harvester/config/types';
|
||||||
|
|
||||||
|
const MAX_FILESYSTEMS = 3;
|
||||||
|
|
||||||
|
const { CONFIGMAP: FS_TYPE_CONFIGMAP, SECRET: FS_TYPE_SECRET, SERVICEACCOUNT: FS_TYPE_SERVICEACCOUNT } = FILESYSTEM_SOURCE_TYPE;
|
||||||
|
|
||||||
|
const DEFAULT_VOLUME_NAMES = {
|
||||||
|
[FS_TYPE_CONFIGMAP]: 'appconfigfs',
|
||||||
|
[FS_TYPE_SECRET]: 'appsecretfs',
|
||||||
|
[FS_TYPE_SERVICEACCOUNT]: 'appserviceaccountfs',
|
||||||
|
};
|
||||||
|
|
||||||
|
const FS_TYPE_OPTIONS = [
|
||||||
|
{ label: 'ConfigMap', value: FS_TYPE_CONFIGMAP },
|
||||||
|
{ label: 'Secret', value: FS_TYPE_SECRET },
|
||||||
|
{ label: 'ServiceAccount', value: FS_TYPE_SERVICEACCOUNT },
|
||||||
|
];
|
||||||
|
|
||||||
|
function emptyRow() {
|
||||||
|
return {
|
||||||
|
fsType: FS_TYPE_CONFIGMAP,
|
||||||
|
volumeName: DEFAULT_VOLUME_NAMES[FS_TYPE_CONFIGMAP],
|
||||||
|
resourceName: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'VirtualMachineFilesystem',
|
||||||
|
|
||||||
|
emits: ['update:value'],
|
||||||
|
|
||||||
|
components: {
|
||||||
|
Banner,
|
||||||
|
LabeledSelect,
|
||||||
|
LabeledInput,
|
||||||
|
CopyToClipboard,
|
||||||
|
MessageLink,
|
||||||
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
default: 'create',
|
||||||
|
},
|
||||||
|
namespace: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return { rows: this.value.length > 0 ? this.value.map((r) => ({ ...r })) : [emptyRow()] };
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
value(newVal) {
|
||||||
|
if (newVal) {
|
||||||
|
const incoming = JSON.stringify(newVal);
|
||||||
|
const current = JSON.stringify(this.rows);
|
||||||
|
|
||||||
|
if (incoming !== current) {
|
||||||
|
this.rows = newVal.map((r) => ({ ...r }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
rows: {
|
||||||
|
deep: true,
|
||||||
|
handler(val) {
|
||||||
|
this.$emit('update:value', val.map((r) => ({ ...r })));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
...mapGetters({ t: 'i18n/t' }),
|
||||||
|
|
||||||
|
inStore() {
|
||||||
|
return this.$store.getters['currentProduct'].inStore;
|
||||||
|
},
|
||||||
|
|
||||||
|
configMaps() {
|
||||||
|
return this.$store.getters[`${ this.inStore }/all`](CONFIG_MAP)
|
||||||
|
.filter((cm) => !this.namespace || cm.metadata.namespace === this.namespace)
|
||||||
|
.map((cm) => ({ label: cm.metadata.name, value: cm.metadata.name }));
|
||||||
|
},
|
||||||
|
|
||||||
|
secrets() {
|
||||||
|
return this.$store.getters[`${ this.inStore }/all`](SECRET)
|
||||||
|
.filter((s) => !this.namespace || s.metadata.namespace === this.namespace)
|
||||||
|
.map((s) => ({ label: s.metadata.name, value: s.metadata.name }));
|
||||||
|
},
|
||||||
|
|
||||||
|
serviceAccounts() {
|
||||||
|
return this.$store.getters[`${ this.inStore }/all`](SERVICE_ACCOUNT)
|
||||||
|
.filter((sa) => !this.namespace || sa.metadata.namespace === this.namespace)
|
||||||
|
.map((sa) => ({ label: sa.metadata.name, value: sa.metadata.name }));
|
||||||
|
},
|
||||||
|
|
||||||
|
canAddRow() {
|
||||||
|
return this.rows.length < MAX_FILESYSTEMS;
|
||||||
|
},
|
||||||
|
|
||||||
|
isView() {
|
||||||
|
return this.mode === _VIEW;
|
||||||
|
},
|
||||||
|
|
||||||
|
completedRows() {
|
||||||
|
return this.rows.filter((r) => r.fsType && r.volumeName && r.resourceName);
|
||||||
|
},
|
||||||
|
|
||||||
|
allMountCommands() {
|
||||||
|
return this.completedRows.map((r) => this.mountCommands(r)).join('\n');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
fsTypeOptions(currentIndex) {
|
||||||
|
const usedTypes = this.rows
|
||||||
|
.filter((_, i) => i !== currentIndex)
|
||||||
|
.map((r) => r.fsType);
|
||||||
|
|
||||||
|
return FS_TYPE_OPTIONS.filter((opt) => !usedTypes.includes(opt.value));
|
||||||
|
},
|
||||||
|
|
||||||
|
resourceOptions(fsType) {
|
||||||
|
if (fsType === FS_TYPE_CONFIGMAP) return this.configMaps;
|
||||||
|
if (fsType === FS_TYPE_SECRET) return this.secrets;
|
||||||
|
if (fsType === FS_TYPE_SERVICEACCOUNT) return this.serviceAccounts;
|
||||||
|
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
|
||||||
|
onFsTypeChange(row, newType) {
|
||||||
|
row.fsType = newType;
|
||||||
|
row.volumeName = DEFAULT_VOLUME_NAMES[newType] || '';
|
||||||
|
row.resourceName = '';
|
||||||
|
},
|
||||||
|
|
||||||
|
addRow() {
|
||||||
|
if (this.canAddRow) {
|
||||||
|
const usedTypes = this.rows.map((r) => r.fsType);
|
||||||
|
const nextType = FS_TYPE_OPTIONS.find((opt) => !usedTypes.includes(opt.value))?.value || FS_TYPE_CONFIGMAP;
|
||||||
|
|
||||||
|
this.rows.push({
|
||||||
|
fsType: nextType,
|
||||||
|
volumeName: DEFAULT_VOLUME_NAMES[nextType] || '',
|
||||||
|
resourceName: '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
removeRow(index) {
|
||||||
|
this.rows.splice(index, 1);
|
||||||
|
},
|
||||||
|
|
||||||
|
mountCommands(row) {
|
||||||
|
const vol = row.volumeName || '<volume-name>';
|
||||||
|
|
||||||
|
return `- mkdir -p /mnt/${ vol }\n- mount -t virtiofs ${ vol } /mnt/${ vol }`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="vm-filesystem">
|
||||||
|
<p class="mb-20">
|
||||||
|
{{ t('harvester.virtualMachine.filesystem.description') }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-for="(row, index) in rows"
|
||||||
|
:key="index"
|
||||||
|
class="filesystem-row mb-15"
|
||||||
|
>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col span-3">
|
||||||
|
<LabeledSelect
|
||||||
|
:value="row.fsType"
|
||||||
|
:label="t('harvester.virtualMachine.filesystem.type')"
|
||||||
|
:options="fsTypeOptions(index)"
|
||||||
|
:mode="mode"
|
||||||
|
required
|
||||||
|
@update:value="onFsTypeChange(row, $event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col span-3">
|
||||||
|
<LabeledInput
|
||||||
|
v-model:value="row.volumeName"
|
||||||
|
:label="t('harvester.virtualMachine.filesystem.volume')"
|
||||||
|
:mode="mode"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col span-5">
|
||||||
|
<LabeledSelect
|
||||||
|
v-model:value="row.resourceName"
|
||||||
|
:label="t('harvester.virtualMachine.filesystem.resource')"
|
||||||
|
:options="resourceOptions(row.fsType)"
|
||||||
|
:mode="mode"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="!isView"
|
||||||
|
class="col span-1 remove-col"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn role-link remove-btn"
|
||||||
|
@click="removeRow(index)"
|
||||||
|
>
|
||||||
|
{{ t('generic.remove') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Banner
|
||||||
|
v-if="completedRows.length > 0"
|
||||||
|
color="warning"
|
||||||
|
class="mt-10"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<MessageLink
|
||||||
|
:to="{ hash: '#advanced' }"
|
||||||
|
prefix-label="harvester.virtualMachine.filesystem.mountBannerHint"
|
||||||
|
middle-label="harvester.virtualMachine.filesystem.mountBannerHintLink"
|
||||||
|
suffix-label="harvester.virtualMachine.filesystem.mountBannerHintSuffix"
|
||||||
|
/>
|
||||||
|
<div class="pre-wrapper mt-10">
|
||||||
|
<pre class="mt-5 mb-0">{{ allMountCommands }}</pre>
|
||||||
|
<CopyToClipboard
|
||||||
|
:text="allMountCommands"
|
||||||
|
:show-label="false"
|
||||||
|
class="icon-btn"
|
||||||
|
action-color="bg-transparent"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Banner>
|
||||||
|
|
||||||
|
<button
|
||||||
|
v-if="!isView && canAddRow"
|
||||||
|
type="button"
|
||||||
|
class="btn role-tertiary add"
|
||||||
|
@click="addRow"
|
||||||
|
>
|
||||||
|
{{ t('harvester.virtualMachine.filesystem.add') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.vm-filesystem {
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filesystem-row {
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
padding-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-col {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-btn {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pre-wrapper {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
pre {
|
||||||
|
padding-right: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
right: 5px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
line-height: 1;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background-color: var(--success) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -52,31 +52,21 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const selectedDevices = [];
|
const selectedDevices = [];
|
||||||
const oldFormatDevices = [];
|
|
||||||
|
|
||||||
const vmDevices = this.value?.domain?.devices?.hostDevices || [];
|
const vmDevices = this.value?.domain?.devices?.hostDevices || [];
|
||||||
const otherDevices = this.otherDevices(vmDevices).map(({ name }) => name);
|
|
||||||
const vmDeviceNames = vmDevices.map(({ name }) => name);
|
const vmDeviceNames = vmDevices.map(({ name }) => name);
|
||||||
|
|
||||||
this.pciDevices.forEach((row) => {
|
this.pciDevices.forEach((row) => {
|
||||||
row.allowDisable = !vmDeviceNames.includes(row.metadata.name);
|
row.allowDisable = !vmDeviceNames.includes(row.metadata.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
vmDevices.forEach(({ name, deviceName }) => {
|
vmDevices.forEach(({ name }) => {
|
||||||
const checkName = (deviceName || '').split('/')?.[1];
|
if (this.enabledDevices.find((device) => device?.metadata?.name === name)) {
|
||||||
|
|
||||||
if (checkName && name.includes(checkName) && !otherDevices.includes(name)) {
|
|
||||||
oldFormatDevices.push(name);
|
|
||||||
} else if (this.enabledDevices.find((device) => device?.metadata?.name === name)) {
|
|
||||||
selectedDevices.push(name);
|
selectedDevices.push(name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (oldFormatDevices.length > 0) {
|
this.selectedDevices = selectedDevices;
|
||||||
this.oldFormatDevices = oldFormatDevices;
|
|
||||||
} else {
|
|
||||||
this.selectedDevices = selectedDevices;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@@ -87,7 +77,6 @@ export default {
|
|||||||
selectedDevices: [],
|
selectedDevices: [],
|
||||||
pciDeviceSchema: this.$store.getters['harvester/schemaFor'](HCI.PCI_DEVICE),
|
pciDeviceSchema: this.$store.getters['harvester/schemaFor'](HCI.PCI_DEVICE),
|
||||||
showMatrix: false,
|
showMatrix: false,
|
||||||
oldFormatDevices: [],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -199,11 +188,6 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
oldFormatDevicesHTML() {
|
|
||||||
return this.oldFormatDevices.map((device) => {
|
|
||||||
return `<li>${ device }</li>`;
|
|
||||||
}).join('');
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -227,101 +211,89 @@ export default {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div class="row">
|
||||||
v-if="oldFormatDevices.length > 0"
|
|
||||||
class="row"
|
|
||||||
>
|
|
||||||
<div class="col span-12">
|
<div class="col span-12">
|
||||||
<Banner color="warning">
|
<Banner color="info">
|
||||||
<p v-clean-html="t('harvester.pci.oldFormatDevices.help', {oldFormatDevicesHTML}, true)" />
|
<MessageLink
|
||||||
|
:to="toVGpuDevicesPage"
|
||||||
|
prefix-label="harvester.pci.howToUseDeviceInVMCreation.prefix"
|
||||||
|
middle-label="harvester.pci.howToUseDeviceInVMCreation.middle"
|
||||||
|
suffix-label="harvester.pci.howToUseDeviceInVMCreation.suffix"
|
||||||
|
/>
|
||||||
|
</Banner>
|
||||||
|
<Banner
|
||||||
|
v-if="selectedDevices.length > 0"
|
||||||
|
color="info"
|
||||||
|
>
|
||||||
|
<t k="harvester.pci.deviceInTheSameHost" />
|
||||||
</Banner>
|
</Banner>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<template v-if="enabledDevices.length">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col span-12">
|
<div class="col span-6">
|
||||||
<Banner color="info">
|
<LabeledSelect
|
||||||
<MessageLink
|
v-model:value="selectedDevices"
|
||||||
:to="toVGpuDevicesPage"
|
label="Available PCI Devices"
|
||||||
prefix-label="harvester.pci.howToUseDeviceInVMCreation.prefix"
|
searchable
|
||||||
middle-label="harvester.pci.howToUseDeviceInVMCreation.middle"
|
multiple
|
||||||
suffix-label="harvester.pci.howToUseDeviceInVMCreation.suffix"
|
taggable
|
||||||
/>
|
:options="deviceOpts"
|
||||||
</Banner>
|
:mode="mode"
|
||||||
<Banner
|
|
||||||
v-if="selectedDevices.length > 0"
|
|
||||||
color="info"
|
|
||||||
>
|
>
|
||||||
<t k="harvester.pci.deviceInTheSameHost" />
|
<template #option="option">
|
||||||
</Banner>
|
<span>{{ option.value }} <span class="text-label">({{ option.displayLabel }})</span></span>
|
||||||
|
</template>
|
||||||
|
</LabeledSelect>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="enabledDevices.length">
|
<div
|
||||||
<div class="row">
|
v-if="compatibleNodes.length && selectedDevices.length"
|
||||||
<div class="col span-6">
|
class="row"
|
||||||
<LabeledSelect
|
>
|
||||||
v-model:value="selectedDevices"
|
<div class="col span-12 text-muted">
|
||||||
label="Available PCI Devices"
|
Compatible hosts:
|
||||||
searchable
|
<!-- eslint-disable-next-line vue/no-parsing-error -->
|
||||||
multiple
|
<span
|
||||||
taggable
|
v-for="(node, idx) in compatibleNodes"
|
||||||
:options="deviceOpts"
|
:key="idx"
|
||||||
:mode="mode"
|
>{{ node }}{{ idx < compatibleNodes.length-1 ? ', ' : '' }}</span>
|
||||||
>
|
|
||||||
<template #option="option">
|
|
||||||
<span>{{ option.value }} <span class="text-label">({{ option.displayLabel }})</span></span>
|
|
||||||
</template>
|
|
||||||
</LabeledSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
</div>
|
||||||
v-if="compatibleNodes.length && selectedDevices.length"
|
<div
|
||||||
class="row"
|
v-else-if="selectedDevices.length"
|
||||||
>
|
class="text-error"
|
||||||
<div class="col span-12 text-muted">
|
>
|
||||||
Compatible hosts:
|
{{ t('harvester.pci.impossibleSelection') }}
|
||||||
<!-- eslint-disable-next-line vue/no-parsing-error -->
|
</div>
|
||||||
<span
|
<button
|
||||||
v-for="(node, idx) in compatibleNodes"
|
type="button"
|
||||||
:key="idx"
|
class="btn btn-sm role-link pl-0"
|
||||||
>{{ node }}{{ idx < compatibleNodes.length-1 ? ', ' : '' }}</span>
|
@click="e=>{showMatrix = !showMatrix; e.target.blur()}"
|
||||||
</div>
|
>
|
||||||
</div>
|
{{ showMatrix ? t('harvester.pci.hideCompatibility') : t('harvester.pci.showCompatibility') }}
|
||||||
<div
|
</button>
|
||||||
v-else-if="selectedDevices.length"
|
<div
|
||||||
class="text-error"
|
v-if="showMatrix"
|
||||||
>
|
class="row mt-20"
|
||||||
{{ t('harvester.pci.impossibleSelection') }}
|
>
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-sm role-link pl-0"
|
|
||||||
@click="e=>{showMatrix = !showMatrix; e.target.blur()}"
|
|
||||||
>
|
|
||||||
{{ showMatrix ? t('harvester.pci.hideCompatibility') : t('harvester.pci.showCompatibility') }}
|
|
||||||
</button>
|
|
||||||
<div
|
|
||||||
v-if="showMatrix"
|
|
||||||
class="row mt-20"
|
|
||||||
>
|
|
||||||
<div class="col span-12">
|
|
||||||
<CompatibilityMatrix
|
|
||||||
:enabled-devices="enabledDevices"
|
|
||||||
:devices-by-node="devicesByNode"
|
|
||||||
:devices-in-use="devicesInUse"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<div class="row mt-20">
|
|
||||||
<div class="col span-12">
|
<div class="col span-12">
|
||||||
<DeviceList
|
<CompatibilityMatrix
|
||||||
:schema="pciDeviceSchema"
|
:enabled-devices="enabledDevices"
|
||||||
:devices="pciDevices"
|
:devices-by-node="devicesByNode"
|
||||||
@submit.prevent
|
:devices-in-use="devicesInUse"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
<div class="row mt-20">
|
||||||
|
<div class="col span-12">
|
||||||
|
<DeviceList
|
||||||
|
:schema="pciDeviceSchema"
|
||||||
|
:devices="pciDevices"
|
||||||
|
@submit.prevent
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import Network from './VirtualMachineNetwork';
|
|||||||
import Volume from './VirtualMachineVolume';
|
import Volume from './VirtualMachineVolume';
|
||||||
import SSHKey from './VirtualMachineSSHKey';
|
import SSHKey from './VirtualMachineSSHKey';
|
||||||
import Reserved from './VirtualMachineReserved';
|
import Reserved from './VirtualMachineReserved';
|
||||||
|
import Filesystem from './VirtualMachineFilesystem';
|
||||||
import { Banner } from '@components/Banner';
|
import { Banner } from '@components/Banner';
|
||||||
import MessageLink from '@shell/components/MessageLink';
|
import MessageLink from '@shell/components/MessageLink';
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ export default {
|
|||||||
Banner,
|
Banner,
|
||||||
MessageLink,
|
MessageLink,
|
||||||
UsbDevices,
|
UsbDevices,
|
||||||
|
Filesystem,
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [CreateEditView, VM_MIXIN],
|
mixins: [CreateEditView, VM_MIXIN],
|
||||||
@@ -91,22 +93,36 @@ export default {
|
|||||||
|
|
||||||
const hostname = this.value.spec.template.spec.hostname || '';
|
const hostname = this.value.spec.template.spec.hostname || '';
|
||||||
|
|
||||||
|
const customizeDisplayName = !!(this.value.metadata?.annotations?.[HCI_ANNOTATIONS.VM_DISPLAY_NAME]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cloneVM,
|
cloneVM,
|
||||||
count: 2,
|
count: 2,
|
||||||
templateId: '',
|
templateId: '',
|
||||||
templateVersionId: '',
|
templateVersionId: '',
|
||||||
namePrefix: '',
|
namePrefix: '',
|
||||||
isSingle: true,
|
isSingle: true,
|
||||||
isOpen: false,
|
isOpen: false,
|
||||||
hostname,
|
hostname,
|
||||||
isRestartImmediately,
|
isRestartImmediately,
|
||||||
|
customizeDisplayName,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({ t: 'i18n/t' }),
|
...mapGetters({ t: 'i18n/t' }),
|
||||||
|
|
||||||
|
// VM display name is stored as an annotation; bind a dedicated input to it
|
||||||
|
// so we don't have to mutate metadata.name (which would break the k8s PUT).
|
||||||
|
displayName: {
|
||||||
|
get() {
|
||||||
|
return this.value.metadata?.annotations?.[HCI_ANNOTATIONS.VM_DISPLAY_NAME] || '';
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.value.setAnnotation(HCI_ANNOTATIONS.VM_DISPLAY_NAME, val);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
to() {
|
to() {
|
||||||
return {
|
return {
|
||||||
name: 'harvester-c-cluster-resource',
|
name: 'harvester-c-cluster-resource',
|
||||||
@@ -218,6 +234,9 @@ export default {
|
|||||||
usbPassthroughEnabled() {
|
usbPassthroughEnabled() {
|
||||||
return this.$store.getters['harvester-common/getFeatureEnabled']('usbPassthrough');
|
return this.$store.getters['harvester-common/getFeatureEnabled']('usbPassthrough');
|
||||||
},
|
},
|
||||||
|
filesystemEnabled() {
|
||||||
|
return this.$store.getters['harvester-common/getFeatureEnabled']('supportFilesystem');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
@@ -289,6 +308,12 @@ export default {
|
|||||||
this.getInitConfig({ value: this.value, init: this.isCreate });
|
this.getInitConfig({ value: this.value, init: this.isCreate });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
customizeDisplayName(neu) {
|
||||||
|
if (!neu) {
|
||||||
|
this.value.setAnnotation(HCI_ANNOTATIONS.VM_DISPLAY_NAME, '');
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
@@ -321,6 +346,7 @@ export default {
|
|||||||
const diskRows = this.getDiskRows(this.value);
|
const diskRows = this.getDiskRows(this.value);
|
||||||
|
|
||||||
this['diskRows'] = diskRows;
|
this['diskRows'] = diskRows;
|
||||||
|
this['filesystemRows'] = this.getFilesystemRows(this.value);
|
||||||
const templateId = this.$route.query.templateId;
|
const templateId = this.$route.query.templateId;
|
||||||
const templateVersionId = this.$route.query.versionId;
|
const templateVersionId = this.$route.query.versionId;
|
||||||
|
|
||||||
@@ -610,6 +636,33 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
</NameNsDescription>
|
</NameNsDescription>
|
||||||
|
|
||||||
|
<div v-if="isSingle">
|
||||||
|
<div class="row mb-20">
|
||||||
|
<div class="col span-12">
|
||||||
|
<Checkbox
|
||||||
|
v-model:value="customizeDisplayName"
|
||||||
|
class="check"
|
||||||
|
type="checkbox"
|
||||||
|
:label="t('harvester.virtualMachine.input.customizeDisplayName')"
|
||||||
|
:mode="mode"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="customizeDisplayName"
|
||||||
|
class="row mb-20"
|
||||||
|
>
|
||||||
|
<div class="col span-6">
|
||||||
|
<LabeledInput
|
||||||
|
v-model:value="displayName"
|
||||||
|
:mode="mode"
|
||||||
|
:label="t('harvester.virtualMachine.input.displayName')"
|
||||||
|
:placeholder="t('harvester.virtualMachine.input.displayNamePlaceholder')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Checkbox
|
<Checkbox
|
||||||
v-if="isCreate"
|
v-if="isCreate"
|
||||||
v-model:value="useTemplate"
|
v-model:value="useTemplate"
|
||||||
@@ -783,10 +836,23 @@ export default {
|
|||||||
/>
|
/>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
|
<Tab
|
||||||
|
v-if="filesystemEnabled"
|
||||||
|
name="filesystem"
|
||||||
|
:label="t('harvester.tab.filesystem')"
|
||||||
|
:weight="-9"
|
||||||
|
>
|
||||||
|
<Filesystem
|
||||||
|
v-model:value="filesystemRows"
|
||||||
|
:mode="mode"
|
||||||
|
:namespace="value.metadata.namespace"
|
||||||
|
/>
|
||||||
|
</Tab>
|
||||||
|
|
||||||
<Tab
|
<Tab
|
||||||
name="labels"
|
name="labels"
|
||||||
:label="t('generic.labels')"
|
:label="t('generic.labels')"
|
||||||
:weight="-9"
|
:weight="-10"
|
||||||
>
|
>
|
||||||
<Banner color="info">
|
<Banner color="info">
|
||||||
<t k="harvester.virtualMachine.labels.banner" />
|
<t k="harvester.virtualMachine.labels.banner" />
|
||||||
@@ -805,7 +871,7 @@ export default {
|
|||||||
<Tab
|
<Tab
|
||||||
name="instanceLabel"
|
name="instanceLabel"
|
||||||
:label="t('harvester.tab.instanceLabel')"
|
:label="t('harvester.tab.instanceLabel')"
|
||||||
:weight="-10"
|
:weight="-11"
|
||||||
>
|
>
|
||||||
<Banner color="info">
|
<Banner color="info">
|
||||||
<t k="harvester.virtualMachine.instanceLabels.banner" />
|
<t k="harvester.virtualMachine.instanceLabels.banner" />
|
||||||
@@ -826,7 +892,7 @@ export default {
|
|||||||
<Tab
|
<Tab
|
||||||
name="annotations"
|
name="annotations"
|
||||||
:label="t('harvester.tab.annotations')"
|
:label="t('harvester.tab.annotations')"
|
||||||
:weight="-11"
|
:weight="-12"
|
||||||
>
|
>
|
||||||
<Banner color="info">
|
<Banner color="info">
|
||||||
<t k="harvester.virtualMachine.annotations.banner" />
|
<t k="harvester.virtualMachine.annotations.banner" />
|
||||||
@@ -847,7 +913,7 @@ export default {
|
|||||||
<Tab
|
<Tab
|
||||||
name="advanced"
|
name="advanced"
|
||||||
:label="t('harvester.tab.advanced')"
|
:label="t('harvester.tab.advanced')"
|
||||||
:weight="-12"
|
:weight="-13"
|
||||||
>
|
>
|
||||||
<div class="row mb-20">
|
<div class="row mb-20">
|
||||||
<div class="col span-6">
|
<div class="col span-6">
|
||||||
|
|||||||
@@ -355,6 +355,7 @@ harvester:
|
|||||||
snapshots: Snapshots
|
snapshots: Snapshots
|
||||||
instanceLabel: Instance Labels
|
instanceLabel: Instance Labels
|
||||||
annotations: Annotations
|
annotations: Annotations
|
||||||
|
filesystem: Filesystem Volume
|
||||||
fields:
|
fields:
|
||||||
version: Version
|
version: Version
|
||||||
name: Name
|
name: Name
|
||||||
@@ -391,21 +392,6 @@ harvester:
|
|||||||
middle: vGPU Devices
|
middle: vGPU Devices
|
||||||
suffix: page.
|
suffix: page.
|
||||||
deviceInTheSameHost: 'You can only select devices on the same host.'
|
deviceInTheSameHost: 'You can only select devices on the same host.'
|
||||||
oldFormatDevices:
|
|
||||||
help: |-
|
|
||||||
<p>
|
|
||||||
The following PCI devices are using the old naming convention and need to be updated in the YAML file:
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
{oldFormatDevicesHTML}
|
|
||||||
</ul>
|
|
||||||
<p>
|
|
||||||
Please use the following instructions to update the virtual machine:
|
|
||||||
</p>
|
|
||||||
<ol>
|
|
||||||
<li>Stop the virtual machine, edit the virtual machine YAML, and remove the <Code>hostDevices</Code> section, and save virtual machine the changes to the YAML file.</li>
|
|
||||||
<li>Edit the virtual machine, and add the already enabled PCI Device from the list of available PCIDevices, and save and start VM.</li>
|
|
||||||
</ol>
|
|
||||||
showCompatibility: Show device compatibility matrix
|
showCompatibility: Show device compatibility matrix
|
||||||
hideCompatibility: Hide device compatibility matrix
|
hideCompatibility: Hide device compatibility matrix
|
||||||
claimError: Error enabling passthrough on {name}
|
claimError: Error enabling passthrough on {name}
|
||||||
@@ -423,6 +409,8 @@ harvester:
|
|||||||
suffix: to enable the add-on to successfully manage your PCI devices.
|
suffix: to enable the add-on to successfully manage your PCI devices.
|
||||||
noPCIPermission: Please contact your system administrator to enable the PCI devices first.
|
noPCIPermission: Please contact your system administrator to enable the PCI devices first.
|
||||||
enablePassthroughWarning: Please be careful not to use host-owned PCI devices (e.g., management and VLAN NICs). Incorrect device allocation may cause damage to your cluster, including node failure.
|
enablePassthroughWarning: Please be careful not to use host-owned PCI devices (e.g., management and VLAN NICs). Incorrect device allocation may cause damage to your cluster, including node failure.
|
||||||
|
disableResourcePooling: Disable Resource Pooling
|
||||||
|
disableResourcePoolingDescription: Assigns this device a unique resource name so it can be pinned to a specific VM, instead of sharing the pool with other identical devices.
|
||||||
|
|
||||||
devices:
|
devices:
|
||||||
matrixHostName: Host Name
|
matrixHostName: Host Name
|
||||||
@@ -830,6 +818,18 @@ harvester:
|
|||||||
username: Username
|
username: Username
|
||||||
password: Password
|
password: Password
|
||||||
reservedMemory: Reserved Memory
|
reservedMemory: Reserved Memory
|
||||||
|
customizeDisplayName: Customize virtual machine display name
|
||||||
|
displayNamePlaceholder: Virtual machine alias name
|
||||||
|
displayName: Display Name
|
||||||
|
filesystem:
|
||||||
|
description: Harvester supports filesystem volumes for VM via virtiofs.
|
||||||
|
type: Filesystem Type
|
||||||
|
volume: Volume
|
||||||
|
resource: Resource
|
||||||
|
add: Add
|
||||||
|
mountBannerHint: "Please update the mount path (e.g. /mnt/appconfigfs) to your preferred location, then add the corresponding commands to the"
|
||||||
|
mountBannerHintLink: "runcmd"
|
||||||
|
mountBannerHintSuffix: "in Advanced tab User Data."
|
||||||
machineTypeTip: 'Specify a processor architecture to emulate. To see a list of supported architectures, run: qemu-system-x86_64 -cpu ?'
|
machineTypeTip: 'Specify a processor architecture to emulate. To see a list of supported architectures, run: qemu-system-x86_64 -cpu ?'
|
||||||
detail:
|
detail:
|
||||||
tabs:
|
tabs:
|
||||||
@@ -1156,6 +1156,9 @@ harvester:
|
|||||||
placeholder: key1=value1, key2=value2
|
placeholder: key1=value1, key2=value2
|
||||||
dhcpOptionBanner: DHCP options is a key/value string concatenate with comma. For more detail, please refer to <a href="https://kubeovn.github.io/docs/v1.13.x/en/kubevirt/dhcp/" target="_blank">KubOVN document</a>
|
dhcpOptionBanner: DHCP options is a key/value string concatenate with comma. For more detail, please refer to <a href="https://kubeovn.github.io/docs/v1.13.x/en/kubevirt/dhcp/" target="_blank">KubOVN document</a>
|
||||||
tooltip: Enable DHCP server for this subnet. When enabled, VMs can automatically obtain IP addresses from this subnet.
|
tooltip: Enable DHCP server for this subnet. When enabled, VMs can automatically obtain IP addresses from this subnet.
|
||||||
|
externalConnectivity:
|
||||||
|
label: NAT Outgoing
|
||||||
|
tooltip: Enable NAT for VMs using this subnet to access external networks.
|
||||||
private:
|
private:
|
||||||
label: Private Subnet
|
label: Private Subnet
|
||||||
tooltip: Enable network isolation for this Subnet. When enabled, VMs can only communicate within this subnet, even if other subnets exist under the same VPC.
|
tooltip: Enable network isolation for this Subnet. When enabled, VMs can only communicate within this subnet, even if other subnets exist under the same VPC.
|
||||||
@@ -1531,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:
|
||||||
@@ -1911,6 +1915,8 @@ harvester:
|
|||||||
|
|
||||||
migconfiguration:
|
migconfiguration:
|
||||||
label: vGPU MIG Configurations
|
label: vGPU MIG Configurations
|
||||||
|
status:
|
||||||
|
outOfSync: Out of Sync
|
||||||
infoBanner: To configure the MIG configuration, please disable it first and re-enable after editing the configuration.
|
infoBanner: To configure the MIG configuration, please disable it first and re-enable after editing the configuration.
|
||||||
profileSpec: Profile Specs
|
profileSpec: Profile Specs
|
||||||
profileStatus: Profile Status
|
profileStatus: Profile Status
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ export const VM_HEADERS = [
|
|||||||
{
|
{
|
||||||
...NAME,
|
...NAME,
|
||||||
width: 350,
|
width: 350,
|
||||||
|
value: 'nameDisplay',
|
||||||
|
sort: ['nameDisplay'],
|
||||||
},
|
},
|
||||||
NAMESPACE,
|
NAMESPACE,
|
||||||
{
|
{
|
||||||
@@ -244,7 +246,7 @@ export default {
|
|||||||
v-if="scope.row.type !== HCI.VMI"
|
v-if="scope.row.type !== HCI.VMI"
|
||||||
:to="scope.row.detailLocation"
|
:to="scope.row.detailLocation"
|
||||||
>
|
>
|
||||||
{{ scope.row.metadata.name }}
|
{{ scope.row.nameDisplay }}
|
||||||
<i
|
<i
|
||||||
v-if="scope.row.encryptedVolumeType !== 'none'"
|
v-if="scope.row.encryptedVolumeType !== 'none'"
|
||||||
v-tooltip="lockIconTooltipMessage(scope.row)"
|
v-tooltip="lockIconTooltipMessage(scope.row)"
|
||||||
@@ -253,7 +255,7 @@ export default {
|
|||||||
/>
|
/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ scope.row.metadata.name }}
|
{{ scope.row.nameDisplay }}
|
||||||
</span>
|
</span>
|
||||||
<ConsoleBar
|
<ConsoleBar
|
||||||
:resource-type="scope.row"
|
:resource-type="scope.row"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { base64Decode } from '@shell/utils/crypto';
|
|||||||
import { formatSi, parseSi } from '@shell/utils/units';
|
import { formatSi, parseSi } from '@shell/utils/units';
|
||||||
import { _CLONE, _CREATE, _VIEW } from '@shell/config/query-params';
|
import { _CLONE, _CREATE, _VIEW } from '@shell/config/query-params';
|
||||||
import {
|
import {
|
||||||
PV, PVC, STORAGE_CLASS, NODE, SECRET, CONFIG_MAP, NETWORK_ATTACHMENT, NAMESPACE, LONGHORN
|
PV, PVC, STORAGE_CLASS, NODE, SECRET, CONFIG_MAP, SERVICE_ACCOUNT, NETWORK_ATTACHMENT, NAMESPACE, LONGHORN
|
||||||
} from '@shell/config/types';
|
} from '@shell/config/types';
|
||||||
import { HOSTNAME } from '@shell/config/labels-annotations';
|
import { HOSTNAME } from '@shell/config/labels-annotations';
|
||||||
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
||||||
@@ -25,7 +25,7 @@ import { HCI } from '../../types';
|
|||||||
import { parseVolumeClaimTemplates, EMPTY_IMAGE } from '../../utils/vm';
|
import { parseVolumeClaimTemplates, EMPTY_IMAGE } from '../../utils/vm';
|
||||||
import impl, { QGA_JSON, USB_TABLET } from './impl';
|
import impl, { QGA_JSON, USB_TABLET } from './impl';
|
||||||
import { GIBIBYTE } from '../../utils/unit';
|
import { GIBIBYTE } from '../../utils/unit';
|
||||||
import { VOLUME_MODE } from '@pkg/harvester/config/types';
|
import { VOLUME_MODE, FILESYSTEM_SOURCE_TYPE } from '@pkg/harvester/config/types';
|
||||||
|
|
||||||
const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';
|
const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';
|
||||||
|
|
||||||
@@ -102,6 +102,8 @@ export default {
|
|||||||
vmims: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.VMIM }),
|
vmims: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.VMIM }),
|
||||||
vms: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.VM }),
|
vms: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.VM }),
|
||||||
secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET }),
|
secrets: this.$store.dispatch(`${ inStore }/findAll`, { type: SECRET }),
|
||||||
|
configMaps: this.$store.dispatch(`${ inStore }/findAll`, { type: CONFIG_MAP }),
|
||||||
|
serviceAccounts: this.$store.dispatch(`${ inStore }/findAll`, { type: SERVICE_ACCOUNT }),
|
||||||
addons: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.ADD_ONS }),
|
addons: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.ADD_ONS }),
|
||||||
longhornV2Engine: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }),
|
longhornV2Engine: this.$store.dispatch(`${ inStore }/find`, { type: LONGHORN.SETTINGS, id: LONGHORN_V2_DATA_ENGINE }),
|
||||||
};
|
};
|
||||||
@@ -156,6 +158,7 @@ export default {
|
|||||||
imageId: '',
|
imageId: '',
|
||||||
diskRows: [],
|
diskRows: [],
|
||||||
networkRows: [],
|
networkRows: [],
|
||||||
|
filesystemRows: [],
|
||||||
machineType: '',
|
machineType: '',
|
||||||
machineTypes: [],
|
machineTypes: [],
|
||||||
secretName: '',
|
secretName: '',
|
||||||
@@ -440,6 +443,7 @@ export default {
|
|||||||
this['imageId'] = imageId;
|
this['imageId'] = imageId;
|
||||||
|
|
||||||
this['diskRows'] = diskRows;
|
this['diskRows'] = diskRows;
|
||||||
|
this['filesystemRows'] = this.getFilesystemRows(vm);
|
||||||
|
|
||||||
this.refreshYamlEditor();
|
this.refreshYamlEditor();
|
||||||
},
|
},
|
||||||
@@ -641,6 +645,80 @@ export default {
|
|||||||
this.parseAccessCredentials();
|
this.parseAccessCredentials();
|
||||||
this.parseNetworkRows(this.networkRows);
|
this.parseNetworkRows(this.networkRows);
|
||||||
this.parseDiskRows(this.diskRows);
|
this.parseDiskRows(this.diskRows);
|
||||||
|
this.parseFilesystemRows();
|
||||||
|
},
|
||||||
|
|
||||||
|
getFilesystemRows(vm) {
|
||||||
|
const _filesystems = vm.spec.template.spec.domain.devices?.filesystems || [];
|
||||||
|
const _volumes = vm.spec.template.spec.volumes || [];
|
||||||
|
|
||||||
|
return _filesystems.map((fs) => {
|
||||||
|
const volume = _volumes.find((v) => v.name === fs.name);
|
||||||
|
let fsType = FILESYSTEM_SOURCE_TYPE.CONFIGMAP;
|
||||||
|
let resourceName = '';
|
||||||
|
|
||||||
|
if (volume?.configMap) {
|
||||||
|
fsType = FILESYSTEM_SOURCE_TYPE.CONFIGMAP;
|
||||||
|
resourceName = volume.configMap.name;
|
||||||
|
} else if (volume?.secret) {
|
||||||
|
fsType = FILESYSTEM_SOURCE_TYPE.SECRET;
|
||||||
|
resourceName = volume.secret.secretName;
|
||||||
|
} else if (volume?.serviceAccount) {
|
||||||
|
fsType = FILESYSTEM_SOURCE_TYPE.SERVICEACCOUNT;
|
||||||
|
resourceName = volume.serviceAccount.serviceAccountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
fsType,
|
||||||
|
volumeName: fs.name,
|
||||||
|
resourceName,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
parseFilesystemRows() {
|
||||||
|
const completedRows = this.filesystemRows.filter(
|
||||||
|
(r) => r.fsType && r.volumeName && r.resourceName
|
||||||
|
);
|
||||||
|
|
||||||
|
const filesystems = completedRows.map((r) => ({
|
||||||
|
name: r.volumeName,
|
||||||
|
virtiofs: {},
|
||||||
|
}));
|
||||||
|
|
||||||
|
const fsVolumes = completedRows.map((r) => {
|
||||||
|
if (r.fsType === FILESYSTEM_SOURCE_TYPE.CONFIGMAP) {
|
||||||
|
return {
|
||||||
|
name: r.volumeName,
|
||||||
|
configMap: { name: r.resourceName },
|
||||||
|
};
|
||||||
|
} else if (r.fsType === FILESYSTEM_SOURCE_TYPE.SECRET) {
|
||||||
|
return {
|
||||||
|
name: r.volumeName,
|
||||||
|
secret: { secretName: r.resourceName },
|
||||||
|
};
|
||||||
|
} else if (r.fsType === FILESYSTEM_SOURCE_TYPE.SERVICEACCOUNT) {
|
||||||
|
return {
|
||||||
|
name: r.volumeName,
|
||||||
|
serviceAccount: { serviceAccountName: r.resourceName },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}).filter(Boolean);
|
||||||
|
|
||||||
|
if (filesystems.length > 0) {
|
||||||
|
this.spec.template.spec.domain.devices['filesystems'] = filesystems;
|
||||||
|
} else {
|
||||||
|
delete this.spec.template.spec.domain.devices['filesystems'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fsVolumes.length > 0) {
|
||||||
|
if (!this.spec.template.spec.volumes) {
|
||||||
|
this.spec.template.spec['volumes'] = [];
|
||||||
|
}
|
||||||
|
this.spec.template.spec.volumes.push(...fsVolumes);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
parseOther() {
|
parseOther() {
|
||||||
@@ -907,14 +985,22 @@ export default {
|
|||||||
const specInterfaces = this.spec?.template?.spec?.domain?.devices?.interfaces;
|
const specInterfaces = this.spec?.template?.spec?.domain?.devices?.interfaces;
|
||||||
const mergedInterfaces = this.mergeInterfaceList(specInterfaces, interfaces);
|
const mergedInterfaces = this.mergeInterfaceList(specInterfaces, interfaces);
|
||||||
|
|
||||||
|
const devices = {
|
||||||
|
...this.spec.template.spec.domain.devices,
|
||||||
|
interfaces: mergedInterfaces,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.isEdit && networkRow.length === 0) {
|
||||||
|
devices.autoattachPodInterface = false;
|
||||||
|
} else {
|
||||||
|
delete devices.autoattachPodInterface;
|
||||||
|
}
|
||||||
|
|
||||||
const spec = {
|
const spec = {
|
||||||
...this.spec.template.spec,
|
...this.spec.template.spec,
|
||||||
domain: {
|
domain: {
|
||||||
...this.spec.template.spec.domain,
|
...this.spec.template.spec.domain,
|
||||||
devices: {
|
devices,
|
||||||
...this.spec.template.spec.domain.devices,
|
|
||||||
interfaces: mergedInterfaces,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
networks
|
networks
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,13 +63,27 @@ export default class MIGCONFIGURATION extends HarvesterResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get stateDisplay() {
|
get stateDisplay() {
|
||||||
|
if (this.configStatus === 'out-of-sync') {
|
||||||
|
return this.t('harvester.migconfiguration.status.outOfSync');
|
||||||
|
}
|
||||||
|
|
||||||
return this.actualState;
|
return this.actualState;
|
||||||
}
|
}
|
||||||
|
|
||||||
get stateColor() {
|
get stateDescription() {
|
||||||
const state = this.actualState;
|
if (this.status?.message) {
|
||||||
|
return this.status.message;
|
||||||
|
}
|
||||||
|
|
||||||
return colorForState(state);
|
return super.stateDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
get stateColor() {
|
||||||
|
if (this.configStatus === 'out-of-sync') {
|
||||||
|
return 'text-warning';
|
||||||
|
}
|
||||||
|
|
||||||
|
return colorForState(this.actualState);
|
||||||
}
|
}
|
||||||
|
|
||||||
get isEnabled() {
|
get isEnabled() {
|
||||||
|
|||||||
@@ -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');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1274,6 +1274,10 @@ export default class VirtVm extends HarvesterResource {
|
|||||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('schedulingVMBackup');
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('schedulingVMBackup');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get nameDisplay() {
|
||||||
|
return this.metadata?.annotations?.[HCI_ANNOTATIONS.VM_DISPLAY_NAME] || this.metadata?.name || this.id;
|
||||||
|
}
|
||||||
|
|
||||||
get volumeEncryptionFeatureEnabled() {
|
get volumeEncryptionFeatureEnabled() {
|
||||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption');
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user