From 9758db11f2ffdcd34e1e801acb8020a14e78f2c0 Mon Sep 17 00:00:00 2001 From: wujun <897415845@qq.com> Date: Wed, 13 Jul 2022 15:26:39 +0800 Subject: [PATCH 1/8] HARVESTER: add upgrade note link --- shell/assets/translations/en-us.yaml | 5 +++ .../VirtualMachineVolume/type/vmImage.vue | 1 + .../HarvesterUpgrade.vue | 15 +++---- .../harvesterhci.io.dashboard/UpgradeInfo.vue | 40 +++++++++++++++++++ .../harvester/airgapupgrade/index.vue | 7 +++- 5 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 shell/list/harvesterhci.io.dashboard/UpgradeInfo.vue diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index 8fe640c822..7a1f458f18 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -5992,6 +5992,11 @@ harvester: fail: Fail ongoing: on-going dismissMessage: Dismiss it + upgradeInfo: + warning: WARNING + doc: Before you upgrade to the newer Harvester version, you must perform the required pre-upgrade checks for your cluster. Complete only those tasks that apply to your environment. + tip: Failure to perform these checks may result in a failed upgrade or hitting known issues that require a manual workaround fix. + moreNotes: For more details about the release notes, please visit - backup: label: Backups diff --git a/shell/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/vmImage.vue b/shell/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/vmImage.vue index 7e87c72edb..2ffd42f9b0 100644 --- a/shell/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/vmImage.vue +++ b/shell/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/vmImage.vue @@ -229,6 +229,7 @@ export default { :label="t('harvester.fields.image')" :options="imagesOption" :mode="mode" + :searchable="true" :required="validateRequired" @input="onImageChange" /> diff --git a/shell/list/harvesterhci.io.dashboard/HarvesterUpgrade.vue b/shell/list/harvesterhci.io.dashboard/HarvesterUpgrade.vue index 1ea73e64fd..ae3d1aa76e 100644 --- a/shell/list/harvesterhci.io.dashboard/HarvesterUpgrade.vue +++ b/shell/list/harvesterhci.io.dashboard/HarvesterUpgrade.vue @@ -5,12 +5,13 @@ import { allHash } from '@shell/utils/promise'; import ModalWithCard from '@shell/components/ModalWithCard'; import LabeledSelect from '@shell/components/form/LabeledSelect'; import { Banner } from '@components/Banner'; +import UpgradeInfo from './UpgradeInfo'; export default { name: 'HarvesterUpgrade', components: { - ModalWithCard, LabeledSelect, Banner + ModalWithCard, LabeledSelect, Banner, UpgradeInfo }, async fetch() { @@ -121,19 +122,19 @@ export default { - + - + + + {{ currentVersion }} - - diff --git a/shell/list/harvesterhci.io.dashboard/UpgradeInfo.vue b/shell/list/harvesterhci.io.dashboard/UpgradeInfo.vue new file mode 100644 index 0000000000..befe02d70f --- /dev/null +++ b/shell/list/harvesterhci.io.dashboard/UpgradeInfo.vue @@ -0,0 +1,40 @@ + + + + + + {{ t('harvester.upgradePage.upgradeInfo.warning') }}: + + + + + {{ t('harvester.upgradePage.upgradeInfo.tip') }} + + + + {{ t('harvester.upgradePage.upgradeInfo.moreNotes') }} {{ t('generic.moreInfo') }} + + + + diff --git a/shell/pages/c/_cluster/harvester/airgapupgrade/index.vue b/shell/pages/c/_cluster/harvester/airgapupgrade/index.vue index 6436c7fcdd..12321857f5 100644 --- a/shell/pages/c/_cluster/harvester/airgapupgrade/index.vue +++ b/shell/pages/c/_cluster/harvester/airgapupgrade/index.vue @@ -3,6 +3,7 @@ import CruResource from '@shell/components/CruResource'; import { RadioGroup } from '@components/Form/Radio'; import { LabeledInput } from '@components/Form/LabeledInput'; import LabeledSelect from '@shell/components/form/LabeledSelect'; +import UpgradeInfo from '@shell/list/harvesterhci.io.dashboard/UpgradeInfo'; import { HCI } from '@shell/config/types'; import { exceptionToErrorsArray } from '@shell/utils/error'; @@ -19,7 +20,7 @@ const UPLOAD = 'upload'; export default { name: 'HarvesterAirgapUpgrade', components: { - CruResource, LabeledSelect, LabeledInput, RadioGroup + CruResource, LabeledSelect, LabeledInput, RadioGroup, UpgradeInfo }, async fetch() { @@ -216,7 +217,7 @@ export default { > + + From 5d3d78140677ff5921bf67b0acb990a4025b7989 Mon Sep 17 00:00:00 2001 From: n313893254 Date: Tue, 12 Jul 2022 17:57:07 +0800 Subject: [PATCH 2/8] HARVESTER: Cluster member and cluster owner see inconsistent statistics (cherry picked from commit f6e2b8f6a8db0a458e64a6d5ed97a8542fe11997) --- shell/config/labels-annotations.js | 3 +- .../HarvesterHostBasic.vue | 27 ++++++++-- .../list/harvesterhci.io.dashboard/index.vue | 52 ++++++------------- shell/list/harvesterhci.io.host/index.vue | 33 +++++++----- shell/models/harvester/node.js | 40 ++++---------- 5 files changed, 72 insertions(+), 83 deletions(-) diff --git a/shell/config/labels-annotations.js b/shell/config/labels-annotations.js index d9f44759c2..40d34bb9aa 100644 --- a/shell/config/labels-annotations.js +++ b/shell/config/labels-annotations.js @@ -166,7 +166,8 @@ export const HCI = { DYNAMIC_SSHKEYS_USERS: 'harvesterhci.io/dynamic-ssh-key-users', VM_VOLUME_STATUS: 'harvesterhci.io/volume-status', IMAGE_SUFFIX: 'harvesterhci.io/image-type', - OS_TYPE: 'harvesterhci.io/os-type' + OS_TYPE: 'harvesterhci.io/os-type', + HOST_REQUEST: 'management.cattle.io/pod-requests', }; // Annotations that can be on management.cattle.io.cluster to configure a custom badge diff --git a/shell/detail/harvesterhci.io.host/HarvesterHostBasic.vue b/shell/detail/harvesterhci.io.host/HarvesterHostBasic.vue index 2770fecad9..78ec3127d8 100644 --- a/shell/detail/harvesterhci.io.host/HarvesterHostBasic.vue +++ b/shell/detail/harvesterhci.io.host/HarvesterHostBasic.vue @@ -208,6 +208,12 @@ export default { return !!this.$store.getters[`${ inStore }/schemaFor`](HCI.NODE_NETWORK); }, + + hasLonghornSchema() { + const inStore = this.$store.getters['currentProduct'].inStore; + + return !!this.$store.getters[`${ inStore }/schemaFor`](LONGHORN.NODES); + }, }, methods: { @@ -294,21 +300,36 @@ export default { {{ t('harvester.host.tabs.monitor') }} - + - + - + { - const nodeName = pod?.spec?.nodeName; - - return this.availableNodes.includes(nodeName); - }).reduce((sum, pod) => { - const containers = pod?.spec?.containers || []; - - const containerCpuReserved = containers.reduce((sum, c) => { - sum += parseSi(c?.resources?.requests?.cpu || '0m'); - - return sum; - }, 0); - - sum += containerCpuReserved; - - return sum; + const useful = this.nodes.reduce((total, node) => { + return total + node.cpuReserved; }, 0); return { - total: this.cpusTotal, - useful: Number(formatSi(useful)), + total: this.cpusTotal, + useful, }; }, ramReserved() { - const useful = this.pods.filter((pod) => { - const nodeName = pod?.spec?.nodeName; - - return this.availableNodes.includes(nodeName); - }).reduce((sum, pod) => { - const containers = pod?.spec?.containers || []; - - const containerMemoryReserved = containers.reduce((sum, c) => { - sum += parseSi(c?.resources?.requests?.memory || '0m', { increment: 1024 }); - - return sum; - }, 0); - - sum += containerMemoryReserved; - - return sum; + const useful = this.nodes.reduce((total, node) => { + return total + node.memoryReserved; }, 0); - return this.createMemoryValues(this.memoryTotal, useful); + return createMemoryValues(this.memoryTotal, useful); }, availableNodes() { @@ -583,7 +555,12 @@ export default { {{ t('clusterIndexPage.sections.capacity.label') }} - + p?.spec?.nodeName === this.id && p?.metadata?.name !== 'removing'); } + get reserved() { + try { + return JSON.parse(this.metadata.annotations[HCI_ANNOTATIONS.HOST_REQUEST] || '{}'); + } catch { + return {}; + } + } + get cpuReserved() { - const out = this.pods.reduce((sum, pod) => { - const containers = pod?.spec?.containers || []; - - const containerCpuReserved = containers.reduce((sum, c) => { - sum += parseSi(c?.resources?.requests?.cpu || '0m'); - - return sum; - }, 0); - - sum += containerCpuReserved; - - return sum; - }, 0); - - return out; + return parseSi(this.reserved.cpu || '0'); } get memoryReserved() { - const out = this.pods.reduce((sum, pod) => { - const containers = pod?.spec?.containers || []; - - const containerMemoryReserved = containers.reduce((sum, c) => { - sum += parseSi(c?.resources?.requests?.memory || '0m', { increment: 1024 }); - - return sum; - }, 0); - - sum += containerMemoryReserved; - - return sum; - }, 0); - - return out; + return parseSi(this.reserved.memory || '0'); } get canDelete() { From 20ff3550c9fc630429befcb014eb4b6f0b8e6e1a Mon Sep 17 00:00:00 2001 From: yuzeng Date: Thu, 14 Jul 2022 19:15:02 +0800 Subject: [PATCH 3/8] Remove pod/node scheduling correctly --- shell/components/form/NodeAffinity.vue | 63 ++++++++++++++++---------- shell/components/form/PodAffinity.vue | 13 +++++- 2 files changed, 51 insertions(+), 25 deletions(-) diff --git a/shell/components/form/NodeAffinity.vue b/shell/components/form/NodeAffinity.vue index 51653d9836..6f68fd4ea3 100644 --- a/shell/components/form/NodeAffinity.vue +++ b/shell/components/form/NodeAffinity.vue @@ -1,4 +1,5 @@ - + - + @@ -142,6 +156,7 @@ export default { @@ -235,6 +245,7 @@ export default { /> Date: Thu, 14 Jul 2022 19:16:52 +0800 Subject: [PATCH 4/8] Harvester: add the configuration of node/pod scheduling on Harvester node driver(RKE2) --- shell/components/form/PodAffinity.vue | 1 + shell/machine-config/harvester.vue | 64 +++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/shell/components/form/PodAffinity.vue b/shell/components/form/PodAffinity.vue index 9ad3367471..90f53b1254 100644 --- a/shell/components/form/PodAffinity.vue +++ b/shell/components/form/PodAffinity.vue @@ -136,6 +136,7 @@ export default { }); Object.assign(this.value.affinity, { podAffinity, podAntiAffinity }); + this.$emit('update', this.value); }, remove() { diff --git a/shell/machine-config/harvester.vue b/shell/machine-config/harvester.vue index dab6e9dc22..dbcb322168 100644 --- a/shell/machine-config/harvester.vue +++ b/shell/machine-config/harvester.vue @@ -1,5 +1,7 @@
+
+ {{ t('harvester.upgradePage.upgradeInfo.tip') }} +
+ {{ t('harvester.upgradePage.upgradeInfo.moreNotes') }} {{ t('generic.moreInfo') }} +