Merge pull request #128 from houhoucoop/issue-7328

feat: improve Single-Replica Volume Detection for Upgrade
This commit is contained in:
Yiya Chen 2025-02-12 09:09:33 +08:00 committed by GitHub
commit f9a277d893
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 95 additions and 65 deletions

View File

@ -5,8 +5,10 @@ import { Checkbox } from '@components/Form/Checkbox';
import ModalWithCard from '@shell/components/ModalWithCard'; import ModalWithCard from '@shell/components/ModalWithCard';
import LabeledSelect from '@shell/components/form/LabeledSelect'; import LabeledSelect from '@shell/components/form/LabeledSelect';
import { Banner } from '@components/Banner'; import { Banner } from '@components/Banner';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
import { HCI } from '../types'; import { HCI } from '../types';
import UpgradeInfo from './UpgradeInfo'; import UpgradeInfo from './UpgradeInfo';
export default { export default {
name: 'HarvesterUpgrade', name: 'HarvesterUpgrade',
@ -28,14 +30,15 @@ export default {
data() { data() {
return { return {
upgrade: [], upgrade: [],
upgradeMessage: [], upgradeMessage: [],
errors: '', errors: '',
selectMode: true, selectMode: true,
version: '', version: '',
enableLogging: true, enableLogging: true,
readyReleaseNote: false, skipSingleReplicaDetachedVol: false,
isOpen: false readyReleaseNote: false,
isOpen: false
}; };
}, },
@ -68,6 +71,10 @@ export default {
return this.$store.getters['harvester/schemaFor'](HCI.UPGRADE_LOG); return this.$store.getters['harvester/schemaFor'](HCI.UPGRADE_LOG);
}, },
skipSingleReplicaDetachedVolFeatureEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('skipSingleReplicaDetachedVol');
},
releaseLink() { releaseLink() {
return `https://github.com/harvester/harvester/releases/tag/${ this.version }`; return `https://github.com/harvester/harvester/releases/tag/${ this.version }`;
} }
@ -104,6 +111,11 @@ export default {
spec: { version: this.version } spec: { version: this.version }
}; };
if (this.skipSingleReplicaDetachedVolFeatureEnabled && this.skipSingleReplicaDetachedVol) {
upgradeValue.metadata.annotations =
{ [HCI_ANNOTATIONS.SKIP_SINGLE_REPLICA_DETACHED_VOL]: JSON.stringify(this.skipSingleReplicaDetachedVol) };
}
if (this.canEnableLogging) { if (this.canEnableLogging) {
upgradeValue.spec.logEnabled = this.enableLogging; upgradeValue.spec.logEnabled = this.enableLogging;
} }
@ -190,6 +202,21 @@ export default {
/> />
</div> </div>
<div
v-if="skipSingleReplicaDetachedVolFeatureEnabled"
class="mb-5"
>
<Checkbox
v-model:value="skipSingleReplicaDetachedVol"
class="check"
type="checkbox"
:label="t('harvester.upgradePage.skipSingleReplicaDetachedVol')"
/>
</div>
<hr
v-if="version"
class="divider"
/>
<div v-if="version"> <div v-if="version">
<p <p
v-clean-html="t('harvester.upgradePage.releaseTip', {url: releaseLink}, true)" v-clean-html="t('harvester.upgradePage.releaseTip', {url: releaseLink}, true)"

View File

@ -49,7 +49,8 @@ const featuresV142 = [
const featuresV150 = [ const featuresV150 = [
...featuresV142, ...featuresV142,
'tpmPersistentState', 'tpmPersistentState',
'untaggedNetworkSetting' 'untaggedNetworkSetting',
'skipSingleReplicaDetachedVol'
]; ];
export const RELEASE_FEATURES = { export const RELEASE_FEATURES = {

View File

@ -7,60 +7,61 @@ export const LABELS_TO_IGNORE_REGEX = [
]; ];
export const HCI = { export const HCI = {
CLOUD_INIT: 'harvesterhci.io/cloud-init-template', CLOUD_INIT: 'harvesterhci.io/cloud-init-template',
CURRENT_IP: 'rke2.io/internal-ip', CURRENT_IP: 'rke2.io/internal-ip',
IMAGE_ID: 'harvesterhci.io/imageId', IMAGE_ID: 'harvesterhci.io/imageId',
SSH_NAMES: 'harvesterhci.io/sshNames', SSH_NAMES: 'harvesterhci.io/sshNames',
NETWORK_IPS: 'network.harvesterhci.io/ips', NETWORK_IPS: 'network.harvesterhci.io/ips',
TEMPLATE_VERSION_CUSTOM_NAME: 'template-version.harvesterhci.io/customName', TEMPLATE_VERSION_CUSTOM_NAME: 'template-version.harvesterhci.io/customName',
CREATOR: 'harvesterhci.io/creator', CREATOR: 'harvesterhci.io/creator',
OS: 'harvesterhci.io/os', OS: 'harvesterhci.io/os',
NETWORK_TYPE: 'network.harvesterhci.io/type', NETWORK_TYPE: 'network.harvesterhci.io/type',
VM_NAME: 'harvesterhci.io/vmName', VM_NAME: 'harvesterhci.io/vmName',
VM_NAME_PREFIX: 'harvesterhci.io/vmNamePrefix', VM_NAME_PREFIX: 'harvesterhci.io/vmNamePrefix',
VM_RESERVED_MEMORY: 'harvesterhci.io/reservedMemory', VM_RESERVED_MEMORY: 'harvesterhci.io/reservedMemory',
MAINTENANCE_STATUS: 'harvesterhci.io/maintain-status', MAINTENANCE_STATUS: 'harvesterhci.io/maintain-status',
HOST_CUSTOM_NAME: 'harvesterhci.io/host-custom-name', HOST_CUSTOM_NAME: 'harvesterhci.io/host-custom-name',
HOST_CONSOLE_URL: 'harvesterhci.io/host-console-url', HOST_CONSOLE_URL: 'harvesterhci.io/host-console-url',
RESTORE_NAME: 'restore.harvesterhci.io/name', RESTORE_NAME: 'restore.harvesterhci.io/name',
NODE_ROLE_MASTER: 'node-role.kubernetes.io/master', NODE_ROLE_MASTER: 'node-role.kubernetes.io/master',
NODE_ROLE_CONTROL_PLANE: 'node-role.kubernetes.io/control-plane', NODE_ROLE_CONTROL_PLANE: 'node-role.kubernetes.io/control-plane',
NODE_ROLE_ETCD: 'node-role.harvesterhci.io/witness', NODE_ROLE_ETCD: 'node-role.harvesterhci.io/witness',
PROMOTE_STATUS: 'harvesterhci.io/promote-status', PROMOTE_STATUS: 'harvesterhci.io/promote-status',
MIGRATION_STATE: 'harvesterhci.io/migrationState', MIGRATION_STATE: 'harvesterhci.io/migrationState',
VOLUME_CLAIM_TEMPLATE: 'harvesterhci.io/volumeClaimTemplates', VOLUME_CLAIM_TEMPLATE: 'harvesterhci.io/volumeClaimTemplates',
IMAGE_NAME: 'harvesterhci.io/image-name', IMAGE_NAME: 'harvesterhci.io/image-name',
INIT_IP: 'etcd.rke2.cattle.io/node-address', INIT_IP: 'etcd.rke2.cattle.io/node-address',
NODE_SCHEDULABLE: 'kubevirt.io/schedulable', NODE_SCHEDULABLE: 'kubevirt.io/schedulable',
NETWORK_ROUTE: 'network.harvesterhci.io/route', NETWORK_ROUTE: 'network.harvesterhci.io/route',
MATCHED_NODES: 'network.harvesterhci.io/matched-nodes', MATCHED_NODES: 'network.harvesterhci.io/matched-nodes',
OS_UPGRADE_IMAGE: 'harvesterhci.io/os-upgrade-image', OS_UPGRADE_IMAGE: 'harvesterhci.io/os-upgrade-image',
LATEST_UPGRADE: 'harvesterhci.io/latestUpgrade', LATEST_UPGRADE: 'harvesterhci.io/latestUpgrade',
UPGRADE_STATE: 'harvesterhci.io/upgradeState', UPGRADE_STATE: 'harvesterhci.io/upgradeState',
REAY_MESSAGE: 'harvesterhci.io/read-message', REAY_MESSAGE: 'harvesterhci.io/read-message',
DYNAMIC_SSHKEYS_NAMES: 'harvesterhci.io/dynamic-ssh-key-names', DYNAMIC_SSHKEYS_NAMES: 'harvesterhci.io/dynamic-ssh-key-names',
DYNAMIC_SSHKEYS_USERS: 'harvesterhci.io/dynamic-ssh-key-users', DYNAMIC_SSHKEYS_USERS: 'harvesterhci.io/dynamic-ssh-key-users',
IMAGE_SUFFIX: 'harvesterhci.io/image-type', IMAGE_SUFFIX: 'harvesterhci.io/image-type',
OS_TYPE: 'harvesterhci.io/os-type', OS_TYPE: 'harvesterhci.io/os-type',
STORAGE_PROVISIONER: 'harvesterhci.io/storageProvisioner', STORAGE_PROVISIONER: 'harvesterhci.io/storageProvisioner',
HOST_REQUEST: 'management.cattle.io/pod-requests', SKIP_SINGLE_REPLICA_DETACHED_VOL: 'harvesterhci.io/skipSingleReplicaDetachedVol',
STORAGE_CLASS: 'harvesterhci.io/storageClassName', HOST_REQUEST: 'management.cattle.io/pod-requests',
STORAGE_NETWORK: 'storage-network.settings.harvesterhci.io', STORAGE_CLASS: 'harvesterhci.io/storageClassName',
ADDON_EXPERIMENTAL: 'addon.harvesterhci.io/experimental', STORAGE_NETWORK: 'storage-network.settings.harvesterhci.io',
VOLUME_ERROR: 'longhorn.io/volume-scheduling-error', ADDON_EXPERIMENTAL: 'addon.harvesterhci.io/experimental',
KVM_AMD_CPU: 'cpu-feature.node.kubevirt.io/svm', VOLUME_ERROR: 'longhorn.io/volume-scheduling-error',
KVM_INTEL_CPU: 'cpu-feature.node.kubevirt.io/vmx', KVM_AMD_CPU: 'cpu-feature.node.kubevirt.io/svm',
NODE_MANUFACTURER: 'manufacturer', KVM_INTEL_CPU: 'cpu-feature.node.kubevirt.io/vmx',
NODE_MODEL: 'model', NODE_MANUFACTURER: 'manufacturer',
NODE_SERIAL_NUMBER: 'serialNumber', NODE_MODEL: 'model',
VM_INSUFFICIENT: 'harvesterhci.io/insufficient-resource-quota', NODE_SERIAL_NUMBER: 'serialNumber',
NODE_NTP_SYNC_STATUS: 'node.harvesterhci.io/ntp-service', VM_INSUFFICIENT: 'harvesterhci.io/insufficient-resource-quota',
PARENT_SRIOV: 'harvesterhci.io/parent-sriov-network-device', NODE_NTP_SYNC_STATUS: 'node.harvesterhci.io/ntp-service',
PARENT_SRIOV_GPU: 'harvesterhci.io/parentSRIOVGPUDevice', PARENT_SRIOV: 'harvesterhci.io/parent-sriov-network-device',
VM_MAINTENANCE_MODE_STRATEGY: 'harvesterhci.io/maintain-mode-strategy', PARENT_SRIOV_GPU: 'harvesterhci.io/parentSRIOVGPUDevice',
NODE_CPU_MANAGER_UPDATE_STATUS: 'harvesterhci.io/cpu-manager-update-status', VM_MAINTENANCE_MODE_STRATEGY: 'harvesterhci.io/maintain-mode-strategy',
CPU_MANAGER: 'cpumanager', NODE_CPU_MANAGER_UPDATE_STATUS: 'harvesterhci.io/cpu-manager-update-status',
VM_DEVICE_ALLOCATION_DETAILS: 'harvesterhci.io/deviceAllocationDetails', CPU_MANAGER: 'cpumanager',
SVM_BACKUP_ID: 'harvesterhci.io/svmbackupId', VM_DEVICE_ALLOCATION_DETAILS: 'harvesterhci.io/deviceAllocationDetails',
DISABLE_LONGHORN_V2_ENGINE: 'node.longhorn.io/disable-v2-data-engine', SVM_BACKUP_ID: 'harvesterhci.io/svmbackupId',
DISABLE_LONGHORN_V2_ENGINE: 'node.longhorn.io/disable-v2-data-engine',
}; };

View File

@ -854,6 +854,7 @@ harvester:
currentVersion: CURRENT VERSION currentVersion: CURRENT VERSION
versionLabel: AVAILABLE COMPATIBLE VERSIONS versionLabel: AVAILABLE COMPATIBLE VERSIONS
enableLogging: Enable Logging enableLogging: Enable Logging
skipSingleReplicaDetachedVol: Skip checking single-replica detached volumes
upgradeNode: Upgrading Node upgradeNode: Upgrading Node
upgradeSysService: Upgrading System Service upgradeSysService: Upgrading System Service
upgradeImage: Download Upgrade Image upgradeImage: Download Upgrade Image