mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-11-21 00:06:57 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c8b34ea7f |
@@ -53,7 +53,7 @@ jobs:
|
||||
- name: Setup Helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
|
||||
with:
|
||||
version: v3.22.1
|
||||
version: v3.8.0
|
||||
|
||||
- name: Setup Nodejs with yarn install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
- name: Setup Helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
|
||||
with:
|
||||
version: v3.22.1
|
||||
version: v3.8.0
|
||||
|
||||
- name: Build Helm charts
|
||||
run: |
|
||||
@@ -138,7 +138,7 @@ jobs:
|
||||
git push origin ${{ needs.setup-target-branch.outputs.target_branch }}
|
||||
|
||||
- name: Run Helm chart releaser
|
||||
uses: helm/chart-releaser-action@92c6b97fa9f664492a2592e0d1d80bc6bf378957 # v1.9.0
|
||||
uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
|
||||
with:
|
||||
charts_dir: ./charts
|
||||
env:
|
||||
|
||||
+8
-9
@@ -16,7 +16,6 @@
|
||||
"cache-loader": "^4.1.0",
|
||||
"color": "4.2.3",
|
||||
"ip": "2.0.1",
|
||||
"ipaddr.js": "2.5.0",
|
||||
"@xterm/xterm": "6.0.0",
|
||||
"@xterm/addon-fit": "0.11.0",
|
||||
"@xterm/addon-search": "0.16.0",
|
||||
@@ -24,7 +23,7 @@
|
||||
"@xterm/addon-webgl": "0.19.0",
|
||||
"@xterm/addon-canvas": "0.7.0",
|
||||
"node-polyfill-webpack-plugin": "^3.0.0",
|
||||
"elkjs": "^0.12.0",
|
||||
"elkjs": "^0.11.0",
|
||||
"vue-draggable-next": "^2.2.1",
|
||||
"yaml": "^2.5.1"
|
||||
},
|
||||
@@ -32,7 +31,7 @@
|
||||
"@novnc/novnc": "1.7.0",
|
||||
"@tootallnate/once": "^2.0.1",
|
||||
"@types/lodash": "4.17.25",
|
||||
"@types/node": "25.9.9",
|
||||
"@types/node": "25.3.3",
|
||||
"cookie": "0.7.2",
|
||||
"cronstrue": "2.59.0",
|
||||
"d3-color": "3.1.0",
|
||||
@@ -47,14 +46,14 @@
|
||||
"node-forge": "1.4.0",
|
||||
"nth-check": "2.1.1",
|
||||
"postcss": "8.5.26",
|
||||
"postcss-selector-parser": "7.2.1",
|
||||
"postcss-selector-parser": "7.1.6",
|
||||
"qs": "6.16.0",
|
||||
"roarr": "7.21.7",
|
||||
"semver": "7.8.6",
|
||||
"serialize-javascript": "7.0.5",
|
||||
"semver": "7.5.4",
|
||||
"serialize-javascript": "7.1.3",
|
||||
"uuid": "11.1.1",
|
||||
"webpack-dev-server": "5.2.6",
|
||||
"ws": "8.23.0",
|
||||
"ws": "8.21.0",
|
||||
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -83,10 +82,10 @@
|
||||
"eslint-plugin-promise": "^7.1.0",
|
||||
"husky": "^9.1.7",
|
||||
"@types/jest": "29.5.12",
|
||||
"@vue/test-utils": "2.5.1",
|
||||
"@vue/test-utils": "2.4.6",
|
||||
"@vue/vue3-jest": "29.2.6",
|
||||
"babel-jest": "29.7.0",
|
||||
"babel-plugin-transform-require-context": "0.2.0",
|
||||
"babel-plugin-transform-require-context": "0.1.1",
|
||||
"jest": "29.7.0",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"ts-jest": "29.4.12"
|
||||
|
||||
@@ -6,30 +6,26 @@ import ModalWithCard from '@shell/components/ModalWithCard';
|
||||
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
||||
import { Banner } from '@components/Banner';
|
||||
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
||||
import { STORAGE_CLASS } from '@shell/config/types';
|
||||
import { HCI } from '../types';
|
||||
import UpgradeInfo from './UpgradeInfo';
|
||||
import UpgradeRepositoryStorageClass, { getUpgradeRepositoryStorageClassDefault } from './UpgradeRepositoryStorageClass';
|
||||
|
||||
export default {
|
||||
name: 'HarvesterUpgrade',
|
||||
|
||||
components: {
|
||||
Checkbox, ModalWithCard, LabeledSelect, Banner, UpgradeInfo, UpgradeRepositoryStorageClass
|
||||
Checkbox, ModalWithCard, LabeledSelect, Banner, UpgradeInfo
|
||||
},
|
||||
|
||||
async fetch() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
const res = await allHash({
|
||||
upgradeVersion: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.SETTING }),
|
||||
versions: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.VERSION }),
|
||||
upgrade: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.UPGRADE }),
|
||||
storageClasses: this.$store.dispatch(`${ inStore }/findAll`, { type: STORAGE_CLASS }),
|
||||
upgradeVersion: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.SETTING }),
|
||||
versions: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.VERSION }),
|
||||
upgrade: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.UPGRADE }),
|
||||
});
|
||||
|
||||
this.upgrade = res.upgrade;
|
||||
this.storageClassName = getUpgradeRepositoryStorageClassDefault(res.storageClasses);
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -39,7 +35,6 @@ export default {
|
||||
errors: '',
|
||||
selectMode: true,
|
||||
version: '',
|
||||
storageClassName: '',
|
||||
enableLogging: true,
|
||||
skipSingleReplicaDetachedVol: false,
|
||||
readyReleaseNote: false,
|
||||
@@ -64,10 +59,6 @@ export default {
|
||||
return this.versionOptions.length > 0 && !this.isUpgradeInProgress;
|
||||
},
|
||||
|
||||
canSubmitUpgrade() {
|
||||
return this.readyReleaseNote && (!this.repositoryStorageClassEnabled || !!this.storageClassName);
|
||||
},
|
||||
|
||||
versionOptions() {
|
||||
const versions = this.$store.getters['harvester/all'](HCI.VERSION) || [];
|
||||
|
||||
@@ -84,16 +75,6 @@ export default {
|
||||
return this.$store.getters['harvester/schemaFor'](HCI.UPGRADE_LOG);
|
||||
},
|
||||
|
||||
storageClasses() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
return this.$store.getters[`${ inStore }/all`](STORAGE_CLASS) || [];
|
||||
},
|
||||
|
||||
repositoryStorageClassEnabled() {
|
||||
return this.$store.getters['harvester-common/getFeatureEnabled']('repositoryStorageClass');
|
||||
},
|
||||
|
||||
skipSingleReplicaDetachedVolFeatureEnabled() {
|
||||
return this.$store.getters['harvester-common/getFeatureEnabled']('skipSingleReplicaDetachedVol');
|
||||
},
|
||||
@@ -143,13 +124,6 @@ export default {
|
||||
upgradeValue.spec.logEnabled = this.enableLogging;
|
||||
}
|
||||
|
||||
if (this.repositoryStorageClassEnabled && this.storageClassName) {
|
||||
upgradeValue.metadata.annotations = {
|
||||
...upgradeValue.metadata.annotations,
|
||||
[HCI_ANNOTATIONS.UPGRADE_STORAGE_CLASS]: this.storageClassName
|
||||
};
|
||||
}
|
||||
|
||||
const proxyResource = await this.$store.dispatch('harvester/create', upgradeValue);
|
||||
|
||||
try {
|
||||
@@ -230,13 +204,6 @@ export default {
|
||||
:clearable="true"
|
||||
/>
|
||||
|
||||
<UpgradeRepositoryStorageClass
|
||||
v-if="repositoryStorageClassEnabled"
|
||||
v-model:value="storageClassName"
|
||||
class="mb-10"
|
||||
:storage-classes="storageClasses"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="canEnableLogging"
|
||||
class="mb-5"
|
||||
@@ -296,7 +263,7 @@ export default {
|
||||
<t k="generic.close" />
|
||||
</button>
|
||||
<button
|
||||
:disabled="!canSubmitUpgrade"
|
||||
:disabled="!readyReleaseNote"
|
||||
class="btn role-tertiary bg-primary"
|
||||
@click.prevent="handleUpgrade"
|
||||
>
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
<script>
|
||||
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
||||
import { LVM_DRIVER } from '../models/harvester/storage.k8s.io.storageclass';
|
||||
import { isInternalStorageClass } from '../utils/storage-class';
|
||||
|
||||
export function getUpgradeRepositoryStorageClassDefault(storageClasses) {
|
||||
return storageClasses.find((storageClass) => storageClass.isDefault &&
|
||||
!storageClass.parameters?.backingImage &&
|
||||
storageClass.provisioner !== LVM_DRIVER &&
|
||||
!isInternalStorageClass(storageClass.name))?.name || '';
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'UpgradeRepositoryStorageClass',
|
||||
|
||||
components: { LabeledSelect },
|
||||
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
storageClasses: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
emits: ['update:value'],
|
||||
|
||||
computed: {
|
||||
storageClassOptions() {
|
||||
const t = this.$store.getters['i18n/t'];
|
||||
|
||||
return this.storageClasses
|
||||
.filter((storageClass) => !storageClass.parameters?.backingImage && storageClass.provisioner !== LVM_DRIVER)
|
||||
.map((storageClass) => {
|
||||
let label = storageClass.isDefault ? `${ storageClass.name } (${ t('generic.default') })` : storageClass.name;
|
||||
let disabled = false;
|
||||
|
||||
if (isInternalStorageClass(storageClass.name)) {
|
||||
label += ` (${ t('harvester.storage.internal.label') })`;
|
||||
disabled = true;
|
||||
}
|
||||
|
||||
return {
|
||||
label,
|
||||
value: storageClass.name,
|
||||
disabled
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<LabeledSelect
|
||||
:value="value"
|
||||
:label="t('harvester.upgradePage.repositoryStorageClass')"
|
||||
:tooltip="t('harvester.upgradePage.repositoryStorageClassTooltip')"
|
||||
:placeholder="t('harvester.upgradePage.repositoryStorageClassPlaceholder')"
|
||||
:options="storageClassOptions"
|
||||
:disabled="disabled"
|
||||
required
|
||||
@update:value="$emit('update:value', $event)"
|
||||
>
|
||||
<template #no-options="{ searching }">
|
||||
<span
|
||||
v-if="!searching"
|
||||
class="text-muted"
|
||||
>
|
||||
{{ t('harvester.upgradePage.repositoryStorageClassNoOptions', null, true) }}
|
||||
</span>
|
||||
</template>
|
||||
</LabeledSelect>
|
||||
</template>
|
||||
@@ -1,86 +0,0 @@
|
||||
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
||||
import HarvesterUpgrade from '../HarvesterUpgrade.vue';
|
||||
|
||||
const save = jest.fn().mockResolvedValue();
|
||||
const upgrade = { notifyGeneratedName: jest.fn(), save };
|
||||
|
||||
function createForm(storageClassName = '', repositoryStorageClassEnabled = true) {
|
||||
return {
|
||||
version: 'v1.10.0',
|
||||
storageClassName,
|
||||
repositoryStorageClassEnabled,
|
||||
canEnableLogging: false,
|
||||
enableLogging: true,
|
||||
skipSingleReplicaDetachedVolFeatureEnabled: false,
|
||||
skipSingleReplicaDetachedVol: false,
|
||||
cancel: jest.fn(),
|
||||
errors: '',
|
||||
$store: { dispatch: jest.fn().mockResolvedValue(upgrade) }
|
||||
};
|
||||
}
|
||||
|
||||
describe('component: HarvesterUpgrade', () => {
|
||||
it('uses the shared Upgrade Repository StorageClass selector', () => {
|
||||
expect(HarvesterUpgrade.components.UpgradeRepositoryStorageClass).toBeDefined();
|
||||
});
|
||||
|
||||
it('leaves the default empty when it is unavailable for upgrade repositories', async() => {
|
||||
const form = {
|
||||
upgrade: [],
|
||||
storageClassName: 'previous',
|
||||
$store: {
|
||||
getters: { currentProduct: { inStore: 'harvester' } },
|
||||
dispatch: jest.fn()
|
||||
.mockResolvedValueOnce([])
|
||||
.mockResolvedValueOnce([])
|
||||
.mockResolvedValueOnce([])
|
||||
.mockResolvedValueOnce([
|
||||
{
|
||||
name: 'lvm-local', isDefault: true, provisioner: 'lvm.driver.harvesterhci.io'
|
||||
},
|
||||
{ name: 'fast' }
|
||||
])
|
||||
}
|
||||
};
|
||||
|
||||
await HarvesterUpgrade.fetch.call(form);
|
||||
|
||||
expect(form.storageClassName).toBe('');
|
||||
});
|
||||
|
||||
it('blocks the upgrade when no StorageClass is selected', () => {
|
||||
const canSubmitUpgrade = HarvesterUpgrade.computed.canSubmitUpgrade;
|
||||
|
||||
expect(canSubmitUpgrade.call({
|
||||
readyReleaseNote: true,
|
||||
repositoryStorageClassEnabled: true,
|
||||
storageClassName: ''
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it('saves the selected StorageClass as an Upgrade annotation', async() => {
|
||||
const form = createForm('fast');
|
||||
|
||||
await HarvesterUpgrade.methods.handleUpgrade.call(form);
|
||||
|
||||
expect(form.$store.dispatch).toHaveBeenCalledWith('harvester/create', expect.objectContaining({
|
||||
metadata: expect.objectContaining({ annotations: { [HCI_ANNOTATIONS.UPGRADE_STORAGE_CLASS]: 'fast' } }),
|
||||
spec: { version: 'v1.10.0' }
|
||||
}));
|
||||
});
|
||||
|
||||
it('omits the repository StorageClass when the feature is disabled', async() => {
|
||||
const form = createForm('fast', false);
|
||||
|
||||
await HarvesterUpgrade.methods.handleUpgrade.call(form);
|
||||
|
||||
expect(form.$store.dispatch).toHaveBeenCalledWith('harvester/create', {
|
||||
type: 'harvesterhci.io.upgrade',
|
||||
metadata: {
|
||||
generateName: 'hvst-upgrade-',
|
||||
namespace: 'harvester-system'
|
||||
},
|
||||
spec: { version: 'v1.10.0' }
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,40 +0,0 @@
|
||||
import UpgradeRepositoryStorageClass, { getUpgradeRepositoryStorageClassDefault } from '../UpgradeRepositoryStorageClass.vue';
|
||||
|
||||
const storageClasses = [
|
||||
{ name: 'fast', isDefault: true },
|
||||
{ name: 'image-cache', parameters: { backingImage: 'image' } },
|
||||
{ name: 'lvm-local', provisioner: 'lvm.driver.harvesterhci.io' },
|
||||
{ name: 'longhorn-static' },
|
||||
{ name: 'slow' }
|
||||
];
|
||||
|
||||
describe('component: UpgradeRepositoryStorageClass', () => {
|
||||
it('omits backing-image and LVM StorageClasses while disabling internal classes', () => {
|
||||
const form = {
|
||||
storageClasses,
|
||||
$store: { getters: { 'i18n/t': (key) => key } }
|
||||
};
|
||||
|
||||
expect(UpgradeRepositoryStorageClass.computed.storageClassOptions.call(form)).toStrictEqual([
|
||||
{
|
||||
label: 'fast (generic.default)', value: 'fast', disabled: false
|
||||
},
|
||||
{
|
||||
label: 'longhorn-static (harvester.storage.internal.label)', value: 'longhorn-static', disabled: true
|
||||
},
|
||||
{
|
||||
label: 'slow', value: 'slow', disabled: false
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('does not use an unavailable StorageClass as the default', () => {
|
||||
expect(getUpgradeRepositoryStorageClassDefault([
|
||||
{
|
||||
name: 'lvm-local', isDefault: true, provisioner: 'lvm.driver.harvesterhci.io'
|
||||
},
|
||||
{ name: 'longhorn-static' },
|
||||
{ name: 'fast' }
|
||||
])).toBe('');
|
||||
});
|
||||
});
|
||||
@@ -1,79 +0,0 @@
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import UpgradeConfig from '@pkg/harvester/components/settings/upgrade-config.vue';
|
||||
|
||||
const DEFAULT = JSON.stringify({
|
||||
imagePreloadOption: { strategy: { type: 'sequential' } },
|
||||
nodeUpgradeOption: { strategy: { mode: 'auto' } },
|
||||
restoreVM: false,
|
||||
});
|
||||
|
||||
const mountConfig = (config, featureEnabled) => shallowMount(UpgradeConfig, {
|
||||
props: {
|
||||
mode: 'edit',
|
||||
value: { default: DEFAULT, value: config ? JSON.stringify(config) : '' },
|
||||
},
|
||||
global: {
|
||||
mocks: {
|
||||
$store: {
|
||||
dispatch: jest.fn(),
|
||||
getters: {
|
||||
currentProduct: { inStore: 'harvester' },
|
||||
'harvester/all': () => [],
|
||||
'i18n/t': (key) => key,
|
||||
'harvester-common/getFeatureEnabled': (name) => name === 'shutdownVMOnMigrationFailure' && featureEnabled,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const savedValue = (wrapper) => JSON.parse(wrapper.props('value').value);
|
||||
|
||||
describe('component: upgrade-config', () => {
|
||||
it('should default shutdownVMOnMigrationFailure to false when the field is missing', () => {
|
||||
const wrapper = mountConfig(undefined, true);
|
||||
|
||||
expect(savedValue(wrapper).shutdownVMOnMigrationFailure).toBe(false);
|
||||
expect(wrapper.findComponent('[name="shutdownVMOnMigrationFailure"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('should keep an enabled shutdownVMOnMigrationFailure', () => {
|
||||
const wrapper = mountConfig({ shutdownVMOnMigrationFailure: true }, true);
|
||||
|
||||
expect(savedValue(wrapper).shutdownVMOnMigrationFailure).toBe(true);
|
||||
});
|
||||
|
||||
it('should save the value selected in its radio group', async() => {
|
||||
const wrapper = mountConfig(undefined, true);
|
||||
|
||||
await wrapper.findComponent('[name="shutdownVMOnMigrationFailure"]').vm.$emit('update:value', true);
|
||||
|
||||
expect(savedValue(wrapper).shutdownVMOnMigrationFailure).toBe(true);
|
||||
expect(savedValue(wrapper).restoreVM).toBe(false);
|
||||
|
||||
await wrapper.findComponent('[name="restoreVM"]').vm.$emit('update:value', true);
|
||||
|
||||
expect(savedValue(wrapper).shutdownVMOnMigrationFailure).toBe(true);
|
||||
expect(savedValue(wrapper).restoreVM).toBe(true);
|
||||
});
|
||||
|
||||
it('should name the radio groups for screen readers', () => {
|
||||
const wrapper = mountConfig(undefined, true);
|
||||
|
||||
expect(wrapper.findComponent('[name="restoreVM"]').attributes('aria-label')).toBe('harvester.setting.upgrade.restoreVM');
|
||||
expect(wrapper.findComponent('[name="shutdownVMOnMigrationFailure"]').attributes('aria-label')).toBe('harvester.setting.upgrade.shutdownVMOnMigrationFailure');
|
||||
});
|
||||
|
||||
it('should hide the control and not add the field on clusters without the feature', () => {
|
||||
const wrapper = mountConfig(undefined, false);
|
||||
|
||||
expect(savedValue(wrapper)).not.toHaveProperty('shutdownVMOnMigrationFailure');
|
||||
expect(wrapper.findComponent('[name="shutdownVMOnMigrationFailure"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('should keep a field set outside the UI on clusters without the feature', () => {
|
||||
const wrapper = mountConfig({ shutdownVMOnMigrationFailure: true }, false);
|
||||
|
||||
expect(savedValue(wrapper).shutdownVMOnMigrationFailure).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -74,10 +74,6 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
// A method, as normalizeValue also runs in data(), before computed properties are available
|
||||
shutdownVMOnMigrationFailureEnabled() {
|
||||
return this.$store.getters['harvester-common/getFeatureEnabled']('shutdownVMOnMigrationFailure');
|
||||
},
|
||||
normalizeValue(obj) {
|
||||
// handle nodeUpgradeOption.strategy
|
||||
if (obj?.nodeUpgradeOption?.strategy?.mode === 'auto') {
|
||||
@@ -111,9 +107,6 @@ export default {
|
||||
if (typeof obj.restoreVM !== 'boolean') {
|
||||
obj.restoreVM = false;
|
||||
}
|
||||
if (this.shutdownVMOnMigrationFailureEnabled() && typeof obj.shutdownVMOnMigrationFailure !== 'boolean') {
|
||||
obj.shutdownVMOnMigrationFailure = false;
|
||||
}
|
||||
|
||||
return obj;
|
||||
},
|
||||
@@ -186,24 +179,10 @@ export default {
|
||||
v-model:value="parseDefaultValue.restoreVM"
|
||||
class="mb-20"
|
||||
name="restoreVM"
|
||||
:aria-label="t('harvester.setting.upgrade.restoreVM')"
|
||||
:options="[true, false]"
|
||||
:labels="[t('generic.enabled'), t('generic.disabled')]"
|
||||
@update:value="update"
|
||||
/>
|
||||
<div v-if="shutdownVMOnMigrationFailureEnabled()">
|
||||
<label class="mb-5"><b>{{ t('harvester.setting.upgrade.shutdownVMOnMigrationFailure') }}</b></label>
|
||||
<RadioGroup
|
||||
v-model:value="parseDefaultValue.shutdownVMOnMigrationFailure"
|
||||
class="mb-20"
|
||||
name="shutdownVMOnMigrationFailure"
|
||||
:aria-label="t('harvester.setting.upgrade.shutdownVMOnMigrationFailure')"
|
||||
:mode="mode"
|
||||
:options="[true, false]"
|
||||
:labels="[t('generic.enabled'), t('generic.disabled')]"
|
||||
@update:value="update"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="resumeUpgradePausedNodeEnabled">
|
||||
<label class="mb-5"><b>{{ t('harvester.setting.upgrade.nodeUpgradeOption') }}</b></label>
|
||||
<LabeledSelect
|
||||
|
||||
@@ -86,8 +86,6 @@ const FEATURE_FLAGS = {
|
||||
'maintenanceModeConditions',
|
||||
'maintenanceModeDrainTimeoutSetting',
|
||||
'componentHealth',
|
||||
'repositoryStorageClass',
|
||||
'shutdownVMOnMigrationFailure',
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -662,7 +662,7 @@ export function init($plugin, store) {
|
||||
);
|
||||
|
||||
basicType(
|
||||
[HCI.VPC_NAT_GATEWAY, HCI.VPC_EGRESS_GATEWAY],
|
||||
[HCI.VPC_NAT_GATEWAY],
|
||||
GATEWAYS_GROUP
|
||||
);
|
||||
|
||||
@@ -853,52 +853,6 @@ export function init($plugin, store) {
|
||||
ifHaveType: HCI.VPC_NAT_GATEWAY,
|
||||
});
|
||||
|
||||
configureType(HCI.VPC_EGRESS_GATEWAY, { hiddenNamespaceGroupButton: true, canYaml: false });
|
||||
|
||||
headers(HCI.VPC_EGRESS_GATEWAY, [
|
||||
STATE,
|
||||
NAME_COL,
|
||||
NAMESPACE_COL,
|
||||
{
|
||||
name: 'vpc',
|
||||
labelKey: 'harvester.egressGateway.vpc.label',
|
||||
value: 'spec.vpc',
|
||||
sort: ['spec.vpc'],
|
||||
},
|
||||
{
|
||||
name: 'replicas',
|
||||
labelKey: 'harvester.egressGateway.replicas.label',
|
||||
value: 'spec.replicas',
|
||||
sort: ['spec.replicas'],
|
||||
},
|
||||
{
|
||||
name: 'externalSubnet',
|
||||
labelKey: 'harvester.egressGateway.externalSubnet.label',
|
||||
value: 'spec.externalSubnet',
|
||||
sort: ['spec.externalSubnet'],
|
||||
},
|
||||
{
|
||||
name: 'externalIPs',
|
||||
labelKey: 'harvester.egressGateway.ips.external.label',
|
||||
value: 'status.externalIPs',
|
||||
formatter: 'List',
|
||||
},
|
||||
AGE
|
||||
]);
|
||||
|
||||
virtualType({
|
||||
labelKey: 'harvester.egressGateway.label',
|
||||
name: HCI.VPC_EGRESS_GATEWAY,
|
||||
namespaced: true,
|
||||
weight: 193,
|
||||
route: {
|
||||
name: `${ PRODUCT_NAME }-c-cluster-resource`,
|
||||
params: { resource: HCI.VPC_EGRESS_GATEWAY }
|
||||
},
|
||||
exact: false,
|
||||
ifHaveType: HCI.VPC_EGRESS_GATEWAY,
|
||||
});
|
||||
|
||||
configureType(HCI.IPTABLES_EIP, { hiddenNamespaceGroupButton: true, canYaml: false });
|
||||
|
||||
virtualType({
|
||||
|
||||
@@ -47,7 +47,6 @@ export const HCI = {
|
||||
OS_UPGRADE_IMAGE: 'harvesterhci.io/os-upgrade-image',
|
||||
LATEST_UPGRADE: 'harvesterhci.io/latestUpgrade',
|
||||
UPGRADE_STATE: 'harvesterhci.io/upgradeState',
|
||||
UPGRADE_STORAGE_CLASS: 'harvesterhci.io/upgrade-storage-class',
|
||||
REAY_MESSAGE: 'harvesterhci.io/read-message',
|
||||
DYNAMIC_SSHKEYS_NAMES: 'harvesterhci.io/dynamic-ssh-key-names',
|
||||
DYNAMIC_SSHKEYS_USERS: 'harvesterhci.io/dynamic-ssh-key-users',
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
import EditVPC from '../kubeovn.io.vpc/index.vue';
|
||||
|
||||
const { validateBfdPort, bfdPortIPError, applyBfdPort } = EditVPC.methods;
|
||||
const { validationPassed, gatewaysNeedingBfdPort } = EditVPC.computed;
|
||||
|
||||
const t = (key) => key;
|
||||
|
||||
function createContext(form = {}, spec = {}, model = {}) {
|
||||
const value = {
|
||||
metadata: { name: 'commonvpc' }, spec, subnetResources: [], bfdEgressGateways: [], ...model
|
||||
};
|
||||
|
||||
return {
|
||||
t,
|
||||
value,
|
||||
...EditVPC.data.call({ value }),
|
||||
bfdPortIPError,
|
||||
...form,
|
||||
};
|
||||
}
|
||||
|
||||
describe('edit: kubeovn.io.vpc', () => {
|
||||
it('should load the BFD port of an existing VPC', () => {
|
||||
const context = createContext({}, { bfdPort: { enabled: true, ip: '10.255.255.255' } });
|
||||
|
||||
expect(context.bfdPortEnabled).toBe(true);
|
||||
expect(context.bfdPortIP).toBe('10.255.255.255');
|
||||
});
|
||||
|
||||
it('should not add a BFD port to a VPC that has none while it stays disabled', () => {
|
||||
const context = createContext({}, { staticRoutes: [] });
|
||||
|
||||
expect(validateBfdPort.call(context)).toStrictEqual([]);
|
||||
applyBfdPort.call(context);
|
||||
|
||||
expect(context.value.spec).toStrictEqual({ staticRoutes: [] });
|
||||
});
|
||||
|
||||
it('should enable the BFD port with its IP and keep its node selector', () => {
|
||||
const nodeSelector = { matchLabels: { 'kubernetes.io/os': 'linux' } };
|
||||
const context = createContext({ bfdPortEnabled: true, bfdPortIP: ' 10.255.255.255 , fd00::ffff ' }, { bfdPort: { enabled: false, nodeSelector } });
|
||||
|
||||
expect(validateBfdPort.call(context)).toStrictEqual([]);
|
||||
applyBfdPort.call(context);
|
||||
|
||||
expect(context.value.spec.bfdPort).toStrictEqual({
|
||||
enabled: true, ip: '10.255.255.255,fd00::ffff', nodeSelector
|
||||
});
|
||||
});
|
||||
|
||||
it('should keep the IP when the BFD port is disabled', () => {
|
||||
const context = createContext({ bfdPortEnabled: false }, { bfdPort: { enabled: true, ip: '10.255.255.255' } });
|
||||
|
||||
applyBfdPort.call(context);
|
||||
|
||||
expect(context.value.spec.bfdPort).toStrictEqual({ enabled: false, ip: '10.255.255.255' });
|
||||
});
|
||||
|
||||
it('should reject a BFD port IP inside one of the VPC subnets', () => {
|
||||
const subnet = {
|
||||
id: 'subnetinternal', spec: { cidrBlock: '172.20.10.0/24' }, containsIP: (ip) => ip.startsWith('172.20.10.')
|
||||
};
|
||||
const context = createContext({ bfdPortEnabled: true, bfdPortIP: '172.20.10.200' }, {}, { subnetResources: [subnet] });
|
||||
const errors = validateBfdPort.call(context);
|
||||
|
||||
expect(errors).toHaveLength(1);
|
||||
expect(errors[0]).toContain('harvester.vpc.bfdPort.validation.subnet');
|
||||
});
|
||||
|
||||
it.each([
|
||||
['a name and a valid BFD port', {}, true],
|
||||
['no name', { value: { metadata: {} } }, false],
|
||||
['an invalid BFD port', { bfdPortErrors: ['error'] }, false],
|
||||
])('should allow the save with %s', (_, form, passed) => {
|
||||
expect(validationPassed.call({
|
||||
value: { metadata: { name: 'commonvpc' } }, bfdPortErrors: [], ...form
|
||||
})).toBe(passed);
|
||||
});
|
||||
|
||||
it('should list the gateways that need the BFD port only while it is disabled', () => {
|
||||
const bfdEgressGateways = [{ id: 'default/gateway1' }];
|
||||
|
||||
expect(gatewaysNeedingBfdPort.call({ bfdPortEnabled: false, value: { bfdEgressGateways } })).toStrictEqual(bfdEgressGateways);
|
||||
expect(gatewaysNeedingBfdPort.call({ bfdPortEnabled: true, value: { bfdEgressGateways } })).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['no IP', '', 'validation.required'],
|
||||
['an invalid IP', '10.255.255.256', 'harvester.vpc.bfdPort.validation.ip'],
|
||||
['a CIDR', '10.255.255.255/32', 'harvester.vpc.bfdPort.validation.ip'],
|
||||
['two IPv4 addresses', '10.255.255.254,10.255.255.255', 'harvester.vpc.bfdPort.validation.ip'],
|
||||
['three addresses', '10.255.255.255,fd00::1,fd00::2', 'harvester.vpc.bfdPort.validation.ip'],
|
||||
])('should reject an enabled BFD port with %s', (_, bfdPortIP, errorKey) => {
|
||||
const errors = validateBfdPort.call(createContext({ bfdPortEnabled: true, bfdPortIP }));
|
||||
|
||||
expect(errors).toHaveLength(1);
|
||||
expect(errors[0]).toContain(errorKey);
|
||||
});
|
||||
});
|
||||
@@ -1,452 +0,0 @@
|
||||
import EditVpcEgressGateway from '../kubeovn.io.vpcegressgateway.vue';
|
||||
|
||||
const {
|
||||
validate, validateTabs, ipError, ipCountError, policyError, policiesSpec, toSpec, bfdSpec, saveGateway
|
||||
} = EditVpcEgressGateway.methods;
|
||||
const { vpc: onVpcChange, externalNetworkMode: onExternalNetworkModeChange } = EditVpcEgressGateway.watch;
|
||||
const {
|
||||
showExternalNetworkMode, vpcBfdPortDisabled, vpcEditLocation, internalSubnetOptions, externalSubnetOptions, externalSubnetRules, internalSubnetPlaceholder, snatSubnetOptions, noSnatSubnetOptions, policySubnetsPlaceholder
|
||||
} = EditVpcEgressGateway.computed;
|
||||
const { requiredError } = EditVpcEgressGateway.methods;
|
||||
|
||||
const t = (key, args) => (args ? `${ key } ${ JSON.stringify(args) }` : key);
|
||||
|
||||
function createContext(form = {}, spec = {}) {
|
||||
const value = { metadata: { name: 'gateway1', namespace: 'default' }, spec };
|
||||
|
||||
const context = {
|
||||
t,
|
||||
value,
|
||||
...EditVpcEgressGateway.data.call({ value }),
|
||||
vpc: 'commonvpc',
|
||||
replicas: 2,
|
||||
internalSubnet: 'subnetinternal',
|
||||
externalSubnet: 'subnetexternal',
|
||||
snatSubnets: ['subnetinternal'],
|
||||
...form,
|
||||
};
|
||||
|
||||
Object.assign(context, {
|
||||
bfdSpec, validateTabs, ipError, ipCountError, policyError, policiesSpec
|
||||
});
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
// A subnet as the store returns it, with the model getters the form reads
|
||||
function subnet(id, spec, model = {}) {
|
||||
return {
|
||||
id, spec, isOverlayAttachment: false, networkAttachment: null, canAssignIP: () => true, ...model
|
||||
};
|
||||
}
|
||||
|
||||
describe('edit: kubeovn.io.vpcegressgateway', () => {
|
||||
it('should start a new gateway with one replica, no subnets and BFD off', () => {
|
||||
const data = EditVpcEgressGateway.data.call({ value: { metadata: {} } });
|
||||
|
||||
expect(data.replicas).toBe(1);
|
||||
expect([data.snatSubnets, data.noSnatSubnets, data.ipBlockPolicies]).toStrictEqual([[], [], []]);
|
||||
expect(data.bfd).toStrictEqual({
|
||||
enabled: false, minRX: 1000, minTX: 1000, multiplier: 3
|
||||
});
|
||||
});
|
||||
|
||||
it('should build the spec from the form and leave out empty optional fields', () => {
|
||||
const spec = toSpec.call(createContext());
|
||||
|
||||
expect(spec).toStrictEqual({
|
||||
vpc: 'commonvpc',
|
||||
replicas: 2,
|
||||
internalSubnet: 'subnetinternal',
|
||||
externalSubnet: 'subnetexternal',
|
||||
policies: [{ snat: true, subnets: ['subnetinternal'] }],
|
||||
bfd: {
|
||||
enabled: false, minRX: 1000, minTX: 1000, multiplier: 3
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should build the spec with IPs, BFD and bandwidth', () => {
|
||||
const spec = toSpec.call(createContext({
|
||||
internalIPs: ['172.20.10.41', ' 172.20.10.51 ', ''],
|
||||
externalIPs: ['10.115.48.220', '10.115.48.221'],
|
||||
bfd: {
|
||||
enabled: true, minRX: '50', minTX: 50, multiplier: 3
|
||||
},
|
||||
bandwidthIngress: 10,
|
||||
bandwidthEgress: null,
|
||||
}));
|
||||
|
||||
expect(spec.internalIPs).toStrictEqual(['172.20.10.41', '172.20.10.51']);
|
||||
expect(spec.externalIPs).toStrictEqual(['10.115.48.220', '10.115.48.221']);
|
||||
expect(spec.bfd).toStrictEqual({
|
||||
enabled: true, minRX: 50, minTX: 50, multiplier: 3
|
||||
});
|
||||
expect(spec.bandwidth).toStrictEqual({ ingress: 10 });
|
||||
});
|
||||
|
||||
it('should keep a bandwidth quantity as a string and a whole number as Mbps', () => {
|
||||
const context = createContext({ bandwidthIngress: ' 1Gi ', bandwidthEgress: '100' });
|
||||
|
||||
expect(validate.call(context)).toStrictEqual([]);
|
||||
expect(toSpec.call(context).bandwidth).toStrictEqual({ ingress: '1Gi', egress: 100 });
|
||||
});
|
||||
|
||||
it('should send the BFD defaults for intervals cleared while BFD is off', () => {
|
||||
const context = createContext({
|
||||
bfd: {
|
||||
enabled: false, minRX: '', minTX: 50, multiplier: null
|
||||
}
|
||||
});
|
||||
|
||||
expect(validate.call(context)).toStrictEqual([]);
|
||||
expect(toSpec.call(context).bfd).toStrictEqual({
|
||||
enabled: false, minRX: 1000, minTX: 50, multiplier: 3
|
||||
});
|
||||
});
|
||||
|
||||
it('should list only the subnets of the VPC that sit on a virtual machine network as internal subnets', () => {
|
||||
const vpcSubnets = [
|
||||
subnet('ovn-default', { vpc: 'ovn-cluster', provider: 'ovn' }),
|
||||
subnet('subnetinternal', { vpc: 'commonvpc', provider: 'vmnet.default.ovn' }, { isOverlayAttachment: true }),
|
||||
];
|
||||
|
||||
expect(internalSubnetOptions.call({ vpcSubnets })).toStrictEqual([{ label: 'subnetinternal', value: 'subnetinternal' }]);
|
||||
});
|
||||
|
||||
it('should list only the subnets attached to a network as external subnets', () => {
|
||||
const allSubnets = [
|
||||
subnet('join', { vpc: 'ovn-cluster', provider: 'ovn' }),
|
||||
subnet('subnetexternal', { vpc: 'commonvpc', provider: 'extnet.default' }, { networkAttachment: { name: 'extnet', namespace: 'default' } }),
|
||||
];
|
||||
|
||||
expect(externalSubnetOptions.call({ allSubnets })).toStrictEqual([{ label: 'subnetexternal', value: 'subnetexternal' }]);
|
||||
});
|
||||
|
||||
it('should check the IPs against the subnet they belong to', () => {
|
||||
const internalSubnetResource = subnet('subnetinternal', { cidrBlock: '172.20.10.0/24' }, { canAssignIP: (ip) => ip.startsWith('172.20.10.') });
|
||||
const errors = validate.call(createContext({ internalSubnetResource, internalIPs: ['172.20.10.41', '10.0.0.1'] }));
|
||||
|
||||
expect(errors).toHaveLength(1);
|
||||
expect(errors[0]).toContain('harvester.egressGateway.validation.ipSubnet');
|
||||
expect(errors[0]).toContain('172.20.10.0/24');
|
||||
});
|
||||
|
||||
it('should put each error on the tab that holds the field', () => {
|
||||
const errors = validateTabs.call(createContext({
|
||||
replicas: 11,
|
||||
snatSubnets: [],
|
||||
externalIPs: ['10.115.48.300'],
|
||||
bfd: {
|
||||
enabled: true, minRX: 0, minTX: 50, multiplier: 3
|
||||
},
|
||||
bandwidthIngress: '10Mbps',
|
||||
}));
|
||||
|
||||
expect(Object.fromEntries(Object.entries(errors).map(([tab, messages]) => [tab, messages.length]))).toStrictEqual({
|
||||
basic: 1, policies: 1, ips: 1, bfd: 1, bandwidth: 1
|
||||
});
|
||||
expect(errors.policies[0]).toContain('harvester.egressGateway.validation.policyRequired');
|
||||
});
|
||||
|
||||
it.each([
|
||||
['empty', '', 'validation.required'],
|
||||
['the internal subnet', 'subnetinternal', 'harvester.egressGateway.validation.sameSubnet'],
|
||||
])('should explain an external subnet that is %s', (_, value, errorKey) => {
|
||||
const [rule] = externalSubnetRules.call(createContext({ requiredError }));
|
||||
|
||||
expect(rule(value)).toContain(errorKey);
|
||||
});
|
||||
|
||||
it('should accept an external subnet other than the internal one', () => {
|
||||
const [rule] = externalSubnetRules.call(createContext({ requiredError }));
|
||||
|
||||
expect(rule('subnetexternal')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should ask for a VPC before the internal subnet', () => {
|
||||
expect(internalSubnetPlaceholder.call({
|
||||
t: (key) => key, vpc: '', internalSubnetOptions: []
|
||||
})).toBe('harvester.egressGateway.internalSubnet.noVpc');
|
||||
});
|
||||
|
||||
it('should say when the VPC has no subnet on a virtual machine network', () => {
|
||||
const t = (key, args) => (args ? `${ key } ${ args.vpc }` : key);
|
||||
|
||||
expect(internalSubnetPlaceholder.call({
|
||||
t, vpc: 'ovn-cluster', internalSubnetOptions: []
|
||||
})).toBe('harvester.egressGateway.internalSubnet.none ovn-cluster');
|
||||
expect(internalSubnetPlaceholder.call({
|
||||
t, vpc: 'commonvpc', internalSubnetOptions: [{ value: 'subnetinternal' }]
|
||||
})).toBe('harvester.egressGateway.internalSubnet.placeholder');
|
||||
});
|
||||
|
||||
it('should leave an empty IP row to the save, which drops it', () => {
|
||||
expect(ipError.call(createContext(), 'internalIPs', ' ')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should read the policies as Kube-OVN applies them', () => {
|
||||
const data = EditVpcEgressGateway.data.call({
|
||||
value: {
|
||||
spec: {
|
||||
policies: [
|
||||
{ snat: true, subnets: ['a', 'b'] },
|
||||
{ snat: true, subnets: ['c', 'a'] },
|
||||
{ snat: false, subnets: ['b', 'd'] },
|
||||
{ snat: false, ipBlocks: ['10.0.0.0/24'] },
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
expect(data.snatSubnets).toStrictEqual(['a', 'c']);
|
||||
expect(data.noSnatSubnets).toStrictEqual(['b', 'd']);
|
||||
expect(data.ipBlockPolicies).toStrictEqual([{ snat: false, ipBlocks: ['10.0.0.0/24'] }]);
|
||||
});
|
||||
|
||||
it('should write one policy for each group and keep the IP block policies', () => {
|
||||
const context = createContext({
|
||||
snatSubnets: ['a', 'c'], noSnatSubnets: ['b'], ipBlockPolicies: [{ snat: true, ipBlocks: ['10.0.0.0/24'] }]
|
||||
});
|
||||
|
||||
expect(policiesSpec.call(context)).toStrictEqual([
|
||||
{ snat: true, subnets: ['a', 'c'] },
|
||||
{ snat: false, subnets: ['b'] },
|
||||
{ snat: true, ipBlocks: ['10.0.0.0/24'] },
|
||||
]);
|
||||
});
|
||||
|
||||
it('should leave out a group without subnets', () => {
|
||||
expect(policiesSpec.call(createContext({ snatSubnets: [], noSnatSubnets: ['b'] }))).toStrictEqual([{ snat: false, subnets: ['b'] }]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['no VPC is chosen', '', [], 'harvester.egressGateway.policies.noVpc'],
|
||||
['the VPC has no subnets', 'emptyvpc', [], 'harvester.egressGateway.policies.noSubnets emptyvpc'],
|
||||
['the VPC has subnets', 'commonvpc', [{ value: 'a' }], 'harvester.egressGateway.policies.placeholder'],
|
||||
])('should explain the policy lists when %s', (_, vpc, vpcSubnetOptions, placeholder) => {
|
||||
const t = (key, args) => (args ? `${ key } ${ args.vpc }` : key);
|
||||
|
||||
expect(policySubnetsPlaceholder.call({
|
||||
t, vpc, vpcSubnetOptions
|
||||
})).toBe(placeholder);
|
||||
});
|
||||
|
||||
it('should not offer a subnet of one group in the other, nor the external subnet', () => {
|
||||
const vpcSubnetOptions = ['a', 'b', 'c', 'ext'].map((value) => ({ label: value, value }));
|
||||
const context = {
|
||||
vpcSubnetOptions, snatSubnets: ['a'], noSnatSubnets: ['b'], externalSubnet: 'ext'
|
||||
};
|
||||
|
||||
expect(snatSubnetOptions.call(context).map((option) => option.value)).toStrictEqual(['a', 'c']);
|
||||
expect(noSnatSubnetOptions.call(context).map((option) => option.value)).toStrictEqual(['b', 'c']);
|
||||
});
|
||||
|
||||
it('should reject the external subnet as a policy source', () => {
|
||||
const error = policyError.call(createContext({ snatSubnets: ['subnetexternal'] }));
|
||||
|
||||
expect(error).toContain('harvester.egressGateway.validation.policyExternalSubnet');
|
||||
expect(error).toContain('subnetexternal');
|
||||
});
|
||||
|
||||
it.each([
|
||||
['subnets with SNAT', { snatSubnets: ['a'] }],
|
||||
['subnets without SNAT', { snatSubnets: [], noSnatSubnets: ['b'] }],
|
||||
['only IP blocks', { snatSubnets: [], ipBlockPolicies: [{ snat: false, ipBlocks: ['10.0.0.0/24'] }] }],
|
||||
])('should accept a gateway with %s', (_, form) => {
|
||||
expect(policyError.call(createContext(form))).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should stop the save when the form has errors', async() => {
|
||||
const buttonCb = jest.fn();
|
||||
const context = createContext({
|
||||
vpc: '', validate, save: jest.fn()
|
||||
});
|
||||
|
||||
await saveGateway.call(context, buttonCb);
|
||||
|
||||
expect(buttonCb).toHaveBeenCalledWith(false);
|
||||
expect(context.save).not.toHaveBeenCalled();
|
||||
expect(context.errors).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should save the spec built from the form', async() => {
|
||||
const buttonCb = jest.fn();
|
||||
const context = createContext({
|
||||
validate, toSpec, save: jest.fn()
|
||||
});
|
||||
|
||||
await saveGateway.call(context, buttonCb);
|
||||
|
||||
expect(context.save).toHaveBeenCalledWith(buttonCb);
|
||||
expect(context.value.spec.vpc).toBe('commonvpc');
|
||||
expect(context.value.spec.policies).toStrictEqual([{ snat: true, subnets: ['subnetinternal'] }]);
|
||||
});
|
||||
|
||||
it('should keep the fields the form does not show', () => {
|
||||
const existing = {
|
||||
trafficPolicy: 'Local',
|
||||
selectors: [{ namespaceSelector: { matchLabels: { app: 'web' } } }],
|
||||
policies: [{ snat: false, ipBlocks: ['10.0.0.0/24'] }],
|
||||
};
|
||||
const context = createContext({ snatSubnets: [] }, existing);
|
||||
const { snatSubnets, noSnatSubnets, ipBlockPolicies } = EditVpcEgressGateway.data.call({ value: context.value });
|
||||
|
||||
Object.assign(context, {
|
||||
snatSubnets, noSnatSubnets, ipBlockPolicies
|
||||
});
|
||||
|
||||
const spec = toSpec.call(context);
|
||||
|
||||
expect(spec.trafficPolicy).toBe('Local');
|
||||
expect(spec.selectors).toStrictEqual(existing.selectors);
|
||||
expect(spec.policies).toStrictEqual([{ snat: false, ipBlocks: ['10.0.0.0/24'] }]);
|
||||
expect(validate.call(context)).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['has', true],
|
||||
['does not have', false],
|
||||
])('should offer Primary CNI when the CRD %s externalNetworkMode', async(_, hasField) => {
|
||||
const schema = { fetchResourceFields: jest.fn().mockResolvedValue({}) };
|
||||
const getters = {
|
||||
currentProduct: { inStore: 'harvester' },
|
||||
'harvester/schemaFor': () => schema,
|
||||
'harvester/pathExistsInSchema': jest.fn(() => hasField),
|
||||
};
|
||||
const context = { $store: { getters, dispatch: jest.fn().mockResolvedValue([]) }, supportsPrimaryCNI: false };
|
||||
|
||||
await EditVpcEgressGateway.fetch.call(context);
|
||||
|
||||
expect(schema.fetchResourceFields).toHaveBeenCalledWith();
|
||||
expect(getters['harvester/pathExistsInSchema']).toHaveBeenCalledWith('kubeovn.io.vpcegressgateway', 'spec.externalNetworkMode');
|
||||
expect(context.supportsPrimaryCNI).toBe(hasField);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['a CRD with the mode', { supportsPrimaryCNI: true, usesPrimaryCNI: false }, true],
|
||||
['a CRD without the mode', { supportsPrimaryCNI: false, usesPrimaryCNI: false }, false],
|
||||
['an existing Primary CNI gateway', { supportsPrimaryCNI: false, usesPrimaryCNI: true }, true],
|
||||
])('should show the external network choice for %s', (_, context, shown) => {
|
||||
expect(showExternalNetworkMode.call(context)).toBe(shown);
|
||||
});
|
||||
|
||||
it('should start a new gateway on an external subnet and leave the mode to the CRD default', () => {
|
||||
const context = createContext();
|
||||
|
||||
expect(context.externalNetworkMode).toBe('Attachment');
|
||||
expect(toSpec.call(context)).not.toHaveProperty('externalNetworkMode');
|
||||
});
|
||||
|
||||
it('should write a PrimaryCNI gateway without an external subnet', () => {
|
||||
const spec = toSpec.call(createContext({ externalNetworkMode: 'PrimaryCNI', externalSubnet: '' }));
|
||||
|
||||
expect(spec.externalNetworkMode).toBe('PrimaryCNI');
|
||||
expect(spec).not.toHaveProperty('externalSubnet');
|
||||
expect(spec).not.toHaveProperty('externalIPs');
|
||||
expect(spec).not.toHaveProperty('bandwidth');
|
||||
});
|
||||
|
||||
it('should clear the external fields when PrimaryCNI is chosen', () => {
|
||||
const context = createContext({
|
||||
externalIPs: ['10.115.48.220'], bandwidthIngress: 10, bandwidthEgress: '1Gi'
|
||||
});
|
||||
|
||||
onExternalNetworkModeChange.call(context, 'PrimaryCNI');
|
||||
|
||||
expect([context.externalSubnet, context.externalIPs, context.bandwidthIngress, context.bandwidthEgress]).toStrictEqual(['', [], '', '']);
|
||||
});
|
||||
|
||||
it('should save a PrimaryCNI gateway made outside the form', () => {
|
||||
const existing = {
|
||||
vpc: 'commonvpc',
|
||||
replicas: 1,
|
||||
externalNetworkMode: 'PrimaryCNI',
|
||||
internalSubnet: 'subnetinternal',
|
||||
policies: [{ snat: true, subnets: ['subnetinternal'] }],
|
||||
};
|
||||
const value = { metadata: { name: 'gateway1', namespace: 'default' }, spec: existing };
|
||||
const context = createContext(EditVpcEgressGateway.data.call({ value }), existing);
|
||||
|
||||
expect(context.externalNetworkMode).toBe('PrimaryCNI');
|
||||
expect(validate.call(context)).toStrictEqual([]);
|
||||
expect(toSpec.call(context)).toStrictEqual({
|
||||
...existing,
|
||||
bfd: {
|
||||
enabled: false, minRX: 1000, minTX: 1000, multiplier: 3
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should accept a complete form', () => {
|
||||
expect(validate.call(createContext())).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['no VPC', { vpc: '' }, 'validation.required'],
|
||||
['no internal subnet', { internalSubnet: '' }, 'validation.required'],
|
||||
['no external subnet', { externalSubnet: '' }, 'validation.required'],
|
||||
['the same internal and external subnet', { externalSubnet: 'subnetinternal', snatSubnets: ['subnetother'] }, 'harvester.egressGateway.validation.sameSubnet'],
|
||||
['too many replicas', { replicas: 11 }, 'harvester.egressGateway.validation.replicas'],
|
||||
['no subnet with or without SNAT', { snatSubnets: [] }, 'harvester.egressGateway.validation.policyRequired'],
|
||||
['an invalid IP', { externalIPs: ['10.115.48.300', '10.115.48.221'] }, 'harvester.egressGateway.validation.ipList'],
|
||||
['fewer IPs than replicas', { internalIPs: ['172.20.10.41'] }, 'harvester.egressGateway.validation.ipCount'],
|
||||
['a repeated IP', { externalIPs: ['10.115.48.220', ' 10.115.48.220'] }, 'harvester.egressGateway.validation.ipDuplicate'],
|
||||
['a BFD interval of 0', {
|
||||
bfd: {
|
||||
enabled: true, minRX: 0, minTX: 50, multiplier: 3
|
||||
}
|
||||
}, 'harvester.egressGateway.validation.bfd'],
|
||||
['a BFD multiplier of 0', {
|
||||
bfd: {
|
||||
enabled: true, minRX: 50, minTX: 50, multiplier: 0
|
||||
}
|
||||
}, 'harvester.egressGateway.validation.bfdMultiplier'],
|
||||
['a negative bandwidth', { bandwidthEgress: -1 }, 'harvester.egressGateway.validation.bandwidth'],
|
||||
['a bandwidth with an unknown unit', { bandwidthEgress: '10Mbps' }, 'harvester.egressGateway.validation.bandwidth'],
|
||||
])('should reject %s', (_, form, errorKey) => {
|
||||
const errors = validate.call(createContext(form));
|
||||
|
||||
expect(errors).toHaveLength(1);
|
||||
expect(errors[0]).toContain(errorKey);
|
||||
});
|
||||
|
||||
it('should drop the subnets of the previous VPC when the VPC changes', () => {
|
||||
const context = createContext({
|
||||
vpc: 'othervpc',
|
||||
internalSubnet: 'subnetinternal',
|
||||
snatSubnets: ['subnetinternal', 'othersubnet'],
|
||||
noSnatSubnets: ['subnetinternal'],
|
||||
vpcSubnetOptions: [{ label: 'othersubnet', value: 'othersubnet' }],
|
||||
internalSubnetOptions: [{ label: 'othersubnet', value: 'othersubnet' }],
|
||||
});
|
||||
|
||||
onVpcChange.call(context, 'othervpc', 'commonvpc');
|
||||
|
||||
expect(context.internalSubnet).toBe('');
|
||||
expect(context.snatSubnets).toStrictEqual(['othersubnet']);
|
||||
expect(context.noSnatSubnets).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['has no BFD port', { bfdPortEnabled: false }, true],
|
||||
['has a BFD port', { bfdPortEnabled: true }, false],
|
||||
])('should warn about BFD when the selected VPC %s', (_, selectedVpc, warning) => {
|
||||
expect(vpcBfdPortDisabled.call({ selectedVpc })).toBe(warning);
|
||||
});
|
||||
|
||||
it('should not warn about BFD before a VPC is selected', () => {
|
||||
expect(vpcBfdPortDisabled.call({ selectedVpc: null })).toBe(false);
|
||||
});
|
||||
|
||||
it('should link the BFD warning to the BFD Port tab of the selected VPC', () => {
|
||||
const selectedVpc = { detailLocation: { name: 'harvester-c-cluster-resource-id', params: { resource: 'kubeovn.io.vpc', id: 'commonvpc' } } };
|
||||
|
||||
expect(vpcEditLocation.call({ selectedVpc })).toStrictEqual({
|
||||
name: 'harvester-c-cluster-resource-id',
|
||||
params: { resource: 'kubeovn.io.vpc', id: 'commonvpc' },
|
||||
query: { mode: 'edit' },
|
||||
hash: '#bfdPort',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -5,17 +5,9 @@ import Tab from '@shell/components/Tabbed/Tab';
|
||||
import Loading from '@shell/components/Loading';
|
||||
import CreateEditView from '@shell/mixins/create-edit-view';
|
||||
import ResourceTabs from '@shell/components/form/ResourceTabs/index';
|
||||
import { LabeledInput } from '@components/Form/LabeledInput';
|
||||
import { RadioGroup } from '@components/Form/Radio';
|
||||
import { Banner } from '@components/Banner';
|
||||
import StaticRoutes from './StaticRoutes';
|
||||
import VpcPeerings from './VpcPeerings';
|
||||
import { set } from '@shell/utils/object';
|
||||
import { allHash } from '@shell/utils/promise';
|
||||
import { isValidIP } from '@shell/utils/validators/cidr';
|
||||
import { HCI } from '../../types';
|
||||
|
||||
const splitIPs = (value) => `${ value || '' }`.split(',').map((ip) => ip.trim()).filter(Boolean);
|
||||
|
||||
export default {
|
||||
name: 'EditVPC',
|
||||
@@ -23,11 +15,8 @@ export default {
|
||||
emits: ['update:value'],
|
||||
|
||||
components: {
|
||||
Banner,
|
||||
CruResource,
|
||||
LabeledInput,
|
||||
NameNsDescription,
|
||||
RadioGroup,
|
||||
Tab,
|
||||
StaticRoutes,
|
||||
ResourceTabs,
|
||||
@@ -39,106 +28,16 @@ export default {
|
||||
|
||||
inheritAttrs: false,
|
||||
|
||||
async fetch() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
const hasEgressGateways = !!this.$store.getters[`${ inStore }/schemaFor`](HCI.VPC_EGRESS_GATEWAY);
|
||||
|
||||
await allHash({
|
||||
subnets: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.SUBNET }),
|
||||
gateways: hasEgressGateways ? this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.VPC_EGRESS_GATEWAY }) : [],
|
||||
});
|
||||
},
|
||||
|
||||
data() {
|
||||
set(this.value, 'spec', this.value.spec || {
|
||||
staticRoutes: [],
|
||||
vpcPeerings: [],
|
||||
});
|
||||
|
||||
const bfdPort = this.value.spec.bfdPort || {};
|
||||
|
||||
return {
|
||||
staticRoutes: [],
|
||||
bfdPortEnabled: bfdPort.enabled === true,
|
||||
bfdPortIP: bfdPort.ip || '',
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
bfdPortErrors() {
|
||||
return this.isView ? [] : this.validateBfdPort();
|
||||
},
|
||||
|
||||
validationPassed() {
|
||||
return !!this.value?.metadata?.name && this.bfdPortErrors.length === 0;
|
||||
},
|
||||
|
||||
// Each field shows its own error once touched, so a disabled Save always has a visible reason
|
||||
nameRules() {
|
||||
return {
|
||||
name: [(value) => (value ? undefined : this.t('validation.required', { key: this.t('generic.name') }, true))], namespace: [], description: []
|
||||
};
|
||||
},
|
||||
|
||||
bfdPortIPRules() {
|
||||
return [(value) => this.bfdPortIPError(value)];
|
||||
},
|
||||
|
||||
gatewaysNeedingBfdPort() {
|
||||
return this.bfdPortEnabled ? [] : this.value.bfdEgressGateways || [];
|
||||
},
|
||||
return { staticRoutes: [] };
|
||||
},
|
||||
|
||||
methods: {
|
||||
bfdPortIPError(value) {
|
||||
if (!this.bfdPortEnabled) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const ips = splitIPs(value);
|
||||
const ipv6Count = ips.filter((ip) => ip.includes(':')).length;
|
||||
|
||||
if (!ips.length) {
|
||||
return this.t('validation.required', { key: this.t('harvester.vpc.bfdPort.ip.label') }, true);
|
||||
}
|
||||
|
||||
if (ips.length > 2 || ips.some((ip) => !isValidIP(ip)) || (ips.length === 2 && ipv6Count !== 1)) {
|
||||
return this.t('harvester.vpc.bfdPort.validation.ip', null, true);
|
||||
}
|
||||
|
||||
const subnet = (this.value.subnetResources || []).find((item) => ips.some((ip) => item.containsIP(ip)));
|
||||
|
||||
if (subnet) {
|
||||
return this.t('harvester.vpc.bfdPort.validation.subnet', { subnet: subnet.id, cidr: subnet.spec?.cidrBlock }, true);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
validateBfdPort() {
|
||||
return [this.bfdPortIPError(this.bfdPortIP)].filter(Boolean);
|
||||
},
|
||||
|
||||
applyBfdPort() {
|
||||
const current = this.value.spec.bfdPort;
|
||||
|
||||
if (!this.bfdPortEnabled && !current) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bfdPort = {
|
||||
...(current || {}),
|
||||
enabled: this.bfdPortEnabled,
|
||||
ip: splitIPs(this.bfdPortIP).join(','),
|
||||
};
|
||||
|
||||
if (!bfdPort.ip) {
|
||||
delete bfdPort.ip;
|
||||
}
|
||||
|
||||
this.value.spec.bfdPort = bfdPort;
|
||||
},
|
||||
|
||||
async saveVpc(buttonCb) {
|
||||
const errors = [];
|
||||
|
||||
@@ -149,15 +48,12 @@ export default {
|
||||
errors.push(this.t('validation.required', { key: this.t('generic.name') }, true));
|
||||
}
|
||||
|
||||
errors.push(...this.validateBfdPort());
|
||||
|
||||
if (errors.length > 0) {
|
||||
buttonCb(false);
|
||||
this.errors = errors;
|
||||
|
||||
return false;
|
||||
}
|
||||
this.applyBfdPort();
|
||||
await this.value.save();
|
||||
buttonCb(true);
|
||||
this.done();
|
||||
@@ -180,7 +76,6 @@ export default {
|
||||
:mode="mode"
|
||||
:apply-hooks="applyHooks"
|
||||
:errors="errors"
|
||||
:validation-passed="validationPassed"
|
||||
@finish="saveVpc"
|
||||
@error="e=>errors=e"
|
||||
>
|
||||
@@ -188,7 +83,6 @@ export default {
|
||||
:value="value"
|
||||
:mode="mode"
|
||||
:namespaced="false"
|
||||
:rules="nameRules"
|
||||
@update:value="$emit('update:value', $event)"
|
||||
/>
|
||||
<ResourceTabs
|
||||
@@ -221,50 +115,6 @@ export default {
|
||||
:vpc="value"
|
||||
/>
|
||||
</Tab>
|
||||
<Tab
|
||||
name="bfdPort"
|
||||
:label="t('harvester.vpc.bfdPort.label')"
|
||||
:weight="-3"
|
||||
:error="bfdPortErrors.length > 0"
|
||||
:error-icon-tooltip="bfdPortErrors.join(' ')"
|
||||
>
|
||||
<Banner
|
||||
color="info"
|
||||
:label="t('harvester.vpc.bfdPort.banner')"
|
||||
/>
|
||||
<RadioGroup
|
||||
v-model:value="bfdPortEnabled"
|
||||
name="bfdPort"
|
||||
data-testid="vpc-bfd-port-enabled"
|
||||
:options="[true, false]"
|
||||
:labels="[t('generic.enabled'), t('generic.disabled')]"
|
||||
:aria-label="t('harvester.vpc.bfdPort.label')"
|
||||
:mode="mode"
|
||||
/>
|
||||
<Banner
|
||||
v-if="gatewaysNeedingBfdPort.length"
|
||||
color="warning"
|
||||
data-testid="vpc-bfd-port-gateways"
|
||||
:label="t('harvester.vpc.bfdPort.gatewaysNeedPort', { gateways: gatewaysNeedingBfdPort.map((gateway) => gateway.id).join(', ') }, true)"
|
||||
/>
|
||||
<div
|
||||
v-if="bfdPortEnabled"
|
||||
class="row mt-20"
|
||||
>
|
||||
<div class="col span-6">
|
||||
<LabeledInput
|
||||
v-model:value="bfdPortIP"
|
||||
data-testid="vpc-bfd-port-ip"
|
||||
required
|
||||
:rules="bfdPortIPRules"
|
||||
:mode="mode"
|
||||
:label="t('harvester.vpc.bfdPort.ip.label')"
|
||||
:placeholder="t('harvester.vpc.bfdPort.ip.placeholder')"
|
||||
:tooltip="t('harvester.vpc.bfdPort.ip.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Tab>
|
||||
</ResourceTabs>
|
||||
</CruResource>
|
||||
</template>
|
||||
|
||||
@@ -1,864 +0,0 @@
|
||||
<script>
|
||||
import CruResource from '@shell/components/CruResource';
|
||||
import NameNsDescription from '@shell/components/form/NameNsDescription';
|
||||
import ResourceTabs from '@shell/components/form/ResourceTabs';
|
||||
import Tab from '@shell/components/Tabbed/Tab';
|
||||
import ArrayList from '@shell/components/form/ArrayList';
|
||||
import Loading from '@shell/components/Loading';
|
||||
import MessageLink from '@shell/components/MessageLink';
|
||||
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
||||
import UnitInput from '@shell/components/form/UnitInput';
|
||||
import { LabeledInput } from '@components/Form/LabeledInput';
|
||||
import { RadioGroup } from '@components/Form/Radio';
|
||||
import { Banner } from '@components/Banner';
|
||||
import CreateEditView from '@shell/mixins/create-edit-view';
|
||||
import { _EDIT, MODE } from '@shell/config/query-params';
|
||||
import { allHash } from '@shell/utils/promise';
|
||||
import { isValidIP } from '@shell/utils/validators/cidr';
|
||||
import { HCI } from '../types';
|
||||
|
||||
// Limits from the VpcEgressGateway CRD
|
||||
const MAX_REPLICAS = 10;
|
||||
const MAX_BFD_VALUE = 3600000;
|
||||
const MAX_BANDWIDTH_MBPS = 9223372036854;
|
||||
// A whole number in Mbps, or a quantity in bits per second such as 100M or 1Gi
|
||||
const BANDWIDTH_PATTERN = /^([0-9]+|([0-9]+(\.[0-9]+)?|\.[0-9]+)(M|Mi|G|Gi))$/;
|
||||
const IP_FIELDS = {
|
||||
internalIPs: { labelKey: 'harvester.egressGateway.ips.internal.label', subnet: 'internalSubnetResource' },
|
||||
externalIPs: { labelKey: 'harvester.egressGateway.ips.external.label', subnet: 'externalSubnetResource' },
|
||||
};
|
||||
const BFD_DEFAULTS = {
|
||||
enabled: false, minRX: 1000, minTX: 1000, multiplier: 3
|
||||
};
|
||||
// PrimaryCNI sends traffic out through the pod's primary network, so it takes no external subnet, external IPs or bandwidth
|
||||
const ATTACHMENT = 'Attachment';
|
||||
const PRIMARY_CNI = 'PrimaryCNI';
|
||||
|
||||
const isBlank = (value) => value === null || value === undefined || `${ value }`.trim() === '';
|
||||
const isWholeNumber = (value, min, max) => /^\d+$/.test(`${ value }`.trim()) && Number(value) >= min && Number(value) <= max;
|
||||
const isValidBandwidth = (value) => BANDWIDTH_PATTERN.test(`${ value }`.trim()) && (!isWholeNumber(value, 0, Infinity) || Number(value) <= MAX_BANDWIDTH_MBPS);
|
||||
const toBandwidth = (value) => (isWholeNumber(value, 0, Infinity) ? Number(value) : `${ value }`.trim());
|
||||
const cleanList = (list) => (list || []).map((item) => `${ item || '' }`.trim()).filter(Boolean);
|
||||
const isValidBfdValue = (value) => isWholeNumber(value, 1, MAX_BFD_VALUE);
|
||||
const unique = (list) => [...new Set(list)];
|
||||
|
||||
// Kube-OVN puts the sources of every policy into two sets, with SNAT and without, and leaves a source out of
|
||||
// SNAT when any policy has SNAT off for it. The form edits those two sets; IP blocks set outside it are kept.
|
||||
const policyGroups = (policies = []) => {
|
||||
const noSnatSubnets = unique(policies.filter((policy) => !policy.snat).flatMap((policy) => policy.subnets || []));
|
||||
const snatSubnets = unique(policies.filter((policy) => policy.snat).flatMap((policy) => policy.subnets || []))
|
||||
.filter((subnet) => !noSnatSubnets.includes(subnet));
|
||||
const ipBlockPolicies = policies
|
||||
.filter((policy) => policy.ipBlocks?.length)
|
||||
.map((policy) => ({ snat: !!policy.snat, ipBlocks: [...policy.ipBlocks] }));
|
||||
|
||||
return {
|
||||
snatSubnets, noSnatSubnets, ipBlockPolicies
|
||||
};
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'EditVpcEgressGateway',
|
||||
|
||||
emits: ['update:value'],
|
||||
|
||||
components: {
|
||||
ArrayList,
|
||||
Banner,
|
||||
CruResource,
|
||||
LabeledInput,
|
||||
LabeledSelect,
|
||||
Loading,
|
||||
MessageLink,
|
||||
NameNsDescription,
|
||||
RadioGroup,
|
||||
ResourceTabs,
|
||||
Tab,
|
||||
UnitInput,
|
||||
},
|
||||
|
||||
mixins: [CreateEditView],
|
||||
|
||||
inheritAttrs: false,
|
||||
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
|
||||
async fetch() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
const schema = this.$store.getters[`${ inStore }/schemaFor`](HCI.VPC_EGRESS_GATEWAY);
|
||||
|
||||
await allHash({
|
||||
vpcs: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.VPC }),
|
||||
subnets: this.$store.dispatch(`${ inStore }/findAll`, { type: HCI.SUBNET }),
|
||||
fields: schema?.fetchResourceFields(),
|
||||
});
|
||||
|
||||
// Kube-OVN v1.16 (Harvester v1.10.0-rc1 and older) has no externalNetworkMode and always needs an external subnet
|
||||
this.supportsPrimaryCNI = !!schema && this.$store.getters[`${ inStore }/pathExistsInSchema`](HCI.VPC_EGRESS_GATEWAY, 'spec.externalNetworkMode');
|
||||
},
|
||||
|
||||
data() {
|
||||
const spec = this.value?.spec || {};
|
||||
|
||||
return {
|
||||
...policyGroups(spec.policies),
|
||||
vpc: spec.vpc || '',
|
||||
replicas: spec.replicas ?? 1,
|
||||
externalNetworkMode: spec.externalNetworkMode || ATTACHMENT,
|
||||
supportsPrimaryCNI: false,
|
||||
internalSubnet: spec.internalSubnet || '',
|
||||
externalSubnet: spec.externalSubnet || '',
|
||||
internalIPs: [...(spec.internalIPs || [])],
|
||||
externalIPs: [...(spec.externalIPs || [])],
|
||||
bfd: { ...BFD_DEFAULTS, ...spec.bfd },
|
||||
bandwidthIngress: spec.bandwidth?.ingress ?? '',
|
||||
bandwidthEgress: spec.bandwidth?.egress ?? '',
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
allSubnets() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
return this.$store.getters[`${ inStore }/all`](HCI.SUBNET) || [];
|
||||
},
|
||||
|
||||
vpcOptions() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
const vpcs = this.$store.getters[`${ inStore }/all`](HCI.VPC) || [];
|
||||
|
||||
return vpcs.map((vpc) => ({ label: vpc.id, value: vpc.id }));
|
||||
},
|
||||
|
||||
vpcSubnets() {
|
||||
return this.allSubnets.filter((subnet) => subnet.spec?.vpc === this.vpc);
|
||||
},
|
||||
|
||||
vpcSubnetOptions() {
|
||||
return this.vpcSubnets.map((subnet) => ({ label: subnet.id, value: subnet.id }));
|
||||
},
|
||||
|
||||
internalSubnetOptions() {
|
||||
return this.vpcSubnets
|
||||
.filter((subnet) => subnet.isOverlayAttachment)
|
||||
.map((subnet) => ({ label: subnet.id, value: subnet.id }));
|
||||
},
|
||||
|
||||
externalSubnetOptions() {
|
||||
return this.allSubnets
|
||||
.filter((subnet) => subnet.networkAttachment)
|
||||
.map((subnet) => ({ label: subnet.id, value: subnet.id }));
|
||||
},
|
||||
|
||||
internalSubnetResource() {
|
||||
return this.allSubnets.find((subnet) => subnet.id === this.internalSubnet);
|
||||
},
|
||||
|
||||
externalSubnetResource() {
|
||||
return this.allSubnets.find((subnet) => subnet.id === this.externalSubnet);
|
||||
},
|
||||
|
||||
usesPrimaryCNI() {
|
||||
return this.externalNetworkMode === PRIMARY_CNI;
|
||||
},
|
||||
|
||||
showExternalNetworkMode() {
|
||||
return this.supportsPrimaryCNI || this.usesPrimaryCNI;
|
||||
},
|
||||
|
||||
externalNetworkModes() {
|
||||
return [ATTACHMENT, PRIMARY_CNI];
|
||||
},
|
||||
|
||||
externalNetworkModeLabels() {
|
||||
return [this.t('harvester.egressGateway.externalNetworkMode.attachment'), this.t('harvester.egressGateway.externalNetworkMode.primaryCNI')];
|
||||
},
|
||||
|
||||
selectedVpc() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
|
||||
return this.vpc ? this.$store.getters[`${ inStore }/byId`](HCI.VPC, this.vpc) : null;
|
||||
},
|
||||
|
||||
// A subnet goes in one of the two groups only, and the gateway's external subnet in neither
|
||||
snatSubnetOptions() {
|
||||
return this.vpcSubnetOptions.filter((option) => option.value !== this.externalSubnet && !this.noSnatSubnets.includes(option.value));
|
||||
},
|
||||
|
||||
noSnatSubnetOptions() {
|
||||
return this.vpcSubnetOptions.filter((option) => option.value !== this.externalSubnet && !this.snatSubnets.includes(option.value));
|
||||
},
|
||||
|
||||
ipBlocksWithSnat() {
|
||||
return this.ipBlockPolicies.filter((policy) => policy.snat).flatMap((policy) => policy.ipBlocks);
|
||||
},
|
||||
|
||||
ipBlocksWithoutSnat() {
|
||||
return this.ipBlockPolicies.filter((policy) => !policy.snat).flatMap((policy) => policy.ipBlocks);
|
||||
},
|
||||
|
||||
tabErrors() {
|
||||
return this.isView ? {
|
||||
basic: [], policies: [], ips: [], bfd: [], bandwidth: []
|
||||
} : this.validateTabs();
|
||||
},
|
||||
|
||||
validationPassed() {
|
||||
return this.validate().length === 0;
|
||||
},
|
||||
|
||||
// Each field shows its own error once touched, so a disabled Save always has a visible reason
|
||||
nameRules() {
|
||||
return {
|
||||
name: [(value) => (value ? undefined : this.t('validation.required', { key: this.t('generic.name') }, true))], namespace: [], description: []
|
||||
};
|
||||
},
|
||||
|
||||
vpcRules() {
|
||||
return [(value) => this.requiredError(value, 'harvester.egressGateway.vpc.label')];
|
||||
},
|
||||
|
||||
internalSubnetRules() {
|
||||
return [(value) => this.requiredError(value, 'harvester.egressGateway.internalSubnet.label')];
|
||||
},
|
||||
|
||||
// The policy lists only offer subnets of the chosen VPC, so say why they're empty
|
||||
policySubnetsPlaceholder() {
|
||||
if (!this.vpc) {
|
||||
return this.t('harvester.egressGateway.policies.noVpc');
|
||||
}
|
||||
|
||||
return this.vpcSubnetOptions.length ? this.t('harvester.egressGateway.policies.placeholder') : this.t('harvester.egressGateway.policies.noSubnets', { vpc: this.vpc }, true);
|
||||
},
|
||||
|
||||
internalSubnetPlaceholder() {
|
||||
if (!this.vpc) {
|
||||
return this.t('harvester.egressGateway.internalSubnet.noVpc');
|
||||
}
|
||||
|
||||
return this.internalSubnetOptions.length ? this.t('harvester.egressGateway.internalSubnet.placeholder') : this.t('harvester.egressGateway.internalSubnet.none', { vpc: this.vpc }, true);
|
||||
},
|
||||
|
||||
maxReplicas() {
|
||||
return MAX_REPLICAS;
|
||||
},
|
||||
|
||||
replicasRules() {
|
||||
return [(value) => (isWholeNumber(value, 0, MAX_REPLICAS) ? undefined : this.t('harvester.egressGateway.validation.replicas', null, true))];
|
||||
},
|
||||
|
||||
externalSubnetRules() {
|
||||
return [(value) => this.requiredError(value, 'harvester.egressGateway.externalSubnet.label') || (value === this.internalSubnet ? this.t('harvester.egressGateway.validation.sameSubnet', null, true) : undefined)];
|
||||
},
|
||||
|
||||
internalIPRules() {
|
||||
return [(ip) => this.ipError('internalIPs', ip)];
|
||||
},
|
||||
|
||||
externalIPRules() {
|
||||
return [(ip) => this.ipError('externalIPs', ip)];
|
||||
},
|
||||
|
||||
ipCountErrors() {
|
||||
return Object.keys(IP_FIELDS).map((field) => this.ipCountError(field)).filter(Boolean);
|
||||
},
|
||||
|
||||
bfdIntervalRules() {
|
||||
return [(value) => (isValidBfdValue(value) ? undefined : this.t('harvester.egressGateway.validation.bfd', null, true))];
|
||||
},
|
||||
|
||||
bfdMultiplierRules() {
|
||||
return [(value) => (isValidBfdValue(value) ? undefined : this.t('harvester.egressGateway.validation.bfdMultiplier', null, true))];
|
||||
},
|
||||
|
||||
bandwidthRules() {
|
||||
return [(value) => (isBlank(value) || isValidBandwidth(value) ? undefined : this.t('harvester.egressGateway.validation.bandwidth', null, true))];
|
||||
},
|
||||
|
||||
vpcBfdPortDisabled() {
|
||||
return !!this.selectedVpc && !this.selectedVpc.bfdPortEnabled;
|
||||
},
|
||||
|
||||
vpcEditLocation() {
|
||||
const location = this.selectedVpc?.detailLocation;
|
||||
|
||||
return location ? {
|
||||
...location, query: { [MODE]: _EDIT }, hash: '#bfdPort'
|
||||
} : null;
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
vpc(neu, old) {
|
||||
if (!old || neu === old) {
|
||||
return;
|
||||
}
|
||||
|
||||
const vpcSubnets = this.vpcSubnetOptions.map((option) => option.value);
|
||||
|
||||
if (!this.internalSubnetOptions.some((option) => option.value === this.internalSubnet)) {
|
||||
this.internalSubnet = '';
|
||||
}
|
||||
|
||||
this.snatSubnets = this.snatSubnets.filter((subnet) => vpcSubnets.includes(subnet));
|
||||
this.noSnatSubnets = this.noSnatSubnets.filter((subnet) => vpcSubnets.includes(subnet));
|
||||
},
|
||||
|
||||
// The mode can only be chosen on create; PrimaryCNI rejects the external fields, so they're cleared
|
||||
externalNetworkMode(neu) {
|
||||
if (neu === PRIMARY_CNI) {
|
||||
this.externalSubnet = '';
|
||||
this.externalIPs = [];
|
||||
this.bandwidthIngress = '';
|
||||
this.bandwidthEgress = '';
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
requiredError(value, labelKey) {
|
||||
return value ? undefined : this.t('validation.required', { key: this.t(labelKey) }, true);
|
||||
},
|
||||
|
||||
ipError(field, ip) {
|
||||
const value = `${ ip || '' }`.trim();
|
||||
const { labelKey, subnet: subnetField } = IP_FIELDS[field];
|
||||
const key = this.t(labelKey);
|
||||
const subnet = this[subnetField];
|
||||
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!isValidIP(value)) {
|
||||
return this.t('harvester.egressGateway.validation.ipList', { key }, true);
|
||||
}
|
||||
|
||||
if (cleanList(this[field]).filter((other) => other === value).length > 1) {
|
||||
return this.t('harvester.egressGateway.validation.ipDuplicate', { key }, true);
|
||||
}
|
||||
|
||||
if (subnet && !subnet.canAssignIP(value)) {
|
||||
return this.t('harvester.egressGateway.validation.ipSubnet', {
|
||||
key, subnet: subnet.id, cidr: subnet.spec?.cidrBlock
|
||||
}, true);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
ipCountError(field) {
|
||||
const ips = cleanList(this[field]);
|
||||
const replicas = Number(this.replicas);
|
||||
|
||||
if (ips.length && ips.length < replicas) {
|
||||
return this.t('harvester.egressGateway.validation.ipCount', { key: this.t(IP_FIELDS[field].labelKey), replicas }, true);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
policyError() {
|
||||
const hasSource = this.snatSubnets.length || this.noSnatSubnets.length || this.ipBlockPolicies.length;
|
||||
|
||||
if (!hasSource) {
|
||||
return this.t('harvester.egressGateway.validation.policyRequired', null, true);
|
||||
}
|
||||
|
||||
// Kube-OVN reroutes a policy's sources to the gateway, so its own external subnet would loop back into it
|
||||
if (this.externalSubnet && [...this.snatSubnets, ...this.noSnatSubnets].includes(this.externalSubnet)) {
|
||||
return this.t('harvester.egressGateway.validation.policyExternalSubnet', { subnet: this.externalSubnet }, true);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
// One policy for each group that has subnets, then the IP block policies as they were
|
||||
policiesSpec() {
|
||||
return [
|
||||
...(this.snatSubnets.length ? [{ snat: true, subnets: [...this.snatSubnets] }] : []),
|
||||
...(this.noSnatSubnets.length ? [{ snat: false, subnets: [...this.noSnatSubnets] }] : []),
|
||||
...this.ipBlockPolicies.map((policy) => ({ ...policy, ipBlocks: [...policy.ipBlocks] })),
|
||||
];
|
||||
},
|
||||
|
||||
// The errors of each tab, so each tab can be marked and Save stays disabled until there are none
|
||||
validateTabs() {
|
||||
const errors = {
|
||||
basic: [], policies: [], ips: [], bfd: [], bandwidth: []
|
||||
};
|
||||
|
||||
[
|
||||
['vpc', 'harvester.egressGateway.vpc.label'],
|
||||
['internalSubnet', 'harvester.egressGateway.internalSubnet.label'],
|
||||
...(this.externalNetworkMode === PRIMARY_CNI ? [] : [['externalSubnet', 'harvester.egressGateway.externalSubnet.label']]),
|
||||
].forEach(([field, labelKey]) => {
|
||||
if (!this[field]) {
|
||||
errors.basic.push(this.t('validation.required', { key: this.t(labelKey) }, true));
|
||||
}
|
||||
});
|
||||
|
||||
if (this.internalSubnet && this.internalSubnet === this.externalSubnet) {
|
||||
errors.basic.push(this.t('harvester.egressGateway.validation.sameSubnet', null, true));
|
||||
}
|
||||
|
||||
if (!isWholeNumber(this.replicas, 0, MAX_REPLICAS)) {
|
||||
errors.basic.push(this.t('harvester.egressGateway.validation.replicas', null, true));
|
||||
}
|
||||
|
||||
const policyError = this.policyError();
|
||||
|
||||
if (policyError) {
|
||||
errors.policies.push(policyError);
|
||||
}
|
||||
|
||||
Object.keys(IP_FIELDS).forEach((field) => {
|
||||
const ipError = cleanList(this[field]).map((ip) => this.ipError(field, ip)).find(Boolean);
|
||||
const error = ipError || this.ipCountError(field);
|
||||
|
||||
if (error) {
|
||||
errors.ips.push(error);
|
||||
}
|
||||
});
|
||||
|
||||
if (this.bfd.enabled && ['minRX', 'minTX'].some((field) => !isValidBfdValue(this.bfd[field]))) {
|
||||
errors.bfd.push(this.t('harvester.egressGateway.validation.bfd', null, true));
|
||||
}
|
||||
|
||||
if (this.bfd.enabled && !isValidBfdValue(this.bfd.multiplier)) {
|
||||
errors.bfd.push(this.t('harvester.egressGateway.validation.bfdMultiplier', null, true));
|
||||
}
|
||||
|
||||
if ([this.bandwidthIngress, this.bandwidthEgress].some((value) => !isBlank(value) && !isValidBandwidth(value))) {
|
||||
errors.bandwidth.push(this.t('harvester.egressGateway.validation.bandwidth', null, true));
|
||||
}
|
||||
|
||||
return errors;
|
||||
},
|
||||
|
||||
validate() {
|
||||
const errors = this.value.metadata?.name ? [] : [this.t('validation.required', { key: this.t('generic.name') }, true)];
|
||||
|
||||
return [...errors, ...Object.values(this.validateTabs()).flat()];
|
||||
},
|
||||
|
||||
// The intervals are hidden while BFD is off, so a value cleared there falls back to its default
|
||||
bfdSpec() {
|
||||
const bfd = { ...this.bfd };
|
||||
|
||||
['minRX', 'minTX', 'multiplier'].forEach((field) => {
|
||||
bfd[field] = isValidBfdValue(bfd[field]) || this.bfd.enabled ? Number(bfd[field]) : BFD_DEFAULTS[field];
|
||||
});
|
||||
|
||||
return bfd;
|
||||
},
|
||||
|
||||
toSpec() {
|
||||
const spec = {
|
||||
...(this.value.spec || {}),
|
||||
vpc: this.vpc,
|
||||
replicas: Number(this.replicas),
|
||||
internalSubnet: this.internalSubnet,
|
||||
externalSubnet: this.externalSubnet,
|
||||
internalIPs: cleanList(this.internalIPs),
|
||||
externalIPs: cleanList(this.externalIPs),
|
||||
policies: this.policiesSpec(),
|
||||
bfd: this.bfdSpec(),
|
||||
bandwidth: {
|
||||
ingress: isBlank(this.bandwidthIngress) ? undefined : toBandwidth(this.bandwidthIngress),
|
||||
egress: isBlank(this.bandwidthEgress) ? undefined : toBandwidth(this.bandwidthEgress),
|
||||
},
|
||||
};
|
||||
|
||||
['internalIPs', 'externalIPs', 'policies'].forEach((field) => {
|
||||
if (!spec[field].length) {
|
||||
delete spec[field];
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(spec.bandwidth).forEach((direction) => {
|
||||
if (spec.bandwidth[direction] === undefined) {
|
||||
delete spec.bandwidth[direction];
|
||||
}
|
||||
});
|
||||
|
||||
if (!Object.keys(spec.bandwidth).length) {
|
||||
delete spec.bandwidth;
|
||||
}
|
||||
|
||||
// Attachment is the CRD default, so a new gateway only names the mode when it's PrimaryCNI
|
||||
if (this.externalNetworkMode === PRIMARY_CNI) {
|
||||
spec.externalNetworkMode = PRIMARY_CNI;
|
||||
delete spec.externalSubnet;
|
||||
}
|
||||
|
||||
return spec;
|
||||
},
|
||||
|
||||
async saveGateway(buttonCb) {
|
||||
this.errors = this.validate();
|
||||
|
||||
if (this.errors.length) {
|
||||
buttonCb(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.value.spec = this.toSpec();
|
||||
await this.save(buttonCb);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Loading v-if="$fetchState.pending" />
|
||||
<CruResource
|
||||
v-else
|
||||
:done-route="doneRoute"
|
||||
:resource="value"
|
||||
:mode="mode"
|
||||
:errors="errors"
|
||||
:validation-passed="validationPassed"
|
||||
:apply-hooks="applyHooks"
|
||||
@finish="saveGateway"
|
||||
@error="e=>errors=e"
|
||||
>
|
||||
<NameNsDescription
|
||||
:value="value"
|
||||
:mode="mode"
|
||||
:rules="nameRules"
|
||||
@update:value="$emit('update:value', $event)"
|
||||
/>
|
||||
|
||||
<ResourceTabs
|
||||
class="mt-15"
|
||||
:need-conditions="false"
|
||||
:need-related="false"
|
||||
:need-events="false"
|
||||
:side-tabs="true"
|
||||
:mode="mode"
|
||||
>
|
||||
<Tab
|
||||
name="basic"
|
||||
:label="t('generic.basic')"
|
||||
:weight="99"
|
||||
:error="tabErrors.basic.length > 0"
|
||||
:error-icon-tooltip="tabErrors.basic.join(' ')"
|
||||
>
|
||||
<div class="row mt-10">
|
||||
<div class="col span-6">
|
||||
<LabeledSelect
|
||||
v-model:value="vpc"
|
||||
data-testid="egress-gateway-vpc"
|
||||
class="mb-20"
|
||||
required
|
||||
:rules="vpcRules"
|
||||
:options="vpcOptions"
|
||||
:mode="mode"
|
||||
:label="t('harvester.egressGateway.vpc.label')"
|
||||
:placeholder="t('harvester.egressGateway.vpc.placeholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col span-6">
|
||||
<LabeledInput
|
||||
v-model:value.number="replicas"
|
||||
data-testid="egress-gateway-replicas"
|
||||
class="mb-20"
|
||||
type="number"
|
||||
required
|
||||
:min="0"
|
||||
:max="maxReplicas"
|
||||
:mode="mode"
|
||||
:rules="replicasRules"
|
||||
:label="t('harvester.egressGateway.replicas.label')"
|
||||
:tooltip="t('harvester.egressGateway.replicas.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="showExternalNetworkMode"
|
||||
class="row mb-20"
|
||||
>
|
||||
<div class="col span-12">
|
||||
<!-- The CRD makes the mode immutable -->
|
||||
<RadioGroup
|
||||
v-model:value="externalNetworkMode"
|
||||
data-testid="egress-gateway-external-network-mode"
|
||||
name="externalNetworkMode"
|
||||
:options="externalNetworkModes"
|
||||
:labels="externalNetworkModeLabels"
|
||||
:label="t('harvester.egressGateway.externalNetworkMode.label')"
|
||||
:tooltip="t('harvester.egressGateway.externalNetworkMode.tooltip')"
|
||||
:disabled="!isCreate"
|
||||
:mode="mode"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col span-6">
|
||||
<LabeledSelect
|
||||
v-model:value="internalSubnet"
|
||||
data-testid="egress-gateway-internal-subnet"
|
||||
class="mb-20"
|
||||
required
|
||||
:options="internalSubnetOptions"
|
||||
:rules="internalSubnetRules"
|
||||
:disabled="!vpc"
|
||||
:mode="mode"
|
||||
:label="t('harvester.egressGateway.internalSubnet.label')"
|
||||
:placeholder="internalSubnetPlaceholder"
|
||||
:tooltip="t('harvester.egressGateway.internalSubnet.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="!usesPrimaryCNI"
|
||||
class="col span-6"
|
||||
>
|
||||
<LabeledSelect
|
||||
v-model:value="externalSubnet"
|
||||
data-testid="egress-gateway-external-subnet"
|
||||
class="mb-20"
|
||||
required
|
||||
:options="externalSubnetOptions"
|
||||
:mode="mode"
|
||||
:rules="externalSubnetRules"
|
||||
:label="t('harvester.egressGateway.externalSubnet.label')"
|
||||
:placeholder="t('harvester.egressGateway.externalSubnet.placeholder')"
|
||||
:tooltip="t('harvester.egressGateway.externalSubnet.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Tab>
|
||||
|
||||
<Tab
|
||||
name="policies"
|
||||
:label="t('harvester.egressGateway.policies.label')"
|
||||
:weight="98"
|
||||
:error="tabErrors.policies.length > 0"
|
||||
:error-icon-tooltip="tabErrors.policies.join(' ')"
|
||||
>
|
||||
<p
|
||||
v-if="!isView"
|
||||
class="text-muted mb-20"
|
||||
>
|
||||
{{ t('harvester.egressGateway.policies.description') }}
|
||||
</p>
|
||||
<!-- One subnet in either list is enough, so the rule is shown once for both lists -->
|
||||
<Banner
|
||||
v-if="vpc && tabErrors.policies.length"
|
||||
color="error"
|
||||
data-testid="egress-gateway-policy-error"
|
||||
:label="tabErrors.policies[0]"
|
||||
/>
|
||||
<div class="row">
|
||||
<div class="col span-6">
|
||||
<LabeledSelect
|
||||
v-model:value="snatSubnets"
|
||||
data-testid="egress-gateway-snat-subnets"
|
||||
:disabled="!vpc"
|
||||
:append-to-body="false"
|
||||
:multiple="true"
|
||||
:options="snatSubnetOptions"
|
||||
:mode="mode"
|
||||
:label="t('harvester.egressGateway.policies.snatSubnets.label')"
|
||||
:placeholder="policySubnetsPlaceholder"
|
||||
:tooltip="t('harvester.egressGateway.policies.snatSubnets.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col span-6">
|
||||
<LabeledSelect
|
||||
v-model:value="noSnatSubnets"
|
||||
data-testid="egress-gateway-no-snat-subnets"
|
||||
:disabled="!vpc"
|
||||
:append-to-body="false"
|
||||
:multiple="true"
|
||||
:options="noSnatSubnetOptions"
|
||||
:mode="mode"
|
||||
:label="t('harvester.egressGateway.policies.noSnatSubnets.label')"
|
||||
:placeholder="policySubnetsPlaceholder"
|
||||
:tooltip="t('harvester.egressGateway.policies.noSnatSubnets.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="ipBlocksWithSnat.length || ipBlocksWithoutSnat.length"
|
||||
class="row mt-20"
|
||||
>
|
||||
<div class="col span-6">
|
||||
<LabeledInput
|
||||
v-if="ipBlocksWithSnat.length"
|
||||
data-testid="egress-gateway-snat-ip-blocks"
|
||||
:value="ipBlocksWithSnat.join(', ')"
|
||||
mode="view"
|
||||
:label="t('harvester.egressGateway.policies.ipBlocks.snat')"
|
||||
:tooltip="t('harvester.egressGateway.policies.ipBlocks.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col span-6">
|
||||
<LabeledInput
|
||||
v-if="ipBlocksWithoutSnat.length"
|
||||
data-testid="egress-gateway-no-snat-ip-blocks"
|
||||
:value="ipBlocksWithoutSnat.join(', ')"
|
||||
mode="view"
|
||||
:label="t('harvester.egressGateway.policies.ipBlocks.noSnat')"
|
||||
:tooltip="t('harvester.egressGateway.policies.ipBlocks.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Tab>
|
||||
|
||||
<Tab
|
||||
name="ips"
|
||||
:label="t('harvester.egressGateway.ips.label')"
|
||||
:weight="97"
|
||||
:error="tabErrors.ips.length > 0"
|
||||
:error-icon-tooltip="tabErrors.ips.join(' ')"
|
||||
>
|
||||
<Banner
|
||||
v-if="!isView"
|
||||
color="info"
|
||||
:label="usesPrimaryCNI ? t('harvester.egressGateway.ips.bannerPrimaryCNI') : t('harvester.egressGateway.ips.banner')"
|
||||
/>
|
||||
<Banner
|
||||
v-for="error in ipCountErrors"
|
||||
:key="error"
|
||||
color="error"
|
||||
:label="error"
|
||||
/>
|
||||
<ArrayList
|
||||
v-model:value="internalIPs"
|
||||
class="mt-20"
|
||||
:rules="internalIPRules"
|
||||
:mode="mode"
|
||||
:title="t('harvester.egressGateway.ips.internal.label')"
|
||||
:add-label="t('harvester.egressGateway.ips.internal.add')"
|
||||
:value-placeholder="t('harvester.egressGateway.ips.internal.placeholder')"
|
||||
/>
|
||||
<ArrayList
|
||||
v-if="!usesPrimaryCNI"
|
||||
v-model:value="externalIPs"
|
||||
class="mt-20"
|
||||
:rules="externalIPRules"
|
||||
:mode="mode"
|
||||
:title="t('harvester.egressGateway.ips.external.label')"
|
||||
:add-label="t('harvester.egressGateway.ips.external.add')"
|
||||
:value-placeholder="t('harvester.egressGateway.ips.external.placeholder')"
|
||||
/>
|
||||
</Tab>
|
||||
|
||||
<Tab
|
||||
name="bfd"
|
||||
:label="t('harvester.egressGateway.bfd.label')"
|
||||
:weight="96"
|
||||
:error="tabErrors.bfd.length > 0"
|
||||
:error-icon-tooltip="tabErrors.bfd.join(' ')"
|
||||
>
|
||||
<RadioGroup
|
||||
v-model:value="bfd.enabled"
|
||||
name="bfd"
|
||||
:options="[true, false]"
|
||||
:labels="[t('generic.enabled'), t('generic.disabled')]"
|
||||
:label="t('harvester.egressGateway.bfd.enabled')"
|
||||
:tooltip="t('harvester.egressGateway.bfd.tooltip')"
|
||||
:mode="mode"
|
||||
/>
|
||||
<template v-if="bfd.enabled">
|
||||
<Banner
|
||||
v-if="vpcBfdPortDisabled"
|
||||
color="warning"
|
||||
>
|
||||
<MessageLink
|
||||
:to="vpcEditLocation"
|
||||
target="_blank"
|
||||
:prefix="t('harvester.egressGateway.bfd.vpcBfdPort.prefix', { vpc }, true)"
|
||||
:middle="t('harvester.egressGateway.bfd.vpcBfdPort.middle')"
|
||||
:suffix="t('harvester.egressGateway.bfd.vpcBfdPort.suffix')"
|
||||
/>
|
||||
</Banner>
|
||||
<div class="row mt-20">
|
||||
<div class="col span-4">
|
||||
<UnitInput
|
||||
v-model:value="bfd.minRX"
|
||||
:min="1"
|
||||
:mode="mode"
|
||||
required
|
||||
:rules="bfdIntervalRules"
|
||||
:label="t('harvester.egressGateway.bfd.minRX.label')"
|
||||
:tooltip="t('harvester.egressGateway.bfd.minRX.tooltip')"
|
||||
:suffix="t('harvester.egressGateway.bfd.milliseconds')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col span-4">
|
||||
<UnitInput
|
||||
v-model:value="bfd.minTX"
|
||||
:min="1"
|
||||
:mode="mode"
|
||||
required
|
||||
:rules="bfdIntervalRules"
|
||||
:label="t('harvester.egressGateway.bfd.minTX.label')"
|
||||
:tooltip="t('harvester.egressGateway.bfd.minTX.tooltip')"
|
||||
:suffix="t('harvester.egressGateway.bfd.milliseconds')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col span-4">
|
||||
<LabeledInput
|
||||
v-model:value.number="bfd.multiplier"
|
||||
type="number"
|
||||
:min="1"
|
||||
:mode="mode"
|
||||
required
|
||||
:rules="bfdMultiplierRules"
|
||||
:label="t('harvester.egressGateway.bfd.multiplier.label')"
|
||||
:tooltip="t('harvester.egressGateway.bfd.multiplier.tooltip')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Tab>
|
||||
|
||||
<Tab
|
||||
v-if="!usesPrimaryCNI"
|
||||
name="bandwidth"
|
||||
:label="t('harvester.egressGateway.bandwidth.label')"
|
||||
:weight="95"
|
||||
:error="tabErrors.bandwidth.length > 0"
|
||||
:error-icon-tooltip="tabErrors.bandwidth.join(' ')"
|
||||
>
|
||||
<Banner
|
||||
v-if="!isView"
|
||||
color="info"
|
||||
:label="t('harvester.egressGateway.bandwidth.banner')"
|
||||
/>
|
||||
<div class="row mt-20">
|
||||
<div class="col span-6">
|
||||
<LabeledInput
|
||||
v-model:value="bandwidthIngress"
|
||||
data-testid="egress-gateway-bandwidth-ingress"
|
||||
:mode="mode"
|
||||
:rules="bandwidthRules"
|
||||
:label="t('harvester.egressGateway.bandwidth.ingress.label')"
|
||||
:placeholder="t('harvester.egressGateway.bandwidth.placeholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col span-6">
|
||||
<LabeledInput
|
||||
v-model:value="bandwidthEgress"
|
||||
data-testid="egress-gateway-bandwidth-egress"
|
||||
:mode="mode"
|
||||
:rules="bandwidthRules"
|
||||
:label="t('harvester.egressGateway.bandwidth.egress.label')"
|
||||
:placeholder="t('harvester.egressGateway.bandwidth.placeholder')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Tab>
|
||||
</ResourceTabs>
|
||||
</CruResource>
|
||||
</template>
|
||||
@@ -1,12 +1,6 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import { STORAGE_CLASS } from '@shell/config/types';
|
||||
import VM_MIXIN from '@pkg/harvester/mixins/harvester-vm';
|
||||
import HarvesterEditVM from '../index.vue';
|
||||
|
||||
const vmFormSource = readFileSync(resolve(__dirname, '../index.vue'), 'utf8');
|
||||
const translations = readFileSync(resolve(__dirname, '../../../l10n/en-us.yaml'), 'utf8');
|
||||
|
||||
function saveWith(userScript) {
|
||||
const buttonCb = jest.fn();
|
||||
const form = {
|
||||
@@ -26,106 +20,6 @@ function saveWith(userScript) {
|
||||
}
|
||||
|
||||
describe('page: kubevirt.io.virtualmachine edit', () => {
|
||||
it('shows the persistent state storage hint only when vmstate-persistence is missing', () => {
|
||||
const hasVMStateStorageClass = HarvesterEditVM.computed.hasVMStateStorageClass;
|
||||
const storageClasses = (storageClassNames) => ({
|
||||
inStore: 'harvester',
|
||||
$store: { getters: { 'harvester/all': (type) => type === STORAGE_CLASS ? storageClassNames.map((name) => ({ metadata: { name } })) : [] } },
|
||||
});
|
||||
|
||||
expect(hasVMStateStorageClass.call(storageClasses([]))).toBe(false);
|
||||
expect(hasVMStateStorageClass.call(storageClasses(['vmstate-persistence']))).toBe(true);
|
||||
});
|
||||
|
||||
it('waits for StorageClasses before treating vmstate-persistence as unavailable', () => {
|
||||
const vmStateStorageClassUnavailable = HarvesterEditVM.computed.vmStateStorageClassUnavailable;
|
||||
|
||||
expect(vmStateStorageClassUnavailable.call({ hasVMStateStorageClass: false, storageClassesLoaded: false })).toBe(false);
|
||||
expect(vmStateStorageClassUnavailable.call({ hasVMStateStorageClass: false, storageClassesLoaded: true })).toBe(true);
|
||||
expect(vmStateStorageClassUnavailable.call({ hasVMStateStorageClass: true, storageClassesLoaded: true })).toBe(false);
|
||||
});
|
||||
|
||||
it('shows the persistent state storage banner outside view mode when vmstate-persistence is unavailable', () => {
|
||||
const showPersistentStateStorageBanner = HarvesterEditVM.computed.showPersistentStateStorageBanner;
|
||||
|
||||
expect(showPersistentStateStorageBanner.call({ mode: 'create', vmStateStorageClassUnavailable: true })).toBe(true);
|
||||
expect(showPersistentStateStorageBanner.call({ mode: 'edit', vmStateStorageClassUnavailable: true })).toBe(true);
|
||||
expect(showPersistentStateStorageBanner.call({ mode: 'create', vmStateStorageClassUnavailable: false })).toBe(false);
|
||||
expect(showPersistentStateStorageBanner.call({ mode: 'view', vmStateStorageClassUnavailable: true })).toBe(false);
|
||||
});
|
||||
|
||||
it('blocks new persistent state without vmstate-persistence while allowing it to be turned off', () => {
|
||||
const isPersistentStateControlDisabled = HarvesterEditVM.methods.isPersistentStateControlDisabled;
|
||||
|
||||
expect(isPersistentStateControlDisabled.call({ vmStateStorageClassUnavailable: false }, false)).toBe(false);
|
||||
expect(isPersistentStateControlDisabled.call({ vmStateStorageClassUnavailable: true }, false)).toBe(true);
|
||||
expect(isPersistentStateControlDisabled.call({ vmStateStorageClassUnavailable: true }, true)).toBe(false);
|
||||
});
|
||||
|
||||
it('marks StorageClasses as loaded after the VM data fetch completes', async() => {
|
||||
const form = { storageClassesLoaded: false };
|
||||
const fetch = jest.spyOn(VM_MIXIN, 'fetch').mockImplementation().mockResolvedValue();
|
||||
|
||||
await HarvesterEditVM.fetch.call(form);
|
||||
fetch.mockRestore();
|
||||
|
||||
expect(form.storageClassesLoaded).toBe(true);
|
||||
});
|
||||
|
||||
it('links persistent state guidance to Storage Classes', () => {
|
||||
const toStorageClass = HarvesterEditVM.computed.toStorageClass;
|
||||
|
||||
expect(toStorageClass.call({ $store: { getters: { clusterId: 'c-1' } } })).toStrictEqual({
|
||||
name: 'harvester-c-cluster-resource',
|
||||
params: { cluster: 'c-1', resource: 'harvesterhci.io.storage' },
|
||||
});
|
||||
});
|
||||
|
||||
it('describes creating the StorageClass without non-breaking spaces around guidance links', () => {
|
||||
expect(translations).toContain('middle: or create the class on the');
|
||||
expect(vmFormSource).not.toContain(' ');
|
||||
});
|
||||
|
||||
it('clears persistent state selections only for create mode without vmstate-persistence', () => {
|
||||
const clearPersistentState = HarvesterEditVM.methods.clearPersistentStateWithoutStorageClass;
|
||||
|
||||
const createForm = {
|
||||
efiPersistentStateEnabled: true,
|
||||
mode: 'create',
|
||||
tpmPersistentStateEnabled: true,
|
||||
vmStateStorageClassUnavailable: true,
|
||||
};
|
||||
|
||||
clearPersistentState.call(createForm);
|
||||
|
||||
expect(createForm.tpmPersistentStateEnabled).toBe(false);
|
||||
expect(createForm.efiPersistentStateEnabled).toBe(false);
|
||||
|
||||
const editForm = {
|
||||
efiPersistentStateEnabled: true,
|
||||
mode: 'edit',
|
||||
tpmPersistentStateEnabled: true,
|
||||
vmStateStorageClassUnavailable: true,
|
||||
};
|
||||
|
||||
clearPersistentState.call(editForm);
|
||||
|
||||
expect(editForm.tpmPersistentStateEnabled).toBe(true);
|
||||
expect(editForm.efiPersistentStateEnabled).toBe(true);
|
||||
|
||||
const storageClassForm = {
|
||||
efiPersistentStateEnabled: true,
|
||||
mode: 'create',
|
||||
tpmPersistentStateEnabled: true,
|
||||
vmStateStorageClassUnavailable: false,
|
||||
};
|
||||
|
||||
clearPersistentState.call(storageClassForm);
|
||||
|
||||
expect(storageClassForm.tpmPersistentStateEnabled).toBe(true);
|
||||
expect(storageClassForm.efiPersistentStateEnabled).toBe(true);
|
||||
});
|
||||
|
||||
it('should stop the save when the cloud config is invalid', () => {
|
||||
const { form, buttonCb } = saveWith('#cloud-config\nsome words\n');
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import { clear } from '@shell/utils/array';
|
||||
import { saferDump } from '@shell/utils/create-yaml';
|
||||
import { exceptionToErrorsArray } from '@shell/utils/error';
|
||||
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
||||
import { INTERNAL_STORAGE_CLASS } from '../../config/types';
|
||||
import { BEFORE_SAVE_HOOKS, AFTER_SAVE_HOOKS } from '@shell/mixins/child-hook';
|
||||
import CreateEditView from '@shell/mixins/create-edit-view';
|
||||
import { parseVolumeClaimTemplates } from '@pkg/utils/vm';
|
||||
@@ -41,7 +40,6 @@ import Reserved from './VirtualMachineReserved';
|
||||
import Filesystem from './VirtualMachineFilesystem';
|
||||
import { Banner } from '@components/Banner';
|
||||
import MessageLink from '@shell/components/MessageLink';
|
||||
import { STORAGE_CLASS } from '@shell/config/types';
|
||||
|
||||
export default {
|
||||
name: 'HarvesterEditVM',
|
||||
@@ -91,11 +89,6 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
async fetch() {
|
||||
await VM_MIXIN.fetch.call(this);
|
||||
this.storageClassesLoaded = true;
|
||||
},
|
||||
|
||||
data() {
|
||||
const cloneVM = clone(this.value);
|
||||
const isRestartImmediately = this.value.actualState === 'Running';
|
||||
@@ -118,27 +111,12 @@ export default {
|
||||
hostname,
|
||||
isRestartImmediately,
|
||||
customizeDisplayName,
|
||||
storageClassesLoaded: false,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters({ t: 'i18n/t' }),
|
||||
|
||||
hasVMStateStorageClass() {
|
||||
const storageClasses = this.$store.getters[`${ this.inStore }/all`](STORAGE_CLASS) || [];
|
||||
|
||||
return storageClasses.some((storageClass) => storageClass.metadata?.name === INTERNAL_STORAGE_CLASS.VMSTATE_PERSISTENCE);
|
||||
},
|
||||
|
||||
vmStateStorageClassUnavailable() {
|
||||
return this.storageClassesLoaded && !this.hasVMStateStorageClass;
|
||||
},
|
||||
|
||||
showPersistentStateStorageBanner() {
|
||||
return this.mode !== 'view' && this.vmStateStorageClassUnavailable;
|
||||
},
|
||||
|
||||
// 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: {
|
||||
@@ -157,13 +135,6 @@ export default {
|
||||
};
|
||||
},
|
||||
|
||||
toStorageClass() {
|
||||
return {
|
||||
name: 'harvester-c-cluster-resource',
|
||||
params: { cluster: this.$store.getters['clusterId'], resource: HCI.STORAGE },
|
||||
};
|
||||
},
|
||||
|
||||
machineTypeOptions() {
|
||||
return this.machineTypes.map((type) => {
|
||||
if (!type) return { label: 'None', value: '' };
|
||||
@@ -274,25 +245,6 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
hasVMStateStorageClass: {
|
||||
handler() {
|
||||
this.clearPersistentStateWithoutStorageClass();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
|
||||
storageClassesLoaded() {
|
||||
this.clearPersistentStateWithoutStorageClass();
|
||||
},
|
||||
|
||||
tpmPersistentStateEnabled() {
|
||||
this.clearPersistentStateWithoutStorageClass();
|
||||
},
|
||||
|
||||
efiPersistentStateEnabled() {
|
||||
this.clearPersistentStateWithoutStorageClass();
|
||||
},
|
||||
|
||||
templateId: {
|
||||
async handler(id, old) {
|
||||
if (!id) {
|
||||
@@ -415,17 +367,6 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
isPersistentStateControlDisabled(persistentStateEnabled) {
|
||||
return this.vmStateStorageClassUnavailable && !persistentStateEnabled;
|
||||
},
|
||||
|
||||
clearPersistentStateWithoutStorageClass() {
|
||||
if (this.mode === 'create' && this.vmStateStorageClassUnavailable) {
|
||||
this.tpmPersistentStateEnabled = false;
|
||||
this.efiPersistentStateEnabled = false;
|
||||
}
|
||||
},
|
||||
|
||||
cancelAction() {
|
||||
const { fromPage = HCI.VM } = this.$route?.query; // default back to VM list page
|
||||
const cancelOverride = {
|
||||
@@ -866,7 +807,6 @@ export default {
|
||||
<Checkbox
|
||||
v-if="value.tpmPersistentStateFeatureEnabled && tpmEnabled"
|
||||
v-model:value="tpmPersistentStateEnabled"
|
||||
:disabled="isPersistentStateControlDisabled(tpmPersistentStateEnabled)"
|
||||
class="check"
|
||||
type="checkbox"
|
||||
:label="t('harvester.virtualMachine.systemOptions.tpmPersistentState')"
|
||||
@@ -884,7 +824,6 @@ export default {
|
||||
<Checkbox
|
||||
v-if="value.efiPersistentStateFeatureEnabled && efiEnabled"
|
||||
v-model:value="efiPersistentStateEnabled"
|
||||
:disabled="isPersistentStateControlDisabled(efiPersistentStateEnabled)"
|
||||
class="check"
|
||||
type="checkbox"
|
||||
:label="t('harvester.virtualMachine.systemOptions.efiPersistentState')"
|
||||
@@ -901,22 +840,6 @@ export default {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Banner
|
||||
v-if="showPersistentStateStorageBanner"
|
||||
color="info"
|
||||
>
|
||||
<span>
|
||||
{{ t('harvester.virtualMachine.systemOptions.persistentStateStorageClassUnavailable.prefix') }}
|
||||
<router-link :to="to">
|
||||
{{ t('harvester.virtualMachine.systemOptions.persistentStateStorageClassUnavailable.host') }}
|
||||
</router-link>
|
||||
{{ t('harvester.virtualMachine.systemOptions.persistentStateStorageClassUnavailable.middle') }}
|
||||
<router-link :to="toStorageClass">
|
||||
{{ t('harvester.virtualMachine.systemOptions.persistentStateStorageClassUnavailable.storageClass') }}
|
||||
</router-link>{{ t('harvester.virtualMachine.systemOptions.persistentStateStorageClassUnavailable.suffix') }}
|
||||
</span>
|
||||
</Banner>
|
||||
|
||||
<Banner
|
||||
v-if="showCpuPinningBanner"
|
||||
:color="mode === 'create' ? 'info' : 'warning'"
|
||||
|
||||
@@ -829,12 +829,6 @@ harvester:
|
||||
tpmPersistentState: TPM Persistent State
|
||||
efiEnabled: Booting in EFI mode
|
||||
efiPersistentState: EFI Persistent State
|
||||
persistentStateStorageClassUnavailable:
|
||||
prefix: Persistent TPM and EFI state require the vmstate-persistence StorageClass. Add a Longhorn disk on the
|
||||
host: Hosts page
|
||||
middle: or create the class on the
|
||||
storageClass: Storage Classes page
|
||||
suffix: .
|
||||
secureBoot: Secure Boot
|
||||
usbTip: Provides an absolute pointer device which often helps with getting a consistent mouse cursor position in VNC.
|
||||
sshTitle: Add Public SSH Key
|
||||
@@ -1279,10 +1273,6 @@ harvester:
|
||||
currentVersion: CURRENT VERSION
|
||||
versionLabel: AVAILABLE COMPATIBLE VERSIONS
|
||||
enableLogging: Enable Logging
|
||||
repositoryStorageClass: Upgrade Storage Class
|
||||
repositoryStorageClassTooltip: Select the StorageClass for the temporary upgrade repository volume that stores the ISO during the upgrade.
|
||||
repositoryStorageClassPlaceholder: Select a StorageClass
|
||||
repositoryStorageClassNoOptions: No StorageClasses are available.
|
||||
skipSingleReplicaDetachedVol: Skip checking single-replica detached volumes
|
||||
upgradeNode: Upgrading Node
|
||||
upgradeSysService: Upgrading System Service
|
||||
@@ -1504,19 +1494,8 @@ harvester:
|
||||
remoteVpc:
|
||||
label: Remote VPC
|
||||
infoBanner: The static route destination CIDR must cover all subnets CIDR from remote VPC Peer. Read <a href="{url}" target="_blank">VPC Peering Configuration Examples</a> for more information.
|
||||
bfdPort:
|
||||
label: BFD Port
|
||||
banner: The Egress Gateways of this VPC that have BFD enabled use the BFD port to detect a failed gateway instance quickly.
|
||||
ip:
|
||||
label: IP Address
|
||||
placeholder: e.g. 10.255.255.255
|
||||
tooltip: An IP address that doesn't conflict with any other address. For dual-stack, enter an IPv4 and an IPv6 address, separated by a comma.
|
||||
gatewaysNeedPort: 'Egress Gateways of this VPC that have BFD enabled stop working without its BFD port: {gateways}.'
|
||||
validation:
|
||||
ip: '"IP Address" must be an IPv4 address, an IPv6 address, or one of each separated by a comma.'
|
||||
subnet: '"IP Address" must not be in subnet {subnet} ({cidr}) of this VPC.'
|
||||
natGateway:
|
||||
label: NAT Gateways
|
||||
label: Gateways
|
||||
internalTenantNetwork:
|
||||
label: Internal Tenant Network
|
||||
placeholder: Select a Virtual Machine Network
|
||||
@@ -1533,95 +1512,6 @@ harvester:
|
||||
label: External Subnets
|
||||
addLabel: Add
|
||||
placeholder: Select a subnet
|
||||
egressGateway:
|
||||
label: Egress Gateways
|
||||
vpc:
|
||||
label: VPC
|
||||
placeholder: Select a VPC
|
||||
replicas:
|
||||
label: Replicas
|
||||
tooltip: The number of gateway instances. Traffic is spread across all instances.
|
||||
internalSubnet:
|
||||
label: Internal Subnet
|
||||
placeholder: Select a subnet of the VPC
|
||||
noVpc: Select a VPC first
|
||||
none: VPC {vpc} has no subnet on a virtual machine network
|
||||
tooltip: The subnet of the VPC that the gateway instances are attached to. Only subnets of a virtual machine network are listed.
|
||||
externalNetworkMode:
|
||||
label: External Network
|
||||
tooltip: How the gateway instances reach the external network. Primary CNI uses the pod network of the cluster, so it needs no external subnet and has no external IPs or bandwidth limits. This can't be changed after the gateway is created.
|
||||
attachment: External subnet
|
||||
primaryCNI: Primary CNI
|
||||
externalSubnet:
|
||||
label: External Subnet
|
||||
placeholder: Select a subnet
|
||||
tooltip: The subnet that connects the gateway instances to the external network. Only subnets of a virtual machine network are listed.
|
||||
policies:
|
||||
label: Policies
|
||||
description: Traffic from these subnets of the VPC goes out through the gateway. Each subnet can be in one list only.
|
||||
placeholder: Select subnets of the VPC
|
||||
noVpc: Select a VPC on the Basic tab first
|
||||
noSubnets: VPC {vpc} has no subnets
|
||||
snatSubnets:
|
||||
label: Subnets with SNAT
|
||||
tooltip: Traffic from these subnets leaves with the gateway's external IP.
|
||||
noSnatSubnets:
|
||||
label: Subnets without SNAT
|
||||
tooltip: Traffic from these subnets keeps its source IP, so the external network needs a route back to them.
|
||||
ipBlocks:
|
||||
snat: IP Blocks with SNAT
|
||||
noSnat: IP Blocks without SNAT
|
||||
tooltip: Set outside this form, which keeps them as they are.
|
||||
ips:
|
||||
label: IP Addresses
|
||||
banner: Optional. When you set IP addresses, set at least one for each replica. Internal IPs must be in the internal subnet and external IPs in the external subnet.
|
||||
bannerPrimaryCNI: Optional. When you set internal IPs, set at least one for each replica, in the internal subnet. The external IPs come from the pod network.
|
||||
internal:
|
||||
label: Internal IPs
|
||||
add: Add Internal IP
|
||||
placeholder: e.g. 172.20.10.41
|
||||
external:
|
||||
label: External IPs
|
||||
add: Add External IP
|
||||
placeholder: e.g. 10.115.48.220
|
||||
bfd:
|
||||
label: BFD
|
||||
enabled: Bidirectional Forwarding Detection (BFD)
|
||||
tooltip: Detect a failed gateway instance quickly and move its traffic to the other instances.
|
||||
vpcBfdPort:
|
||||
prefix: BFD also needs the BFD port of VPC {vpc}, which isn't enabled.
|
||||
middle: Edit the VPC
|
||||
suffix: to enable it.
|
||||
minRX:
|
||||
label: Receive Interval
|
||||
tooltip: The shortest interval at which the gateway accepts BFD packets.
|
||||
minTX:
|
||||
label: Transmit Interval
|
||||
tooltip: The shortest interval at which the gateway sends BFD packets.
|
||||
multiplier:
|
||||
label: Multiplier
|
||||
tooltip: The number of missed packets after which a gateway instance is considered down.
|
||||
milliseconds: ms
|
||||
bandwidth:
|
||||
label: Bandwidth
|
||||
banner: Optional. Limits the bandwidth of each gateway instance. Enter a whole number in Mbps, such as 10, or a quantity in bits per second, such as 100M or 1Gi.
|
||||
placeholder: e.g. 10
|
||||
ingress:
|
||||
label: Ingress
|
||||
egress:
|
||||
label: Egress
|
||||
validation:
|
||||
replicas: '"Replicas" must be a whole number from 0 to 10.'
|
||||
policyRequired: Select at least one subnet, in either list.
|
||||
policyExternalSubnet: Subnet {subnet} is the external subnet of the gateway, so it can't be in a policy.
|
||||
sameSubnet: The internal and external subnets must be different.
|
||||
ipList: '"{key}" must contain valid IP addresses.'
|
||||
ipDuplicate: '"{key}" must not repeat an address.'
|
||||
ipSubnet: '"{key}" must be usable addresses of subnet {subnet} ({cidr}), not its network, broadcast or gateway address.'
|
||||
ipCount: '"{key}" must have at least one address for each replica ({replicas}).'
|
||||
bfd: The BFD intervals must be whole numbers from 1 to 3600000.
|
||||
bfdMultiplier: The BFD multiplier must be a whole number from 1 to 3600000.
|
||||
bandwidth: The bandwidth must be a whole number in Mbps or a quantity such as 100M or 1Gi.
|
||||
externalIP:
|
||||
label: External IPs
|
||||
natGateway:
|
||||
@@ -1844,7 +1734,6 @@ harvester:
|
||||
imagePreloadStrategy: Image Preload Strategy
|
||||
nodeUpgradeOption: Node Upgrade Option
|
||||
restoreVM: Restore VM
|
||||
shutdownVMOnMigrationFailure: Shut Down VM on Migration Failure
|
||||
strategy: Strategy
|
||||
pauseNodes: Pause Nodes
|
||||
strategyType: Strategy Type
|
||||
@@ -2868,11 +2757,6 @@ typeLabel:
|
||||
one { NAT Gateway }
|
||||
other { NAT Gateways }
|
||||
}
|
||||
kubeovn.io.vpcegressgateway: |-
|
||||
{count, plural,
|
||||
one { Egress Gateway }
|
||||
other { Egress Gateways }
|
||||
}
|
||||
kubeovn.io.iptablessnatrule: |-
|
||||
{count, plural,
|
||||
one { Source Rule }
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
import HciSubnet from '../kubeovn.io.subnet';
|
||||
|
||||
jest.mock('../harvester', () => ({ __esModule: true, default: class {} }));
|
||||
|
||||
function createSubnet(spec) {
|
||||
return Object.assign(Object.create(HciSubnet.prototype), { spec });
|
||||
}
|
||||
|
||||
describe('class HciSubnet', () => {
|
||||
it.each([
|
||||
['ovn', null, false],
|
||||
['', null, false],
|
||||
['vmnet.default.ovn', { name: 'vmnet', namespace: 'default' }, true],
|
||||
['extnet.default', { name: 'extnet', namespace: 'default' }, false],
|
||||
['extnet.default.other', null, false],
|
||||
['a.b.ovn.extra', null, false],
|
||||
])('should read the network attachment of provider "%s"', (provider, attachment, overlay) => {
|
||||
const subnet = createSubnet({ provider });
|
||||
|
||||
expect(subnet.networkAttachment).toStrictEqual(attachment);
|
||||
expect(subnet.isOverlayAttachment).toBe(overlay);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['172.20.10.41', true],
|
||||
['172.20.10.1', false],
|
||||
['172.20.10.0', false],
|
||||
['172.20.10.255', false],
|
||||
['172.20.10.254', true],
|
||||
['172.20.11.1', false],
|
||||
['fd00::10', true],
|
||||
['fd00::1', false],
|
||||
['fd00::', false],
|
||||
['fd00::ff', false],
|
||||
['fd01::10', false],
|
||||
['not-an-ip', false],
|
||||
])('should tell whether %s can be assigned in a dual-stack subnet', (ip, assignable) => {
|
||||
const subnet = createSubnet({ cidrBlock: '172.20.10.0/24,fd00::/120', gateway: '172.20.10.1,fd00::1' });
|
||||
|
||||
expect(subnet.canAssignIP(ip)).toBe(assignable);
|
||||
});
|
||||
|
||||
it('should tell whether the subnet contains an IP, its gateway included', () => {
|
||||
const subnet = createSubnet({ cidrBlock: '172.20.10.0/24', gateway: '172.20.10.1' });
|
||||
|
||||
expect(subnet.containsIP('172.20.10.1')).toBe(true);
|
||||
expect(subnet.containsIP('10.255.255.255')).toBe(false);
|
||||
});
|
||||
|
||||
it.each([
|
||||
['10.0.0.0/31', '10.0.0.0', true],
|
||||
['10.0.0.0/31', '10.0.0.1', true],
|
||||
['10.0.0.5/32', '10.0.0.5', true],
|
||||
])('should use every address of a point-to-point subnet %s', (cidrBlock, ip, assignable) => {
|
||||
expect(createSubnet({ cidrBlock }).canAssignIP(ip)).toBe(assignable);
|
||||
});
|
||||
});
|
||||
@@ -1,56 +0,0 @@
|
||||
import HciVPC from '../kubeovn.io.vpc';
|
||||
|
||||
jest.mock('../harvester', () => ({ __esModule: true, default: class {} }));
|
||||
|
||||
function createVpc(spec, { subnets = [], gateways = [], hasGatewayType = true } = {}) {
|
||||
const $getters = {
|
||||
all: (type) => (type === 'kubeovn.io.subnet' ? subnets : gateways),
|
||||
schemaFor: () => hasGatewayType,
|
||||
};
|
||||
|
||||
return Object.assign(Object.create(HciVPC.prototype), {
|
||||
metadata: { name: 'commonvpc' }, spec, $getters
|
||||
});
|
||||
}
|
||||
|
||||
describe('class HciVPC', () => {
|
||||
it.each([
|
||||
['no BFD port', {}, false],
|
||||
['a disabled BFD port', { bfdPort: { enabled: false, ip: '10.255.255.255' } }, false],
|
||||
['an enabled BFD port without an IP', { bfdPort: { enabled: true, ip: ' ' } }, false],
|
||||
['an enabled BFD port with an IP', { bfdPort: { enabled: true, ip: '10.255.255.255' } }, true],
|
||||
])('should report a VPC with %s', (_, spec, enabled) => {
|
||||
expect(createVpc(spec).bfdPortEnabled).toBe(enabled);
|
||||
});
|
||||
|
||||
it('should list the subnets of the VPC', () => {
|
||||
const subnets = [{ id: 'subnetinternal', spec: { vpc: 'commonvpc' } }, { id: 'ovn-default', spec: { vpc: 'ovn-cluster' } }];
|
||||
|
||||
expect(createVpc({}, { subnets }).subnetResources.map((subnet) => subnet.id)).toStrictEqual(['subnetinternal']);
|
||||
});
|
||||
|
||||
it('should list the gateways of the VPC that have BFD on', () => {
|
||||
const gateways = [
|
||||
{ id: 'default/bfd-on', spec: { vpc: 'commonvpc', bfd: { enabled: true } } },
|
||||
{ id: 'default/bfd-off', spec: { vpc: 'commonvpc', bfd: { enabled: false } } },
|
||||
{ id: 'default/other-vpc', spec: { vpc: 'othervpc', bfd: { enabled: true } } },
|
||||
];
|
||||
|
||||
expect(createVpc({}, { gateways }).bfdEgressGateways.map((gateway) => gateway.id)).toStrictEqual(['default/bfd-on']);
|
||||
});
|
||||
|
||||
it('should count a gateway without a VPC as one of the default VPC', () => {
|
||||
const gateways = [{ id: 'default/no-vpc', spec: { bfd: { enabled: true } } }];
|
||||
const vpc = createVpc({}, { gateways });
|
||||
|
||||
vpc.metadata.name = 'ovn-cluster';
|
||||
|
||||
expect(vpc.bfdEgressGateways.map((gateway) => gateway.id)).toStrictEqual(['default/no-vpc']);
|
||||
});
|
||||
|
||||
it('should list no gateways when the cluster has no Egress Gateway type', () => {
|
||||
const gateways = [{ id: 'default/bfd-on', spec: { vpc: 'commonvpc', bfd: { enabled: true } } }];
|
||||
|
||||
expect(createVpc({}, { gateways, hasGatewayType: false }).bfdEgressGateways).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -1,72 +1,12 @@
|
||||
import ipaddr from 'ipaddr.js';
|
||||
import { clone } from '@shell/utils/object';
|
||||
import { HCI } from '../types';
|
||||
import HarvesterResource from './harvester';
|
||||
|
||||
const splitList = (value) => `${ value || '' }`.split(',').map((item) => item.trim()).filter(Boolean);
|
||||
const parseIP = (ip) => {
|
||||
try {
|
||||
return ipaddr.parse(ip);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const parseCIDR = (cidr) => {
|
||||
try {
|
||||
return ipaddr.parseCIDR(cidr);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export default class HciSubnet extends HarvesterResource {
|
||||
get groupByVpc() {
|
||||
return this.spec?.vpc || '';
|
||||
}
|
||||
|
||||
// The provider names the NetworkAttachmentDefinition the subnet is attached to, as <nad>.<namespace>
|
||||
// or <nad>.<namespace>.ovn. Kube-OVN's own subnets (join, ovn-default) use "ovn" and have none.
|
||||
get networkAttachment() {
|
||||
const [name, namespace, type, ...rest] = `${ this.spec?.provider || '' }`.split('.');
|
||||
|
||||
if (!name || !namespace || rest.length || (type !== undefined && type !== 'ovn')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return { name, namespace };
|
||||
}
|
||||
|
||||
// Kube-OVN, as Harvester runs it (a secondary CNI), only puts a gateway's internal network on a
|
||||
// subnet whose provider is <nad>.<namespace>.ovn
|
||||
get isOverlayAttachment() {
|
||||
return !!this.networkAttachment && `${ this.spec?.provider }`.endsWith('.ovn');
|
||||
}
|
||||
|
||||
containsIP(ip) {
|
||||
const address = parseIP(ip);
|
||||
|
||||
return !!address && splitList(this.spec?.cidrBlock).map(parseCIDR).some((range) => range?.[0].kind() === address.kind() && address.match(range));
|
||||
}
|
||||
|
||||
// Kube-OVN assigns static IPs from the network address + 1 to the broadcast address - 1 of the subnet's
|
||||
// CIDR (a /31 or /127 uses both), and never the gateway
|
||||
canAssignIP(ip) {
|
||||
const address = parseIP(ip);
|
||||
const range = address && splitList(this.spec?.cidrBlock).map(parseCIDR).find((item) => item?.[0].kind() === address.kind() && address.match(item));
|
||||
|
||||
if (!range) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const [base, prefix] = range;
|
||||
const family = address.kind() === 'ipv4' ? ipaddr.IPv4 : ipaddr.IPv6;
|
||||
const cidr = `${ base.toString() }/${ prefix }`;
|
||||
const edges = prefix < (address.kind() === 'ipv4' ? 31 : 127) ? [family.networkAddressFromCIDR(cidr), family.broadcastAddressFromCIDR(cidr)] : [];
|
||||
const gateways = splitList(this.spec?.gateway).map(parseIP).filter((gateway) => gateway?.kind() === address.kind());
|
||||
|
||||
return ![...edges, ...gateways].some((other) => other.toNormalizedString() === address.toNormalizedString());
|
||||
}
|
||||
|
||||
get doneOverride() {
|
||||
const detailLocation = clone(this.listLocation);
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@ import { clone } from '@shell/utils/object';
|
||||
import { HCI } from '../types';
|
||||
import HarvesterResource from './harvester';
|
||||
|
||||
// Kube-OVN's cluster router, which a gateway without spec.vpc uses
|
||||
const DEFAULT_VPC = 'ovn-cluster';
|
||||
|
||||
export default class HciVPC extends HarvesterResource {
|
||||
get parentNameOverride() {
|
||||
return this.$rootGetters['i18n/t'](`typeLabel."${ HCI.VPC }"`, { count: 1 })?.trim();
|
||||
@@ -18,26 +15,6 @@ export default class HciVPC extends HarvesterResource {
|
||||
return detailLocation;
|
||||
}
|
||||
|
||||
get subnetResources() {
|
||||
return (this.$getters['all'](HCI.SUBNET) || []).filter((subnet) => subnet.spec?.vpc === this.metadata?.name);
|
||||
}
|
||||
|
||||
// The Egress Gateways of this VPC that have BFD on, which need its BFD port
|
||||
get bfdEgressGateways() {
|
||||
if (!this.$getters['schemaFor'](HCI.VPC_EGRESS_GATEWAY)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return (this.$getters['all'](HCI.VPC_EGRESS_GATEWAY) || [])
|
||||
.filter((gateway) => (gateway.spec?.vpc || DEFAULT_VPC) === this.metadata?.name && gateway.spec?.bfd?.enabled);
|
||||
}
|
||||
|
||||
get bfdPortEnabled() {
|
||||
const bfdPort = this.spec?.bfdPort;
|
||||
|
||||
return bfdPort?.enabled === true && !!`${ bfdPort.ip || '' }`.trim();
|
||||
}
|
||||
|
||||
get parentLocationOverride() {
|
||||
return {
|
||||
...this.listLocation,
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
|
||||
import HarvesterAirgapUpgrade from '../index.vue';
|
||||
|
||||
function createForm(overrides = {}) {
|
||||
const image = {
|
||||
metadata: { annotations: {} },
|
||||
spec: {
|
||||
displayName: 'upgrade.iso',
|
||||
url: 'https://example.com/upgrade.iso',
|
||||
},
|
||||
save: jest.fn(),
|
||||
};
|
||||
const imageResult = {
|
||||
id: 'harvester-system/upgrade-image',
|
||||
notifyGeneratedName: jest.fn(),
|
||||
uploadImage: jest.fn().mockResolvedValue({}),
|
||||
};
|
||||
|
||||
image.save.mockResolvedValue(imageResult);
|
||||
|
||||
return {
|
||||
imageSource: 'new',
|
||||
sourceType: 'upload',
|
||||
storageClassName: 'fast',
|
||||
repositoryStorageClassEnabled: true,
|
||||
uploadImageId: '',
|
||||
imageId: '',
|
||||
imageValue: image,
|
||||
value: {
|
||||
metadata: { annotations: {} }, spec: {}, save: jest.fn().mockResolvedValue(), notifyGeneratedName: jest.fn()
|
||||
},
|
||||
canEnableLogging: false,
|
||||
skipSingleReplicaDetachedVolFeatureEnabled: false,
|
||||
skipSingleReplicaDetachedVol: false,
|
||||
allOSImages: [],
|
||||
errors: [],
|
||||
file: {},
|
||||
done: jest.fn(),
|
||||
preprocessImageName: HarvesterAirgapUpgrade.methods.preprocessImageName,
|
||||
$store: { getters: { 'i18n/t': (key) => key } },
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe('page: HarvesterAirgapUpgrade', () => {
|
||||
it('uses the shared Upgrade Repository StorageClass selector', () => {
|
||||
expect(HarvesterAirgapUpgrade.components.UpgradeRepositoryStorageClass).toBeDefined();
|
||||
});
|
||||
|
||||
it('leaves the default empty when it is unavailable for upgrade repositories', async() => {
|
||||
const form = {
|
||||
storageClassName: 'previous',
|
||||
initImageValue: jest.fn(),
|
||||
$store: {
|
||||
dispatch: jest.fn()
|
||||
.mockResolvedValueOnce([])
|
||||
.mockResolvedValueOnce([
|
||||
{
|
||||
name: 'lvm-local', isDefault: true, provisioner: 'lvm.driver.harvesterhci.io'
|
||||
},
|
||||
{ name: 'fast' }
|
||||
])
|
||||
.mockResolvedValueOnce({})
|
||||
}
|
||||
};
|
||||
|
||||
await HarvesterAirgapUpgrade.fetch.call(form);
|
||||
|
||||
expect(form.storageClassName).toBe('');
|
||||
});
|
||||
|
||||
it('prevents file upload until an upgrade StorageClass is selected', () => {
|
||||
const disableUploadButton = HarvesterAirgapUpgrade.computed.disableUploadButton;
|
||||
|
||||
expect(disableUploadButton.call({
|
||||
sourceType: 'upload',
|
||||
isUploading: false,
|
||||
repositoryStorageClassEnabled: true,
|
||||
storageClassName: ''
|
||||
})).toBe(true);
|
||||
});
|
||||
|
||||
it('unlocks the StorageClass selector after switching an uploaded image to URL', async() => {
|
||||
const wrapper = shallowMount(HarvesterAirgapUpgrade, {
|
||||
global: {
|
||||
mocks: {
|
||||
$store: {
|
||||
getters: {
|
||||
'harvester-common/getFeatureEnabled': (feature) => feature === 'repositoryStorageClass',
|
||||
'harvester/all': () => [],
|
||||
'harvester/schemaFor': () => false,
|
||||
},
|
||||
dispatch: jest.fn().mockResolvedValue({
|
||||
metadata: { annotations: {} },
|
||||
spec: {
|
||||
checksum: '', displayName: '', sourceType: 'upload', url: ''
|
||||
},
|
||||
}),
|
||||
},
|
||||
t: (key) => key,
|
||||
},
|
||||
stubs: {
|
||||
CruResource: { template: '<div><slot /></div>' },
|
||||
UpgradeRepositoryStorageClass: {
|
||||
props: ['disabled'],
|
||||
template: '<div data-testid="storage-class" :data-disabled="disabled" />',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await wrapper.setData({
|
||||
value: {},
|
||||
imageValue: {
|
||||
spec: {
|
||||
checksum: '', displayName: '', sourceType: 'upload', url: ''
|
||||
},
|
||||
remove: jest.fn().mockResolvedValue(),
|
||||
},
|
||||
sourceType: 'upload',
|
||||
uploadController: { abort: jest.fn() },
|
||||
uploadImageId: 'harvester-system/upgrade-image',
|
||||
});
|
||||
expect(wrapper.find('[data-testid="storage-class"]').attributes('data-disabled')).toBe('true');
|
||||
|
||||
await wrapper.setData({ sourceType: 'download' });
|
||||
expect(wrapper.find('[data-testid="storage-class"]').attributes('data-disabled')).toBe('false');
|
||||
});
|
||||
|
||||
it('saves an uploaded upgrade image on the selected StorageClass', async() => {
|
||||
const form = createForm();
|
||||
|
||||
await HarvesterAirgapUpgrade.methods.uploadFile.call(form, { name: 'upgrade.iso' });
|
||||
|
||||
expect(form.imageValue.spec.targetStorageClassName).toBe('fast');
|
||||
expect(form.uploadImageId).toBe('harvester-system/upgrade-image');
|
||||
});
|
||||
|
||||
it('saves a downloaded upgrade image on the selected StorageClass', async() => {
|
||||
const form = createForm({ sourceType: 'download' });
|
||||
|
||||
await HarvesterAirgapUpgrade.methods.save.call(form, jest.fn());
|
||||
|
||||
expect(form.imageValue.spec.targetStorageClassName).toBe('fast');
|
||||
});
|
||||
|
||||
it('keeps the legacy StorageClass when the feature is disabled', async() => {
|
||||
const form = createForm({ repositoryStorageClassEnabled: false });
|
||||
|
||||
await HarvesterAirgapUpgrade.methods.uploadFile.call(form, { name: 'upgrade.iso' });
|
||||
|
||||
expect(form.imageValue.spec.targetStorageClassName).toBe('longhorn-static');
|
||||
});
|
||||
|
||||
it('does not change the StorageClass of an existing image', async() => {
|
||||
const form = createForm({
|
||||
imageSource: 'exist',
|
||||
imageId: 'harvester-system/existing-image',
|
||||
});
|
||||
|
||||
form.imageValue.spec.targetStorageClassName = 'existing-class';
|
||||
await HarvesterAirgapUpgrade.methods.save.call(form, jest.fn());
|
||||
|
||||
expect(form.imageValue.spec.targetStorageClassName).toBe('existing-class');
|
||||
});
|
||||
|
||||
it('does not add an Upgrade StorageClass annotation when the image selects the class', async() => {
|
||||
const form = createForm({ uploadImageId: 'harvester-system/upgrade-image' });
|
||||
|
||||
await HarvesterAirgapUpgrade.methods.save.call(form, jest.fn());
|
||||
|
||||
expect(form.value.metadata.annotations[HCI_ANNOTATIONS.UPGRADE_STORAGE_CLASS]).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -11,8 +11,6 @@ import { HCI } from '../../../../types';
|
||||
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../../../config/harvester';
|
||||
import ImagePercentageBar from '@shell/components/formatter/ImagePercentageBar';
|
||||
import { Banner } from '@components/Banner';
|
||||
import { STORAGE_CLASS } from '@shell/config/types';
|
||||
import UpgradeRepositoryStorageClass, { getUpgradeRepositoryStorageClassDefault } from '../../../../components/UpgradeRepositoryStorageClass';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
|
||||
const IMAGE_METHOD = {
|
||||
@@ -27,18 +25,13 @@ const UPLOAD = 'upload';
|
||||
export default {
|
||||
name: 'HarvesterAirgapUpgrade',
|
||||
components: {
|
||||
Checkbox, CruResource, LabeledSelect, LabeledInput, RadioGroup, UpgradeInfo, UpgradeRepositoryStorageClass, ImagePercentageBar, Banner
|
||||
Checkbox, CruResource, LabeledSelect, LabeledInput, RadioGroup, UpgradeInfo, ImagePercentageBar, Banner
|
||||
},
|
||||
|
||||
inheritAttrs: false,
|
||||
|
||||
async fetch() {
|
||||
const [, storageClasses] = await Promise.all([
|
||||
this.$store.dispatch('harvester/findAll', { type: HCI.IMAGE }),
|
||||
this.$store.dispatch('harvester/findAll', { type: STORAGE_CLASS })
|
||||
]);
|
||||
|
||||
this.storageClassName = getUpgradeRepositoryStorageClassDefault(storageClasses);
|
||||
await this.$store.dispatch('harvester/findAll', { type: HCI.IMAGE });
|
||||
|
||||
const value = await this.$store.dispatch('harvester/create', {
|
||||
type: HCI.UPGRADE,
|
||||
@@ -72,7 +65,6 @@ export default {
|
||||
uploadResult: null,
|
||||
imageValue: null,
|
||||
enableLogging: true,
|
||||
storageClassName: '',
|
||||
IMAGE_METHOD,
|
||||
skipSingleReplicaDetachedVol: false,
|
||||
errors: [],
|
||||
@@ -130,18 +122,6 @@ export default {
|
||||
return this.$store.getters['harvester/schemaFor'](HCI.UPGRADE_LOG);
|
||||
},
|
||||
|
||||
storageClasses() {
|
||||
return this.$store.getters['harvester/all'](STORAGE_CLASS) || [];
|
||||
},
|
||||
|
||||
canSubmitUpgrade() {
|
||||
return this.enableUpgrade && (!this.repositoryStorageClassEnabled || !this.createNewImage || !!this.storageClassName);
|
||||
},
|
||||
|
||||
repositoryStorageClassEnabled() {
|
||||
return this.$store.getters['harvester-common/getFeatureEnabled']('repositoryStorageClass');
|
||||
},
|
||||
|
||||
uploadProgress() {
|
||||
const image = this.$store.getters['harvester/byId'](HCI.IMAGE, this.imageValue.id);
|
||||
|
||||
@@ -185,7 +165,7 @@ export default {
|
||||
},
|
||||
|
||||
disableUploadButton() {
|
||||
return this.sourceType === UPLOAD && (this.isUploading || (this.repositoryStorageClassEnabled && !this.storageClassName));
|
||||
return this.sourceType === UPLOAD && this.isUploading;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -249,7 +229,7 @@ export default {
|
||||
}
|
||||
|
||||
this.imageValue.spec.sourceType = DOWNLOAD;
|
||||
this.imageValue.spec.targetStorageClassName = this.repositoryStorageClassEnabled ? this.storageClassName : 'longhorn-static';
|
||||
this.imageValue.spec.targetStorageClassName = 'longhorn-static';
|
||||
|
||||
res = await this.imageValue.save();
|
||||
res.notifyGeneratedName?.();
|
||||
@@ -271,10 +251,7 @@ export default {
|
||||
this.value.spec.logEnabled = this.enableLogging;
|
||||
}
|
||||
if (this.skipSingleReplicaDetachedVolFeatureEnabled) {
|
||||
this.value.metadata.annotations = {
|
||||
...this.value.metadata.annotations,
|
||||
[HCI_ANNOTATIONS.SKIP_SINGLE_REPLICA_DETACHED_VOL]: JSON.stringify(this.skipSingleReplicaDetachedVol)
|
||||
};
|
||||
this.value.metadata.annotations = { [HCI_ANNOTATIONS.SKIP_SINGLE_REPLICA_DETACHED_VOL]: JSON.stringify(this.skipSingleReplicaDetachedVol) };
|
||||
}
|
||||
await this.value.save();
|
||||
this.value.notifyGeneratedName?.();
|
||||
@@ -311,7 +288,7 @@ export default {
|
||||
this.imageValue.spec.url = '';
|
||||
|
||||
try {
|
||||
this.imageValue.spec.targetStorageClassName = this.repositoryStorageClassEnabled ? this.storageClassName : 'longhorn-static';
|
||||
this.imageValue.spec.targetStorageClassName = 'longhorn-static';
|
||||
|
||||
const res = await this.imageValue.save();
|
||||
|
||||
@@ -377,10 +354,6 @@ export default {
|
||||
|
||||
watch: {
|
||||
async sourceType(neu) {
|
||||
if (neu === DOWNLOAD) {
|
||||
this.uploadImageId = '';
|
||||
}
|
||||
|
||||
if (neu === DOWNLOAD && this.imageValue && this.uploadController) {
|
||||
if (this.uploadController) {
|
||||
this.uploadController.abort();
|
||||
@@ -439,7 +412,7 @@ export default {
|
||||
:errors="errors"
|
||||
:can-yaml="false"
|
||||
finish-button-mode="upgrade"
|
||||
:validation-passed="canSubmitUpgrade"
|
||||
:validation-passed="enableUpgrade"
|
||||
:cancel-event="true"
|
||||
@finish="save"
|
||||
@cancel="done"
|
||||
@@ -508,14 +481,6 @@ export default {
|
||||
required
|
||||
/>
|
||||
|
||||
<UpgradeRepositoryStorageClass
|
||||
v-if="repositoryStorageClassEnabled"
|
||||
v-model:value="storageClassName"
|
||||
class="mb-20"
|
||||
:disabled="uploadImageId !== ''"
|
||||
:storage-classes="storageClasses"
|
||||
/>
|
||||
|
||||
<LabeledInput
|
||||
v-model:value="imageValue.spec.checksum"
|
||||
class="mb-10"
|
||||
|
||||
@@ -32,7 +32,6 @@ export const HCI = {
|
||||
IPTABLES_DNAT_RULE: 'kubeovn.io.iptablesdnatrule',
|
||||
PROVIDER_NETWORK: 'kubeovn.io.providernetwork',
|
||||
VPC_NAT_GATEWAY: 'kubeovn.io.vpcnatgateway',
|
||||
VPC_EGRESS_GATEWAY: 'kubeovn.io.vpcegressgateway',
|
||||
VM_IMAGE_DOWNLOADER: 'harvesterhci.io.virtualmachineimagedownloader',
|
||||
SUPPORT_BUNDLE: 'harvesterhci.io.supportbundle',
|
||||
NETWORK_ATTACHMENT: 'harvesterhci.io.networkattachmentdefinition',
|
||||
|
||||
@@ -21,11 +21,6 @@ describe('featureEnabled', () => {
|
||||
expect(featureEnabled('vncPreserveSession', 'v1.7.0')).toBe(true);
|
||||
});
|
||||
|
||||
it('should enable repositoryStorageClass only from Harvester v1.10.0', () => {
|
||||
expect(featureEnabled('repositoryStorageClass', 'v1.9.1')).toBe(false);
|
||||
expect(featureEnabled('repositoryStorageClass', 'v1.10.0')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for unknown features', () => {
|
||||
expect(featureEnabled('doesNotExist', 'v1.8.0')).toBe(false);
|
||||
});
|
||||
|
||||
@@ -1578,7 +1578,7 @@
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.6.tgz#d267a43cb1836dc4d182cce93ae75ba954ef6d2b"
|
||||
integrity sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==
|
||||
|
||||
"@babel/template@^7.27.2", "@babel/template@^7.28.6", "@babel/template@^7.29.7", "@babel/template@^7.3.3":
|
||||
"@babel/template@7", "@babel/template@^7.27.2", "@babel/template@^7.28.6", "@babel/template@^7.29.7", "@babel/template@^7.3.3":
|
||||
version "7.29.7"
|
||||
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.29.7.tgz#4d9d4004f645cdd304de958c725162784ecac700"
|
||||
integrity sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==
|
||||
@@ -2541,11 +2541,6 @@
|
||||
resolved "https://registry.yarnpkg.com/@one-ini/wasm/-/wasm-0.1.1.tgz#6013659736c9dbfccc96e8a9c2b3de317df39323"
|
||||
integrity sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==
|
||||
|
||||
"@one-ini/wasm@0.2.1":
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@one-ini/wasm/-/wasm-0.2.1.tgz#5e85cbb433460b23aaa18ac024cd1a556e9e5df9"
|
||||
integrity sha512-TUqERXGNTifZ9y2g3wPxQrw3HpHv/02DsW3D90T9x0hhonrL1ZqpSmNrU2XkoIq0fP1N6gZfVQzy2Fw1ZvGBNg==
|
||||
|
||||
"@oozcitak/dom@^2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@oozcitak/dom/-/dom-2.0.2.tgz#0f447f0b736aa6f36c5556ba811a44e56c71c26c"
|
||||
@@ -3553,12 +3548,12 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e"
|
||||
integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==
|
||||
|
||||
"@types/node@*", "@types/node@25.3.3", "@types/node@25.9.9":
|
||||
version "25.9.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-25.9.9.tgz#19f1b689ab7558ed910664b6078113b8abbef1d0"
|
||||
integrity sha512-b4e2xxj/yMeT2hNlD6x7zNFiQK2Dlmkb9CQ6v3/1G2RezKN4YS2lcEv8lzGm1mhs4f2lM4yNAMI/zUDBZBBt7w==
|
||||
"@types/node@*", "@types/node@25.3.3":
|
||||
version "25.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-25.3.3.tgz#605862544ee7ffd7a936bcbf0135a14012f1e549"
|
||||
integrity sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ==
|
||||
dependencies:
|
||||
undici-types ">=7.24.0 <7.24.7"
|
||||
undici-types "~7.18.0"
|
||||
|
||||
"@types/normalize-package-data@^2.4.0":
|
||||
version "2.4.4"
|
||||
@@ -4262,14 +4257,6 @@
|
||||
js-beautify "^1.14.9"
|
||||
vue-component-type-helpers "^2.0.0"
|
||||
|
||||
"@vue/test-utils@2.5.1":
|
||||
version "2.5.1"
|
||||
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-2.5.1.tgz#4cd1c50d6be13e8723c95f8357697534153a726d"
|
||||
integrity sha512-V/4a99odJ7hapr0bRt35XxljGk8hefq31gSOnlKTcEq2fUeoj2qb+FcpJYfQu4qfYhW9Ug+O2+CZ3QmZ7gXDzA==
|
||||
dependencies:
|
||||
js-beautify "^2.0.0"
|
||||
vue-component-type-helpers "^3.0.0"
|
||||
|
||||
"@vue/vue-loader-v15@npm:vue-loader@^15.9.7":
|
||||
version "15.11.1"
|
||||
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.11.1.tgz#dee91169211276ed43c5715caef88a56b1f497b0"
|
||||
@@ -4504,11 +4491,6 @@ abbrev@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-2.0.0.tgz#cf59829b8b4f03f89dda2771cb7f3653828c89bf"
|
||||
integrity sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==
|
||||
|
||||
abbrev@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-5.0.0.tgz#bab70805adca6637a33eeecdb8b7b5474d6d6425"
|
||||
integrity sha512-/XrFJgzQQQHpti1raDJC6m4ws6aNktmjBlhk8Fdlk7LwCEuDoieEJJY9OFHjfiFJFFRM2tK+Ky/IsfbbmlMu1w==
|
||||
|
||||
abort-controller@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
|
||||
@@ -5008,10 +4990,12 @@ babel-plugin-syntax-jsx@^6.18.0:
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
|
||||
integrity sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==
|
||||
|
||||
babel-plugin-transform-require-context@0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-require-context/-/babel-plugin-transform-require-context-0.2.0.tgz#139bdc3a55a3a64ed1b31e7c3f951c40b83a5a8f"
|
||||
integrity sha512-Mwx1vLYLt+DkX2KbBEgfY0HKfWkB1W4BKHkjrCmO8Bodwobgrc5SGakONwO1wI3pVrsNPqcqKljFSWOeAFKbdQ==
|
||||
babel-plugin-transform-require-context@0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-require-context/-/babel-plugin-transform-require-context-0.1.1.tgz#319b545ca83080b5062776b46cc9b8b346fea9a6"
|
||||
integrity sha512-4ceqYOtzgmq4/QsB8dP7pUrUOCjY/jrRYdt7YkIOWHxtGDQbcf6YZDyLCiPQf6KsEIcIbSQiTRXOsbLiuJfgNQ==
|
||||
dependencies:
|
||||
"@babel/template" "7"
|
||||
|
||||
babel-plugin-transform-vue-jsx@^3.5.0:
|
||||
version "3.7.0"
|
||||
@@ -5728,11 +5712,6 @@ commander@^10.0.0:
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06"
|
||||
integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==
|
||||
|
||||
commander@^14.0.3:
|
||||
version "14.0.3"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.3.tgz#425d79b48f9af82fcd9e4fc1ea8af6c5ec07bbc2"
|
||||
integrity sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==
|
||||
|
||||
commander@^2.20.0:
|
||||
version "2.20.3"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
||||
@@ -6120,6 +6099,11 @@ css-what@^6.0.1:
|
||||
resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.2.2.tgz#cdcc8f9b6977719fdfbd1de7aec24abf756b9dea"
|
||||
integrity sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==
|
||||
|
||||
cssesc@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
|
||||
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
|
||||
|
||||
cssnano-preset-default@^5.2.14:
|
||||
version "5.2.14"
|
||||
resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.2.14.tgz#309def4f7b7e16d71ab2438052093330d9ab45d8"
|
||||
@@ -6839,16 +6823,6 @@ editorconfig@^1.0.4:
|
||||
minimatch "^9.0.1"
|
||||
semver "^7.5.3"
|
||||
|
||||
editorconfig@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-3.0.2.tgz#078dff888b3db3286f3bd9cff989e672267a2291"
|
||||
integrity sha512-T0ix8GhtxyKVfUFEcvdNDt3YGqlwkFHbD4/5bgFUDgFmxhI/cSRAeJ87/Sz//Cq8Eam6JX/e23RkoFO71P7aAA==
|
||||
dependencies:
|
||||
"@one-ini/wasm" "0.2.1"
|
||||
commander "^14.0.3"
|
||||
minimatch "~10.2.4"
|
||||
semver "^7.7.4"
|
||||
|
||||
ee-first@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
@@ -6871,10 +6845,10 @@ element-matches@^0.1.2:
|
||||
resolved "https://registry.yarnpkg.com/element-matches/-/element-matches-0.1.2.tgz#7345cb71e965bd2b12f725e524591c102198361a"
|
||||
integrity sha512-yWh1otcs3OKUWDvu/IxyI36ZI3WNaRZlI0uG/DK6fu0pap0VYZ0J5pEGTk1zakme+hT0OKHwhlHc0N5TJhY6yQ==
|
||||
|
||||
elkjs@^0.12.0:
|
||||
version "0.12.1"
|
||||
resolved "https://registry.yarnpkg.com/elkjs/-/elkjs-0.12.1.tgz#beb9212ba59d83265ed58584368f6e3e02758077"
|
||||
integrity sha512-IhMYKHE4S2vtx0QrhBP3lYOIKDeIiJXBrdq9MGYkuB8ZHqhrBnHNfSUndjXFewrX1CPK8chwq+2NA0K0hliYuw==
|
||||
elkjs@^0.11.0:
|
||||
version "0.11.1"
|
||||
resolved "https://registry.yarnpkg.com/elkjs/-/elkjs-0.11.1.tgz#d27fcdbbf5a8aeeff80420d17d1666f78cfc8544"
|
||||
integrity sha512-zxxR9k+rx5ktMwT/FwyLdPCrq7xN6e4VGGHH8hA01vVYKjTFik7nHOxBnAYtrgYUB1RpAiLvA1/U2YraWxyKKg==
|
||||
|
||||
elliptic@^6.5.3, elliptic@^6.6.1:
|
||||
version "6.6.1"
|
||||
@@ -8509,10 +8483,10 @@ ipaddr.js@1.9.1:
|
||||
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3"
|
||||
integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==
|
||||
|
||||
ipaddr.js@2.5.0, ipaddr.js@^2.1.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.5.0.tgz#7d4b6c39f9392fb61cf807de6e425e22c10e061f"
|
||||
integrity sha512-aq+t5NAc+cS6rZQQVWC2x98CPqGtKKTMDd4Gaodv0wShnItdKg/51djkGJ1hqH+Oy0ivDftCbSLCQob8zso01w==
|
||||
ipaddr.js@^2.1.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.4.0.tgz#038e9ceaf8219efc5bb76347b7eb787875d5095b"
|
||||
integrity sha512-9VGk3HGanVE6JoZXHiCpnGy5X0jYDnN4EA4lntFPj+1vIWlFhIylq2CrrCOJH9EAhc5CYhq18F2Av2tgoAPsYQ==
|
||||
|
||||
is-arguments@^1.0.4:
|
||||
version "1.2.0"
|
||||
@@ -9421,21 +9395,10 @@ js-beautify@^1.14.9, js-beautify@^1.6.12:
|
||||
js-cookie "^3.0.5"
|
||||
nopt "^7.2.1"
|
||||
|
||||
js-beautify@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-2.0.3.tgz#773c6a3cf51e72ce99df0458a9573e06a562fed1"
|
||||
integrity sha512-cyFbh3tkPhknnTD/0bLf0T0yy2ZIbqL05mttzbt4y1Zfr7NxqXQZ62dkBLKs3oHH/lpjmDRAnciJiSUyOy8XwQ==
|
||||
dependencies:
|
||||
config-chain "^1.1.13"
|
||||
editorconfig "^3.0.2"
|
||||
glob "^13.0.6"
|
||||
js-cookie "^3.0.8"
|
||||
nopt "^10.0.1"
|
||||
|
||||
js-cookie@^3.0.5, js-cookie@^3.0.8:
|
||||
version "3.0.8"
|
||||
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-3.0.8.tgz#444e6f4b27a5d844594fef61c9d6bca5f0787688"
|
||||
integrity sha512-yeJd4aNAdYZQjaon2bpD/Gb0B/omw7HQOsynXXcOiWVCacbBcPlgn8S/d1X6blFSaHao7ozqtW7NZW19xpCtIw==
|
||||
js-cookie@^3.0.5:
|
||||
version "3.0.7"
|
||||
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-3.0.7.tgz#0a53abfc459c8e89c85d7a38eb6cb68714965b8c"
|
||||
integrity sha512-z/wZZgDrkNV1eA0ULjM/F9/50Ya8fbzgKneSpoPsXSGd0KnpdtHfOZWK+GcwLk+EZbS4F9RBhU+K2RgzuDaItw==
|
||||
|
||||
js-message@1.0.7:
|
||||
version "1.0.7"
|
||||
@@ -10085,7 +10048,7 @@ minimalistic-crypto-utils@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
|
||||
integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==
|
||||
|
||||
minimatch@^10.2.2, minimatch@^10.2.4, minimatch@^10.2.5, minimatch@~10.2.4:
|
||||
minimatch@^10.2.2, minimatch@^10.2.4, minimatch@^10.2.5:
|
||||
version "10.2.6"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.2.6.tgz#fd956bbe0b77241e9f15ac5dccb1c638060968ef"
|
||||
integrity sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==
|
||||
@@ -10329,13 +10292,6 @@ nopt@1.0.10:
|
||||
dependencies:
|
||||
abbrev "1"
|
||||
|
||||
nopt@^10.0.1:
|
||||
version "10.0.1"
|
||||
resolved "https://registry.yarnpkg.com/nopt/-/nopt-10.0.1.tgz#2d53bfda504b31c447967648ba5ea1a44e594d05"
|
||||
integrity sha512-df3sBr/6ax9hSGuC3CspvLlbnX8cP5L5nZwXF8cGN8l0zSWR6BvzmQ6jPUKjvo6+/xdpkNvEcucBNUdBeeV13g==
|
||||
dependencies:
|
||||
abbrev "^5.0.0"
|
||||
|
||||
nopt@^7.2.1:
|
||||
version "7.2.1"
|
||||
resolved "https://registry.yarnpkg.com/nopt/-/nopt-7.2.1.tgz#1cac0eab9b8e97c9093338446eddd40b2c8ca1e7"
|
||||
@@ -11144,11 +11100,12 @@ postcss-reduce-transforms@^5.1.0:
|
||||
dependencies:
|
||||
postcss-value-parser "^4.2.0"
|
||||
|
||||
postcss-selector-parser@7.2.1, postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4, postcss-selector-parser@^6.0.5, postcss-selector-parser@^6.0.9, postcss-selector-parser@^7.0.0, postcss-selector-parser@^7.1.4:
|
||||
version "7.2.1"
|
||||
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-7.2.1.tgz#7d53306479cfe1f40117f80aa6331e31667bc845"
|
||||
integrity sha512-GwxlMgTTXwIom+ebC7an3k6RaJDwklRQQnfiXsLPGicu8FYV/k/+1/9YY2OU2+r938H2t4X0TDxoif+HP2rjzQ==
|
||||
postcss-selector-parser@7.1.6, postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4, postcss-selector-parser@^6.0.5, postcss-selector-parser@^6.0.9, postcss-selector-parser@^7.0.0, postcss-selector-parser@^7.1.4:
|
||||
version "7.1.6"
|
||||
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-7.1.6.tgz#45e970f2d93d4547d6754167ed1132f43012c4bf"
|
||||
integrity sha512-7qASPzhKF2l2KLboRZux8CCTRMdGiV08vWmyKzPz22qZ7ZjQBOeY7rNzNoCLSUiftJ7HUq0GERHmxw/t0dCdMw==
|
||||
dependencies:
|
||||
cssesc "^3.0.0"
|
||||
util-deprecate "^1.0.2"
|
||||
|
||||
postcss-svgo@^5.1.0:
|
||||
@@ -11839,10 +11796,12 @@ semver-compare@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
|
||||
integrity sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==
|
||||
|
||||
"semver@2 || 3 || 4 || 5", semver@7.8.6, semver@^5.5.0, semver@^5.7.1, semver@^6.0.0, semver@^6.1.0, semver@^6.3.0, semver@^6.3.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3, semver@^7.7.3, semver@^7.7.4, semver@^7.8.5, semver@~7.0.0:
|
||||
version "7.8.6"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.6.tgz#67c0cda133a3ceb6f70b803e67625bf969000424"
|
||||
integrity sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==
|
||||
"semver@2 || 3 || 4 || 5", semver@7.5.4, semver@^5.5.0, semver@^5.7.1, semver@^6.0.0, semver@^6.1.0, semver@^6.3.0, semver@^6.3.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3, semver@^7.7.3, semver@^7.8.5, semver@~7.0.0:
|
||||
version "7.5.4"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
|
||||
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
send@~0.19.0, send@~0.19.1:
|
||||
version "0.19.2"
|
||||
@@ -11863,10 +11822,10 @@ send@~0.19.0, send@~0.19.1:
|
||||
range-parser "~1.2.1"
|
||||
statuses "~2.0.2"
|
||||
|
||||
serialize-javascript@7.0.5, serialize-javascript@^6.0.0:
|
||||
version "7.0.5"
|
||||
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-7.0.5.tgz#c798cc0552ffbb08981914a42a8756e339d0d5b1"
|
||||
integrity sha512-F4LcB0UqUl1zErq+1nYEEzSHJnIwb3AF2XWB94b+afhrekOUijwooAYqFyRbjYkm2PAKBabx6oYv/xDxNi8IBw==
|
||||
serialize-javascript@7.1.3, serialize-javascript@^6.0.0:
|
||||
version "7.1.3"
|
||||
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-7.1.3.tgz#c8f3a5355d5c52d76f4d61389172747a71f22ef6"
|
||||
integrity sha512-kYEnegpAxWFjUw3dSYdSM9zVlTrsxDbsSkq/qd3B7VanqyJ+JdDy6qVyuqVGBhSfuD/rLZQEKuXsO5KZFCrVYQ==
|
||||
|
||||
serve-index@^1.9.1:
|
||||
version "1.9.2"
|
||||
@@ -12879,10 +12838,10 @@ undefsafe@^2.0.5:
|
||||
resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c"
|
||||
integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==
|
||||
|
||||
"undici-types@>=7.24.0 <7.24.7":
|
||||
version "7.24.6"
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.24.6.tgz#61275b485d7fd4e9d269c7cf04ec2873c9cc0f91"
|
||||
integrity sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==
|
||||
undici-types@~7.18.0:
|
||||
version "7.18.2"
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.18.2.tgz#29357a89e7b7ca4aef3bf0fd3fd0cd73884229e9"
|
||||
integrity sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==
|
||||
|
||||
unfetch@4.2.0:
|
||||
version "4.2.0"
|
||||
@@ -13039,11 +12998,6 @@ vue-component-type-helpers@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/vue-component-type-helpers/-/vue-component-type-helpers-2.2.12.tgz#5014787aad185a22f460ad469cc51f14524308bc"
|
||||
integrity sha512-YbGqHZ5/eW4SnkPNR44mKVc6ZKQoRs/Rux1sxC6rdwXb4qpbOSYfDr9DsTHolOTGmIKgM9j141mZbBeg05R1pw==
|
||||
|
||||
vue-component-type-helpers@^3.0.0:
|
||||
version "3.3.14"
|
||||
resolved "https://registry.yarnpkg.com/vue-component-type-helpers/-/vue-component-type-helpers-3.3.14.tgz#2cae80380617266696a33ffd8455455486894090"
|
||||
integrity sha512-Pq3+OnbCiPCHk0R7KSZrx+j/XXaUn2kSQ1epxq60w8CPbByLjC1EJgV51n4WY851sTXUVzsNMuitywdkdVyKjA==
|
||||
|
||||
vue-demi@>=0.14.8:
|
||||
version "0.14.10"
|
||||
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.14.10.tgz#afc78de3d6f9e11bf78c55e8510ee12814522f04"
|
||||
@@ -13514,10 +13468,10 @@ write-file-atomic@^4.0.2:
|
||||
imurmurhash "^0.1.4"
|
||||
signal-exit "^3.0.7"
|
||||
|
||||
ws@8.23.0, ws@^7.3.1, ws@^8.11.0, ws@^8.18.0:
|
||||
version "8.23.0"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-8.23.0.tgz#e1af4314ad9d4cfde4684d08a9f09b322830e84e"
|
||||
integrity sha512-wCkmX8QMOrKjgO8HW2WyDbTSGeqkocxgDzS9iR79rEAexty6/2qzilx3Ag8Tqf9ykop3irLKle0MtVn5qjVnoQ==
|
||||
ws@8.21.0, ws@^7.3.1, ws@^8.11.0, ws@^8.18.0:
|
||||
version "8.21.0"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-8.21.0.tgz#012e413fc07429945121b0c153158c4343086951"
|
||||
integrity sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==
|
||||
|
||||
wsl-utils@^0.1.0:
|
||||
version "0.1.0"
|
||||
|
||||
Reference in New Issue
Block a user