Compare commits

...
187 Commits
Author SHA1 Message Date
mergify[bot]andAndy Lee 089573f193 bump to 1.5.0-rc4 (#235) (#238)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 3dc6dda1ca)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-04-09 14:19:19 +08:00
mergify[bot]andAndy Lee 5d0c4f0c5a hide usb device tab in v1.3.x (#236) (#237)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit fca05d8489)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-04-09 14:04:30 +08:00
mergify[bot]andAndy Lee 57bb1e8562 Fix undefined error in VM edit as yaml page (#233) (#234)
* fix undefined error whenclick save in  edit as yaml

Signed-off-by: Andy Lee <andy.lee@suse.com>

* fix VM isEqual logic and fix undefined error

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 238c660796)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-04-07 15:33:36 +08:00
mergify[bot]andAndy Lee 30ff129691 fix secret name is different when edit as yaml (#230) (#232)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 19bea97106)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-04-07 10:56:49 +08:00
mergify[bot]andJack Yu 9175f16bfc chore: use default imag repo name (#212) (#231)
Signed-off-by: Jack Yu <jack.yu@suse.com>
(cherry picked from commit de4edbbf3b)

Co-authored-by: Jack Yu <jack.yu@suse.com>
2025-04-07 10:41:41 +08:00
mergify[bot]andAndy Lee 7c5e0f93d1 Bump ui-ext to 1.5.0-rc3 (#228) (#229)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 9256391627)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-04-02 16:03:13 +08:00
mergify[bot]andAndy Lee 8a7d3dffbe Fix error banner position in all dialogs (#226) (#227)
* fix error banner position in all dialogs

Signed-off-by: Andy Lee <andy.lee@suse.com>

* update HarvesterImageDownloader.vue

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 25439aee65)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-31 17:02:06 +08:00
b7810c5970 change longhorn v2 access mode to RWX (#223) (#225)
(cherry picked from commit f2fe1f5bd6)

Co-authored-by: Andy Lee <andy.lee@suse.com>
Co-authored-by: Yiya Chen <yiya.chen@suse.com>
2025-03-28 15:16:45 +08:00
mergify[bot]andAndy Lee 72dedd46d1 update to take VM snapshot logic (#222) (#224)
(cherry picked from commit f8d5aa1a21)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-28 15:13:46 +08:00
mergify[bot]andAndy Lee 24f716ab20 use harvester translation key forhost page CPU and memory (#220) (#221)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 38cf667830)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-27 15:05:41 +08:00
mergify[bot]andAndy Lee 38ad0fe1a7 upgrade ui-ext version to 1.5.0-rc2 (#208) (#218)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 18667836c2)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-25 11:44:26 +08:00
mergify[bot]andAndy Lee c84d262099 fix volume won't be dismiss after deleting (#216) (#217)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 2940f25fe0)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-24 15:33:20 +08:00
mergify[bot]andAndy Lee dbb53eae00 fix image.repo to image.repository (#214) (#215)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit a24d01717a)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-21 17:43:13 +08:00
mergify[bot]andAndy Lee 4afacd754a fix the doneOverride path for harvesterhci.io.virtualmachinetemplate (#211) (#213)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 22a032e56c)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-20 17:13:45 +08:00
mergify[bot]andAndy Lee 10d159e2c7 Add volum mode options in create VM volume tab (#209) (#210)
* add volume mode option for non-longhorn volume

Signed-off-by: Andy Lee <andy.lee@suse.com>

* fix default storage class in create VM page

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 9343813ace)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-19 17:44:58 +08:00
mergify[bot]andAndy Lee de755a662a upgrade rancher/shell to 3.0.2-rc6 (#206) (#207)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 2dff7b0a93)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-14 16:50:13 +08:00
mergify[bot]andJack Yu f1200f4508 chore: add building catalog GA (#181) (#204)
* chore: add building catalog GA

Signed-off-by: Jack Yu <jack.yu@suse.com>

* feat: should include prerelease

Signed-off-by: Jack Yu <jack.yu@suse.com>

---------

Signed-off-by: Jack Yu <jack.yu@suse.com>
(cherry picked from commit 1880043a80)

Co-authored-by: Jack Yu <jack.yu@suse.com>
2025-03-14 15:04:39 +08:00
mergify[bot]andAndy Lee 0ca2b0591a Bring status object in harvesterhci.io.upgrade dismiss PUT API (#201) (#202)
* bring status object in PUT dismiss API

Signed-off-by: Andy Lee <andy.lee@suse.com>

* add cleanForSave in harvester model

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit d8bee7f4f5)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-13 14:15:59 +08:00
mergify[bot]andAndy Lee 44f003309c Add volumeMode dropdown for third-party storage (#197) (#200)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 90c923b480)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-12 14:29:40 +08:00
mergify[bot]andAndy Lee 7c1596c965 replace tag format v1.5.0 to harvester-1.5.0 (#190) (#199)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 374b904191)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-12 12:35:01 +08:00
mergify[bot]andAndy Lee a5130986a8 fix percent typo (#198)
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 487f9abc10)

Co-authored-by: Andy Lee <andy.lee@suse.com>
2025-03-11 17:24:23 +08:00
Andy Lee e4ae7cec5e Merge pull request #194 from harvester/mergify/bp/release-harvester-v1.5/pr-191
Fix missing remove button in Infobox (backport #191)
2025-03-11 12:02:41 +08:00
Andy Lee 2c7b59daed Fix infobox style
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 4e831cbc5f)
2025-03-11 03:58:53 +00:00
Andy Lee 224e34315b Merge pull request #193 from harvester/mergify/bp/release-harvester-v1.5/pr-192
remove require dot for non-longhorn v1 (backport #192)
2025-03-11 11:37:06 +08:00
Andy Lee 9f56f9eccc remove require dot for non-longhorn v1
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit b939df9b7d)
2025-03-11 03:35:42 +00:00
Andy Lee dd76956972 Merge pull request #189 from harvester/mergify/bp/release-harvester-v1.5/pr-183
Bump harvester-ui-extension to v1.5.0-rc1 (backport #183)
2025-03-06 15:58:01 +08:00
Andy Lee d92a53d9a7 bump to v1.5.0-rc1
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 8ad7a57ab4)
2025-03-06 07:56:15 +00:00
Andy Lee afc3f0d87f Merge pull request #188 from harvester/mergify/bp/release-harvester-v1.5/pr-185
fix: allow set empty for backupVolumeSnapshotClassName in Setting csi-driver-config (backport #185)
2025-03-06 15:52:16 +08:00
Yi-Ya Chen a607b604f8 refactor: default should selectable
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 64b59a0c27)
2025-03-06 07:49:27 +00:00
Yi-Ya Chen 4d7b0f7350 feat: gray out class name selector
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 72415622d9)
2025-03-06 07:49:27 +00:00
Andy Lee c570b5870b Merge pull request #187 from harvester/mergify/bp/release-harvester-v1.5/pr-186
Filter exported SC for non-longhorn V1 volume (backport #186)
2025-03-06 15:37:17 +08:00
Andy Lee af36163b29 Filter export SC for non-longhorn V1 volume
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 104e98e390)
2025-03-06 07:35:24 +00:00
Andy Lee b3dbc2f0d3 Merge pull request #184 from harvester/mergify/bp/release-harvester-v1.5/pr-182
Add HarvesterImageDownloader for cdi image (backport #182)
2025-03-06 14:54:04 +08:00
Andy Lee fed86d4c24 Remove converting sentence
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit cbd5e45200)
2025-03-06 06:50:24 +00:00
Andy Lee d18ebfb26b Add HarvesterImageDownloader
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 966d4d6709)
2025-03-06 06:50:24 +00:00
Andy Lee 477206d8d0 Merge pull request #180 from harvester/mergify/bp/release-harvester-v1.5/pr-175
Add label tab to vm template (backport #175)
2025-03-04 17:42:29 +08:00
Andy Lee fd0836d489 Add label tab to vm template
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit efdfdbf0b8)
2025-03-04 09:36:33 +00:00
Andy Lee 2e3536abc6 Merge pull request #179 from harvester/mergify/bp/release-harvester-v1.5/pr-178
Fix  undefined reading harvesterhci.io/storageClassName (backport #178)
2025-03-04 11:03:20 +08:00
Andy Lee 45c0dce61b fix undefined reading harvesterhci.io/storageClassName
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 54f85963ea)
2025-03-04 03:02:06 +00:00
Andy Lee 6b8b1f68eb Merge pull request #177 from harvester/mergify/bp/release-harvester-v1.5/pr-173
Introduce VM Pending status (backport #173)
2025-03-04 10:55:29 +08:00
Andy Lee bb645c00db introduce VM pending status
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 05ff8e4f19)
2025-03-04 02:49:45 +00:00
Andy Lee ed8c6e81ca Merge pull request #176 from harvester/mergify/bp/release-harvester-v1.5/pr-174
fix: align all memory / storage / quota units to Gi/Mi (backport #174)
2025-03-04 10:49:03 +08:00
Andy Lee ed692b579d update harvesterhci.io.host
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 8fbbfc90f1)
2025-03-04 02:47:43 +00:00
Andy Lee f02074a25e Extract variables to utils/unit
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 8db4de1c4a)
2025-03-04 02:47:42 +00:00
Andy Lee a8f8f0d288 fix: align all memory / storage / quota units to Gi/Mi
Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 8f76d5ad30)
2025-03-04 02:47:42 +00:00
Andy Lee 9fa9b3837b Merge pull request #172 from harvester/mergify/bp/release-harvester-v1.5/pr-171
Add refreshIntervalInSecond in 1.4.2 feature flag (backport #171)
2025-02-27 17:29:36 +08:00
andy.lee 4b3bdf8a59 add refreshIntervalInSecond in 1.4.2 feature flag
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 30dc56cad5)
2025-02-27 09:24:58 +00:00
Andy Lee 7bdf40d737 Merge pull request #170 from harvester/mergify/bp/release-harvester-v1.5/pr-169
fix golden image error when creating LVM volume (backport #169)
2025-02-27 13:51:29 +08:00
andy.lee a1e7345437 fix golden image error when creating LVM volume
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit ca7eccd688)
2025-02-27 05:46:58 +00:00
Andy Lee 9322a77b20 Merge pull request #168 from harvester/mergify/bp/release-harvester-v1.5/pr-167
Hide non-longhorn volume external link (backport #167)
2025-02-26 17:08:30 +08:00
andy.lee ed7d7ffd2e hide non longhorn volume external link
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 046947de32)
2025-02-26 09:01:23 +00:00
Andy Lee 2ef8e2e0aa Merge pull request #166 from harvester/mergify/bp/release-harvester-v1.5/pr-164
Add refreshIntervalInSeconds in backup targe edit page (backport #164)
2025-02-26 16:19:19 +08:00
andy.lee a0ea6beedb Add refreshIntervalInSeconds in backup targe edit page
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 7e00a08e35)
2025-02-26 08:18:13 +00:00
Andy Lee 85a723e20c Merge pull request #163 from harvester/mergify/bp/release-harvester-v1.5/pr-162
Fix upgrade cluster model styles (backport #162)
2025-02-26 09:35:19 +08:00
andy.lee bbe6b1bdf0 change overallMessage color to red
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 50901a2eaf)
2025-02-26 01:32:24 +00:00
andy.lee 81a572e5b5 fix upgrade model style
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit ff439e66a9)
2025-02-26 01:32:24 +00:00
Andy Lee 1a727f0001 Merge pull request #161 from harvester/mergify/bp/release-harvester-v1.5/pr-159
Add Labels Tab in VM edit page (backport #159)
2025-02-24 17:44:35 +08:00
andy.lee 91862244e1 Add labels tab in VM edit pae
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 9cd3cd6492)
2025-02-24 09:42:11 +00:00
andy.lee c7b0e9ee7a update catalog.cattle.io/rancher-version to 2.11.0
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit e07042b9c9)
2025-02-24 09:42:10 +00:00
Andy Lee d9337ff188 Merge pull request #160 from harvester/mergify/bp/release-harvester-v1.5/pr-152
Fix usb and pci devices unable to passthrough (backport #152)
2025-02-24 16:48:46 +08:00
andy.lee c16922c228 add pcideviceclaim and usbdeviceclaim models
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 188f058df8)
2025-02-24 08:41:07 +00:00
Andy Lee bbade7e50c Merge pull request #158 from harvester/mergify/bp/release-harvester-v1.5/pr-157
Limit harvester-ui-extension to install on Rancher 2.11.0+ (backport #157)
2025-02-21 16:40:28 +08:00
andy.lee 193bf092d5 Update catalog.cattle.io/rancher-version to 2.11.0
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 36c68eefb1)
2025-02-21 08:39:18 +00:00
Andy Lee 308b6ddbd7 Merge pull request #156 from harvester/mergify/bp/release-harvester-v1.5/pr-154
Bump harvester-ui-extension version to v1.5.0-dev (backport #154)
2025-02-21 15:07:19 +08:00
andy.lee c850b78da2 bump to v1.5.0-dev
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 0a782fa4d5)
2025-02-21 07:01:38 +00:00
Andy Lee 0fe9557eb8 Merge pull request #155 from harvester/mergify/bp/release-harvester-v1.5/pr-148
Update installation flow in README.md (backport #148)
2025-02-21 14:43:19 +08:00
andy.lee b6953d73f7 Update installation flow in README.md
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit f855a0add5)
2025-02-21 06:13:47 +00:00
Andy Lee 8a89a9c502 Merge pull request #153 from harvester/mergify/bp/release-harvester-v1.5/pr-151
feat: set up a way to test UI changes in Harvester UI when accessed via Rancher (backport #151)
2025-02-21 13:37:14 +08:00
Yi-Ya Chen d5f17bfdf1 ci: rename file
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 7f98dfe9c8)
2025-02-21 05:34:10 +00:00
Yi-Ya Chen 9d0bb6e1f4 ci: revert change
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 6a3153a7ec)
2025-02-21 05:34:10 +00:00
Yi-Ya Chen 2ec37d81d9 ci: rename the workflow
(cherry picked from commit 629cb0c601)
2025-02-21 05:34:10 +00:00
Yi-Ya Chen e50bff8b5e ci: add ci pipeline
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 0c3fe22df7)
2025-02-21 05:34:09 +00:00
Andy Lee e898181834 Merge pull request #150 from harvester/mergify/bp/release-harvester-v1.5/pr-149
More third party storage UI change (backport #149)
2025-02-20 14:53:03 +08:00
andy.lee a0f877a23e More third party storage UI change
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 66f53c8a00)
2025-02-20 06:45:48 +00:00
Andy Lee a805490930 Merge pull request #147 from harvester/mergify/bp/release-harvester-v1.5/pr-145
External/third-party storage UI change (backport #145)
2025-02-19 17:06:44 +08:00
andy.lee 887a122358 allow sorting storage class column in volume list page
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 4a303e514c)
2025-02-19 09:05:28 +00:00
andy.lee 1f48e8aea7 add thirdPartyStorage feature flag
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit b828c2f66d)
2025-02-19 09:05:28 +00:00
andy.lee b2c1a3b068 add third party storage UI change
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 40794d89a0)
2025-02-19 09:05:28 +00:00
Andy Lee df1566f394 Merge pull request #146 from harvester/mergify/bp/release-harvester-v1.5/pr-143
Fix sshkey is not added to cloud init user data immediately (backport #143)
2025-02-19 16:45:40 +08:00
andy.lee 0a3b122316 fix sshkey is not added to cloud init user data immediately
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit e2daa1ea0c)
2025-02-19 08:23:47 +00:00
Yiya Chen d497613cc4 Merge pull request #144 from harvester/mergify/bp/release-harvester-v1.5/pr-142
fix: no progress circle on the top after triggering upgrade (backport #142)
2025-02-19 09:30:31 +08:00
Yi-Ya Chen 91494f5832 fix: register upgrade component in header
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit b499f62c56)
2025-02-19 01:16:26 +00:00
Andy Lee c61d30a607 Merge pull request #141 from harvester/mergify/bp/release-harvester-v1.5/pr-140
update yarn.lock (backport #140)
2025-02-17 12:15:56 +08:00
andy.lee 9428a07850 update yarn.lock
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 9d02623b3a)
2025-02-17 04:14:24 +00:00
Andy Lee 28603d3ab3 Merge pull request #139 from harvester/mergify/bp/release-harvester-v1.5/pr-138
fix: Harvester ui extension not working built from CI (backport #138)
2025-02-17 12:13:35 +08:00
Yi-Ya Chen f863b881a9 feat: fix $ctx redefine issue
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit cbe66f4660)
2025-02-17 03:57:25 +00:00
Andy Lee 083ab9f3e9 Merge pull request #136 from harvester/mergify/bp/release-harvester-v1.5/pr-134
Move harvester schema.js into harvester folder (backport #134)
2025-02-14 13:33:29 +08:00
Andy Lee 5d52c368a1 Merge pull request #137 from harvester/mergify/bp/release-harvester-v1.5/pr-133
Upgrade @rancher/shell to v3.0.2-rc3 (backport #133)
2025-02-14 13:33:18 +08:00
andy.lee d72f379ab1 upgrade @rancher/shell to v3.0.2-rc3
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 0153f9d985)
2025-02-14 05:30:40 +00:00
andy.lee 2931248fdb move harvester schema.js into harvester folder
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 548bdd2835)
2025-02-14 05:30:24 +00:00
Yiya Chen 7166a5b1bb Merge pull request #135 from harvester/mergify/bp/release-harvester-v1.5/pr-132
feat: add EFI persistent state checkbox in VM advanced tab (backport #132)
2025-02-14 09:14:42 +08:00
Yi-Ya Chen 00c884cda0 lint: fix eslint
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 70a56c75b0)
2025-02-13 10:04:33 +00:00
Yi-Ya Chen 1c65b71e35 refactor: remove persistent property if unchecked
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 31a9abd5c2)
2025-02-13 10:04:33 +00:00
Yi-Ya Chen 3e4bc31a9d fix: state not update when the TPM checkbox is toggled
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 6d5139a994)
2025-02-13 10:04:32 +00:00
Yi-Ya Chen bc4bbd9a40 feat: add efi persistent state
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit b92f22fa75)
2025-02-13 10:04:32 +00:00
Yiya Chen a6666ef384 Merge pull request #131 from harvester/mergify/bp/release-harvester-v1.5/pr-128
feat: improve Single-Replica Volume Detection for Upgrade (backport #128)
2025-02-12 10:52:50 +08:00
Yi-Ya Chen 92588c9adc refactor: fix conflicts
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
2025-02-12 09:35:21 +08:00
Yi-Ya Chen 832df26efc feat: add divider
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 3b054b35c6)
2025-02-12 01:10:53 +00:00
Yi-Ya Chen f7869cb241 refactor: align key spacing
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit fd3f5ec1e6)
2025-02-12 01:10:53 +00:00
Yi-Ya Chen 27c0124682 feat: add feature flag
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 72c6741af1)

# Conflicts:
#	pkg/harvester/config/feature-flags.js
2025-02-12 01:10:52 +00:00
Yi-Ya Chen 6c69579c41 feat: add checkbox to skip checking
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 375127a78a)
2025-02-12 01:10:52 +00:00
Andy Lee 145b534c5d Merge pull request #130 from harvester/mergify/bp/release-harvester-v1.5/pr-127
fix: unable to create new sshkey in VM create page (backport #127)
2025-02-11 17:36:50 +08:00
andy.lee ce017a0e40 fix: unable to create new sshkey in VM create page
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 176946e5e9)
2025-02-11 09:30:37 +00:00
Andy Lee 72a6f77fd2 Merge pull request #129 from harvester/mergify/bp/release-harvester-v1.5/pr-119
Add VlanL2Network / UntaggedNetwork types in network-storage setting (backport #119)
2025-02-11 17:29:20 +08:00
andy.lee 275b15ad62 update feature flag
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit fc09e030a0)
2025-02-11 09:18:03 +00:00
andy.lee 06c9a8b3d9 extract network_type to config/types
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 5f76da4629)
2025-02-11 09:18:02 +00:00
andy.lee 36b1406738 fix number of IP formula
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 3a3122f3a1)
2025-02-11 09:18:02 +00:00
andy.lee 06b13a9cc5 add network type in storage-network setting
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 229cbf1f69)
2025-02-11 09:18:01 +00:00
Andy Lee 2a3cd32447 Merge pull request #126 from harvester/mergify/bp/release-harvester-v1.5/pr-125
fix: vGPU number not correct (backport #125)
2025-02-11 13:17:51 +08:00
andy.lee 40dc31226b fix: vGPU number not correct
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 26afffc2f1)
2025-02-11 05:13:50 +00:00
Andy Lee def9e1a24e Merge pull request #124 from harvester/mergify/bp/release-harvester-v1.5/pr-121
The hints on the branding page is using the wrong product name (backport #121)
2025-02-11 11:45:16 +08:00
andy.lee da25b28f7f remove unneeded translation keys
Signed-off-by: andy.lee <andy.lee@suse.com>
2025-02-11 11:39:48 +08:00
Volker Theile 10abbd0452 The hints on the branding page is using the wrong product name
The hints on the `Branding` page at `Advanced > Settings > UI > branding` are using the product name `Rancher` instead of `Harvester`.

Related to: https://github.com/harvester/harvester/issues/6341

Signed-off-by: Volker Theile <vtheile@suse.com>
(cherry picked from commit d023fa1de4)
2025-02-11 03:25:22 +00:00
Andy Lee 8a7cc69a69 Merge pull request #123 from harvester/mergify/bp/release-harvester-v1.5/pr-122
fix: isEncrypted breaks all the volume page (backport #122)
2025-02-11 11:21:42 +08:00
andy.lee c188f3367d fix: isEncrypted breaks all the volume page
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 2232e56ba1)
2025-02-11 03:20:33 +00:00
Andy Lee 26d85a7760 Merge pull request #120 from harvester/mergify/bp/release-harvester-v1.5/pr-117
feat: add support for persistent TPM in VMs (backport #117)
2025-02-11 10:36:45 +08:00
Yi-Ya Chen 6eb845b46b refactor: update feature flag
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 1651e201e8)
2025-02-11 02:28:10 +00:00
Yi-Ya Chen 8c20ddb440 feat: add feature flag
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 43b30ec3c3)
2025-02-11 02:28:10 +00:00
Yi-Ya Chen a92f27d80c refactor: rewrite render logic
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 68ba934b5a)
2025-02-11 02:28:09 +00:00
Yi-Ya Chen f523a161b6 feat: add checkbox to create templates
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 84bacfaff5)
2025-02-11 02:28:09 +00:00
Yi-Ya Chen ad2273b5ba feat: add persistent state checkbox
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit e8017e14c8)
2025-02-11 02:28:09 +00:00
Andy Lee 171939e66b Merge pull request #118 from harvester/mergify/bp/release-harvester-v1.5/pr-116
Fix unable to add/delete new hard disk in edit node page (backport #116)
2025-02-07 11:32:08 +08:00
andy.lee 18bfbbaac1 fix unable to add/delete new hard disk
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit cbb66175f6)
2025-02-07 03:23:49 +00:00
Andy Lee e79f493cb6 Merge pull request #114 from harvester/mergify/bp/release-harvester-v1.5/pr-13
align CPU pinning checkbox position in cloud template (backport #13)
2025-02-06 14:36:03 +08:00
andy.lee e84c0fe886 align CPU pinning checkbox position in cloud template
(cherry picked from commit 59bf735f8b)
2025-02-06 14:23:12 +08:00
Andy Lee bbfeb55af9 Merge pull request #113 from harvester/mergify/bp/release-harvester-v1.5/pr-110
Prevent display lock icon if this.volumes is empty array (backport #110)
2025-02-06 12:25:26 +08:00
andy.lee e7446e7e23 prevent display icon if this.volumes is empty array
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit c75755a527)
2025-02-06 03:48:41 +00:00
Andy Lee adacaf65fa Merge pull request #111 from harvester/mergify/bp/release-harvester-v1.5/pr-109
Add v1.4.2 feature flag to v1.5 branch (backport #109)
2025-02-06 11:47:13 +08:00
andy.lee 7c761b2829 add v1.4.2 feature flag
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit e8f282395e)
2025-02-05 09:45:46 +00:00
Andy Lee cc8532ff99 Merge pull request #108 from harvester/mergify/bp/release-harvester-v1.5/pr-107
upgrade @rancher/shell to v3.0.2-rc2 (backport #107)
2025-02-05 12:34:11 +08:00
andy.lee ede281a42d upgrade @rancher/shell to v3.0.2-rc2
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 426e15084e)
2025-02-05 04:32:14 +00:00
Yiya Chen d34279d98f Merge pull request #106 from harvester/mergify/bp/release-harvester-v1.5/pr-103
fix: VM Snapshot and Backup List Views Fail to Load After Creation (backport #103)
2025-01-24 14:28:22 +08:00
Yi-Ya Chen efd93c5e52 fix: get sourceSchedule exception
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 12cadbf667)
2025-01-24 02:08:49 +00:00
Yiya Chen 8d338b5f72 Merge pull request #102 from harvester/mergify/bp/release-harvester-v1.5/pr-94
feat: add confirmation pop-up for VM stop and pause actions (backport #94)
2025-01-21 10:46:51 +08:00
Yiya Chen f59c81da31 Merge pull request #101 from harvester/mergify/bp/release-harvester-v1.5/pr-83
fix: cluster member role user should not be able to delete node on Harvester Hosts page (backport #83)
2025-01-21 10:45:00 +08:00
Yi-Ya Chen cf6d44601e style: change apply button color
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit c4e9a89ba5)
2025-01-21 02:24:43 +00:00
Yi-Ya Chen 89b43060df feat: handle bulk actions
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit f2d5172224)
2025-01-21 02:24:43 +00:00
Yi-Ya Chen 7194d52000 refactor: remove the confirm input
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit fdc635955b)
2025-01-21 02:24:43 +00:00
Yi-Ya Chen a8ea0645e4 feat: add confirm popup
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 526d1bb875)
2025-01-21 02:24:42 +00:00
Yi-Ya Chen 713173b0e4 refactor: get value from parent class
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit e95955fad6)
2025-01-21 02:24:30 +00:00
Yi-Ya Chen 6ed13bcec1 fix: check user delete permission
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit f5961f3a59)
2025-01-21 02:24:30 +00:00
Yi-Ya Chen 02519820d7 refactor: fix lint warnings
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 3565b44e3a)
2025-01-21 02:24:29 +00:00
Yi-Ya Chen 2604101eb2 refactor: move logic to node model
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 43b10b250e)
2025-01-21 02:24:29 +00:00
Yi-Ya Chen 1cb16f0c74 fix: disable delete action
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit c791399a61)
2025-01-21 02:24:29 +00:00
Andy Lee 752cf2e93a Merge pull request #100 from harvester/mergify/bp/release-harvester-v1.5/pr-89
fix: remove witness node in VM node scheduling tab (backport #89)
2025-01-20 20:04:07 +08:00
andy.lee f4ea7b6ea0 fix: remove witness node in VM node scheduling tab
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 993706fead)
2025-01-20 12:01:23 +00:00
Andy Lee a6405989e9 Merge pull request #99 from harvester/mergify/bp/release-harvester-v1.5/pr-93
fix: encrypt option can only choose encrypted storage class when creating VM image (backport #93)
2025-01-20 11:50:29 +08:00
andy.lee fb8a81fd0f refactor: fallback to longhorn if not default storage class
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 6e9350e63d)
2025-01-20 03:39:28 +00:00
andy.lee 3a5ead3c2c fix: when choose encrypt can only choose encrypted storage class when creating image
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit b0c7b1fefe)
2025-01-20 03:39:28 +00:00
Andy Lee def4b64cd3 Merge pull request #98 from harvester/mergify/bp/release-harvester-v1.5/pr-97
chore: update copyright year to 2025 (backport #97)
2025-01-17 17:30:56 +08:00
andy.lee a191b845d8 chore: update company name to SUSE
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 8f3a2b202d)
2025-01-17 09:28:13 +00:00
andy.lee 32a57d791a chore: update copyright year
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 0ea3f56f2c)
2025-01-17 09:28:12 +00:00
Andy Lee 2a7e51ef4c Merge pull request #96 from harvester/mergify/bp/release-harvester-v1.5/pr-92
chore: bump release version to v1.0.3 (backport #92)
2025-01-17 10:04:08 +08:00
Andy Lee f726fb99e5 Merge pull request #95 from harvester/mergify/bp/release-harvester-v1.5/pr-91
fix: bring default valueContext when customizing vm-import controller (backport #91)
2025-01-17 10:02:07 +08:00
andy.lee 9c19ae1f9b chore: bump release version to v1.0.3
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 6644651fe5)
2025-01-17 01:58:33 +00:00
andy.lee 6ece2d0284 fix: bring default valueContext fwhen customizing vm-import controller
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 2d6bc65b26)
2025-01-17 01:57:43 +00:00
Andy Lee aec424b007 Merge pull request #90 from harvester/mergify/bp/release-harvester-v1.5/pr-86
Replace sortablejs-vue3 (backport #86)
2025-01-15 11:51:24 +08:00
Francesco Torchia ff80b91311 Fix Volumes draggable key
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
(cherry picked from commit d9db1263d1)
2025-01-14 16:03:46 +00:00
Francesco Torchia 52252c16f7 Fix draggable Volumes disabled prop
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
(cherry picked from commit 10a8f18784)
2025-01-14 16:03:45 +00:00
Francesco Torchia 19cf1e9302 Replace sortablejs-vue3
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
(cherry picked from commit a7b4366d7c)
2025-01-14 16:03:45 +00:00
Andy Lee ddb8e8106b Merge pull request #87 from harvester/mergify/bp/release-harvester-v1.5/pr-85
fix: filter schedule style and functionality (backport #85)
2025-01-14 13:23:23 +08:00
Andy Lee 9af5ff7b12 Merge pull request #88 from harvester/mergify/bp/release-harvester-v1.5/pr-84
fix: resume schedule job error (backport #84)
2025-01-14 13:12:17 +08:00
andy.lee fff6153f15 fix: resume schedule job error
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 8116358011)
2025-01-14 04:56:24 +00:00
andy.lee 1ecac7adf4 chore: disable filter button if all rows do not have sourceSchedule
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit d72857f374)
2025-01-14 04:56:23 +00:00
andy.lee 408818904a fix: filter schedule style and functionality
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 57ab9e2830)
2025-01-14 04:56:23 +00:00
Andy Lee b96637e6d9 Merge pull request #82 from harvester/mergify/bp/release-harvester-v1.5/pr-79
fix: add missing wording in delete VM modal  (backport #79)
2025-01-13 13:39:16 +08:00
andy.lee 8bdaca777f fix: delete VM modal style and wording
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 7e32ea453b)
2025-01-13 05:37:38 +00:00
Andy Lee d278687e75 Merge pull request #81 from harvester/mergify/bp/release-harvester-v1.5/pr-72
[porting 1262] Fix vm rows reactivity (backport #72)
2025-01-13 12:03:31 +08:00
Francesco Torchia 3ea8edb824 [porting 1262] Fix vm rows reactivity
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
(cherry picked from commit c3f2665912)
2025-01-13 03:59:24 +00:00
Andy Lee e33302050b Merge pull request #78 from harvester/mergify/bp/release-harvester-v1.5/pr-71
chore: add v1.5.0 and v1.3.3 feature flags (backport #71)
2025-01-10 16:35:40 +08:00
andy.lee 8fefb59802 chore: add v1.5.0 and v1.3.3 feature flags
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 2a58745550)
2025-01-10 06:37:35 +00:00
Andy Lee 872aec1c10 Merge pull request #76 from harvester/mergify/bp/release-harvester-v1.5/pr-68
fix: missing label in VM scheduling tab (backport #68)
2025-01-10 14:35:22 +08:00
Andy Lee 8814bd4cda Merge pull request #77 from harvester/mergify/bp/release-harvester-v1.5/pr-73
fix: exception error in cluster outputs create page (backport #73)
2025-01-10 14:34:57 +08:00
Yi-Ya Chen 72a17cd9c2 fix: replace set
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
(cherry picked from commit 7645d6161f)
2025-01-10 06:31:32 +00:00
andy.lee 8d79b69748 fix: remove translation key
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 8b43c200b2)
2025-01-10 06:30:46 +00:00
andy.lee 47760a8426 fix: update translation key
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit ab71cb377c)
2025-01-10 06:30:46 +00:00
andy.lee e6fc641a29 fix: missing label in VM scheduling tab
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit eb667fd56b)
2025-01-10 06:30:46 +00:00
Andy Lee 90b85d2be7 Merge pull request #75 from harvester/mergify/bp/release-harvester-v1.5/pr-69
fix: failed to resume /active vm schedule job (backport #69)
2025-01-10 14:26:49 +08:00
Andy Lee ee9575f710 Merge pull request #74 from harvester/mergify/bp/release-harvester-v1.5/pr-70
fix: serial console not work (backport #70)
2025-01-10 14:25:30 +08:00
andy.lee 7d97e6821c fix: resume/active scheduling job failed
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 814d296d75)
2025-01-10 06:23:31 +00:00
andy.lee 42fc9d8fae fix: serial console not work
Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 69d7046bc7)
2025-01-10 06:21:29 +00:00
andy.lee 0f03fc0805 change mergify.yml base branch to main
Signed-off-by: andy.lee <andy.lee@suse.com>
2025-01-06 21:39:04 +08:00
andy.lee 6d4a7cd1b1 add mergify.yml
Signed-off-by: andy.lee <andy.lee@suse.com>
2025-01-06 21:38:55 +08:00
Andy Lee f69d445ef7 Merge pull request #66 from harvester/revert-65-test_word
Revert "setting test word for v1.5 release branch"
2025-01-06 20:59:07 +08:00
Andy Lee d358a0a618 Revert "setting test word for v1.5 release branch" 2025-01-06 20:57:38 +08:00
Andy Lee 47841e49b1 Merge pull request #65 from a110605/test_word
setting test word for v1.5 release branch
2025-01-06 20:51:27 +08:00
andy.lee 57c7f0f856 setting test word
Signed-off-by: andy.lee <andy.lee@suse.com>
2025-01-06 20:46:47 +08:00
108 changed files with 3909 additions and 2005 deletions
+19
View File
@@ -0,0 +1,19 @@
pull_request_rules:
- name: Automatically open backport PR to release-harvester-v1.5
conditions:
- base=main
actions:
backport:
branches:
- "release-harvester-v1.5"
assignees:
- "{{ author }}"
labels:
- "v1.5 backport PR"
- name: Ask to resolve conflict
conditions:
- conflict
actions:
comment:
message: This pull request is now in conflict. Could you fix it @{{author}}? 🙏
@@ -0,0 +1,35 @@
name: Build Harvester Catalog Image and Publish on Release
on:
workflow_dispatch:
release:
types: [published]
defaults:
run:
shell: bash
working-directory: ./
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run tests
uses: ./.github/actions/lint
build-and-push-extension-catalog:
needs: lint
uses: ./.github/workflows/build-extension-catalog.yml
permissions:
actions: write
contents: read
packages: write
id-token: write
with:
registry_target: docker.io
registry_user: rancher
secrets: inherit
@@ -1,4 +1,4 @@
name: Build Harvester Dashboard and Upload name: Build Harvester Dashboard and Publish
on: on:
workflow_call: workflow_call:
@@ -0,0 +1,70 @@
name: Build and release Extension Catalog Image to registry
on:
workflow_call:
inputs:
registry_target:
required: true
type: string
registry_user:
required: true
type: string
outputs:
build-extension-catalog-job-status:
value: ${{ jobs.build-extension-catalog.outputs.build-status }}
jobs:
build-and-push-extension-catalog:
name: Build container image
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
packages: write
id-token: write
outputs:
build-status: ${{ job.status }}
steps:
- name: Read Secrets
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD ;
- name: Checkout repository (normal flow)
uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.8.0
- name: Setup Nodejs with yarn caching
uses: actions/setup-node@v4
with:
node-version: '20'
cache: yarn
- name: Install dependencies
run: yarn
- name: Build and push UI image
run: |
publish="yarn publish-pkgs -cp -r ${{ inputs.registry_target }} -o ${{ inputs.registry_user }}"
$publish
@@ -1,34 +0,0 @@
name: Build and Release Extension Charts
on:
workflow_dispatch:
release:
types: [released]
defaults:
run:
shell: bash
working-directory: ./
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run tests
uses: ./.github/actions/lint
build-extension-charts:
needs:
- lint
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
permissions:
actions: write
contents: write
deployments: write
pages: write
with:
target_branch: gh-pages
tagged_release: ${{ github.ref_name }}
@@ -0,0 +1,136 @@
name: Build and Release Extension Charts on PR Merge
on:
push:
branches:
- 'release-harvester-v*'
jobs:
setup-target-branch:
runs-on: ubuntu-latest
outputs:
target_branch: ${{ steps.get-version.outputs.target_branch }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Determine target branch
id: get-version
run: |
if [[ "${{ github.ref_name }}" =~ ^release-harvester-v([0-9]+\.[0-9]+)$ ]]; then
TARGET_BRANCH="v${BASH_REMATCH[1]}-head"
echo "target_branch=${TARGET_BRANCH}" >> $GITHUB_ENV
echo "target_branch=${TARGET_BRANCH}" >> $GITHUB_OUTPUT
else
echo "Error: invalid branch format." && exit 1
fi
- name: Ensure target branch exists
run: |
git fetch --all
if ! git ls-remote --exit-code --heads origin "${{ env.target_branch }}"; then
git checkout gh-pages
git checkout -b "${{ env.target_branch }}"
git push origin "${{ env.target_branch }}"
fi
extract-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract version from package.json
id: get_version
run: |
VERSION=$(jq -r '.version' pkg/harvester/package.json)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "version=${VERSION}" >> $GITHUB_OUTPUT
build-extension-charts:
needs:
- setup-target-branch
- extract-version
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
corepack enable
yarn install --frozen-lockfile
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.8.0
- name: Build Helm charts
run: |
yarn publish-pkgs -s ${{ github.repository }} -b ${{ needs.setup-target-branch.outputs.target_branch }} -t harvester-${{ needs.extract-version.outputs.version }}
- name: Upload charts artifact
uses: actions/upload-artifact@v4
with:
name: charts
path: tmp
release:
needs:
- setup-target-branch
- extract-version
- build-extension-charts
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: '${{ github.ref_name }}'
- name: Get last commit hash
id: last_commit
run: |
LAST_COMMIT=$(git rev-parse HEAD)
echo "LAST_COMMIT=${LAST_COMMIT}" >> $GITHUB_ENV
- name: Checkout target branch
uses: actions/checkout@v4
with:
ref: '${{ needs.setup-target-branch.outputs.target_branch }}'
- name: Remove old artifacts
run: |
rm -rf extensions/harvester/${{ needs.extract-version.outputs.version }}
rm -rf charts/harvester/${{ needs.extract-version.outputs.version }}
rm -f assets/harvester/harvester-${{ needs.extract-version.outputs.version }}.tgz
- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: charts
- name: Commit and push artifacts
run: |
git add ./{assets,charts,extensions,index.yaml}
git commit -m "CI Build Artifacts (commit: ${{ env.LAST_COMMIT }}, version: ${{ needs.extract-version.outputs.version }})"
git push origin ${{ needs.setup-target-branch.outputs.target_branch }}
- name: Run Helm chart releaser
uses: helm/chart-releaser-action@v1.4.1
with:
charts_dir: ./charts
env:
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
CR_SKIP_EXISTING: true
@@ -0,0 +1,53 @@
name: Build and Release Extension Charts on Release
on:
workflow_dispatch:
release:
types: [released]
defaults:
run:
shell: bash
working-directory: ./
jobs:
setup-release-tag:
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.determine_tag.outputs.release_tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Determine release tag
id: determine_tag
run: |
if [[ "${{ github.ref_name }}" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
RELEASE_TAG="harvester-${BASH_REMATCH[1]}"
echo "${RELEASE_TAG}"
echo "release_tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
else
echo "Error: invalid tag format." && exit 1
fi
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run tests
uses: ./.github/actions/lint
build-extension-charts:
needs:
- setup-release-tag
- lint
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
permissions:
actions: write
contents: write
deployments: write
pages: write
with:
target_branch: gh-pages
tagged_release: '${{ needs.setup-release-tag.outputs.release_tag }}'
@@ -1,4 +1,4 @@
name: Build Dashboard (Branch) name: Build Standalone on PR Merge
on: on:
push: push:
@@ -17,10 +17,10 @@ on:
jobs: jobs:
build-validation: build-validation:
name: Build Test name: Build Test
uses: ./.github/workflows/test.yaml uses: ./.github/workflows/run-lint.yaml
build: build:
name: Build and Upload Package name: Build and Upload Package
uses: ./.github/workflows/build-and-upload.yaml uses: ./.github/workflows/build-and-publish-standalone.yaml
needs: needs:
- build-validation - build-validation
permissions: permissions:
@@ -0,0 +1,21 @@
name: Build Standalone on Release
on:
push:
tags:
- v[1-9].*
jobs:
build-validation:
name: Build Test
uses: ./.github/workflows/run-lint.yaml
build:
name: Build and Upload Package
uses: ./.github/workflows/build-and-publish-standalone.yaml
needs:
- build-validation
permissions:
contents: read
packages: write
id-token: write
with:
CI_BUILD_TAG: ${{github.ref_name}}
+2 -15
View File
@@ -8,20 +8,7 @@ From Rancher 2.10.0, Harvester integration is provided by this new Harvester UI
## Installation ## Installation
To install the Harvester UI Extension in Rancher 2.10.0 and newer: To install the Harvester UI Extension in Rancher 2.10.0 and newer, please refer to [installation](https://docs.harvesterhci.io/v1.5/rancher/harvester-ui-extension#installation-on-rancher-210) on harvester doc.
- Go to 'Extensions' in the Rancher UI (click on the jigsaw icon in the side bar)
- From the three-dots menu in the upper right of the page, open the menu and select 'Manage Repositories'
- From the Repositories page, click 'Create'
- For name, enter 'harvester-ui-extension'
- For Target, choose 'Git repository'
- For Git Repo URL, enter `https://github.com/harvester/harvester-ui-extension`
- For Git Branch, enter `gh-pages`
- Click 'Create`
- From the Repositories list, wait until the new Repository added updates to the 'Active' state
- Go back to 'Extensions'
- Click on the 'Available' tab if not already selected
- Click on 'Install' for the Harvester UI Extension
## Running for Development ## Running for Development
@@ -70,7 +57,7 @@ For developers, after reading through the introduction on this page, head over t
License License
======= =======
Copyright (c) 2014-2023 [Rancher Labs, Inc.](http://rancher.com) Copyright (c) 2014-2025 [SUSE, LLC.](https://www.suse.com/)
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
+5 -4
View File
@@ -1,18 +1,19 @@
{ {
"name": "harvester-ui-extension", "name": "harvester-ui-extension",
"version": "0.1.0", "version": "1.5.0-rc4",
"private": false, "private": false,
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=20.0.0"
}, },
"dependencies": { "dependencies": {
"@rancher/shell": "3.0.1-rc.4", "@rancher/shell": "3.0.2-rc.6",
"cache-loader": "^4.1.0", "cache-loader": "^4.1.0",
"color": "4.2.3", "color": "4.2.3",
"ip": "2.0.1", "ip": "2.0.1",
"node-polyfill-webpack-plugin": "^3.0.0", "node-polyfill-webpack-plugin": "^3.0.0",
"sortablejs-vue3": "^1.2.11", "vue-draggable-next": "^2.2.1",
"yaml": "^2.5.1" "yaml": "^2.5.1",
"@babel/plugin-transform-class-static-block": "7.26.0"
}, },
"resolutions": { "resolutions": {
"@types/node": "~20.10.0", "@types/node": "~20.10.0",
+9 -1
View File
@@ -1 +1,9 @@
module.exports = require('@rancher/shell/pkg/babel.config'); const baseConfig = require('@rancher/shell/pkg/babel.config');
module.exports = {
...baseConfig,
plugins: [
...(baseConfig.plugins || []),
'@babel/plugin-transform-class-static-block'
]
};
+18 -6
View File
@@ -25,6 +25,9 @@ export default {
return Array.from(new Set(options)); return Array.from(new Set(options));
}, },
enableFilterButton() {
return this.rows.some((r) => r.sourceSchedule !== undefined);
}
}, },
methods: { methods: {
@@ -63,27 +66,30 @@ export default {
</script> </script>
<template> <template>
<div class="vm-schedule-filter"> <div
<template> class="vm-schedule-filter"
>
<span <span
v-if="selected" v-if="selected"
class="banner-item bg-warning" class="banner-item bg-warning"
> >
{{ t('harvester.tableHeaders.vmSchedule') }}{{ selected ? ` = ${selected}`: '' }}<i {{ t('harvester.tableHeaders.vmSchedule') }}{{ selected ? ` = ${selected}`: '' }}
<i
class="icon icon-close ml-5" class="icon icon-close ml-5"
@click="remove" @click="remove"
/> />
</span> </span>
</template>
<v-dropdown <v-dropdown
popper-class="vm-schedule-dropdown"
:triggers="scheduleOptions.length ? ['click'] : []" :triggers="scheduleOptions.length ? ['click'] : []"
placement="bottom-end" placement="bottom-end"
offset="1" offset="1"
:distance="20"
> >
<button <button
ref="actionDropDown" ref="actionDropDown"
class="btn bg-primary mr-10" class="btn bg-primary mr-10"
:disabled="!enableFilterButton"
> >
<slot name="title"> <slot name="title">
{{ t('harvester.fields.filterSchedule') }} {{ t('harvester.fields.filterSchedule') }}
@@ -98,7 +104,7 @@ export default {
name="model" name="model"
:options="scheduleOptions" :options="scheduleOptions"
:labels="scheduleOptions" :labels="scheduleOptions"
@input="onSelect" @update:value="onSelect"
/> />
</div> </div>
</template> </template>
@@ -106,6 +112,12 @@ export default {
</div> </div>
</template> </template>
<style lang="scss">
.vm-schedule-dropdown .v-popper__arrow-container {
display: none;
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
.vm-schedule-filter { .vm-schedule-filter {
display: inline-block; display: inline-block;
@@ -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',
@@ -34,6 +36,7 @@ export default {
selectMode: true, selectMode: true,
version: '', version: '',
enableLogging: true, enableLogging: true,
skipSingleReplicaDetachedVol: false,
readyReleaseNote: false, readyReleaseNote: false,
isOpen: 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)"
@@ -190,6 +190,7 @@ export default {
v-clean-tooltip="{ v-clean-tooltip="{
placement: 'bottom-left', placement: 'bottom-left',
}" }"
popper-class="upgrade-header-dropdown"
class="hand" class="hand"
> >
<slot name="button-content"> <slot name="button-content">
@@ -272,7 +273,7 @@ export default {
<p <p
v-if="overallMessage" v-if="overallMessage"
class="text-warning mb-20" class="text-error mb-20"
> >
{{ overallMessage }} {{ overallMessage }}
</p> </p>
@@ -300,14 +301,14 @@ export default {
<ProgressBarList <ProgressBarList
:title="t('harvester.upgradePage.upgradeNode')" :title="t('harvester.upgradePage.upgradeNode')"
:precent="nodesPercent" :percent="nodesPercent"
:list="nodesStatus" :list="nodesStatus"
/> />
<p class="bordered-section"></p> <p class="bordered-section"></p>
<ProgressBarList <ProgressBarList
:title="t('harvester.upgradePage.upgradeSysService')" :title="t('harvester.upgradePage.upgradeSysService')"
:precent="sysServiceTotal" :percent="sysServiceTotal"
:list="sysServiceUpgradeMessage" :list="sysServiceUpgradeMessage"
/> />
</div> </div>
@@ -338,6 +339,12 @@ export default {
</div> </div>
</template> </template>
<style lang="scss">
.upgrade-header-dropdown .v-popper__arrow-container {
display: none;
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
a { a {
float: right; float: right;
@@ -12,7 +12,7 @@ export default {
default: '' default: ''
}, },
precent: { percent: {
type: Number, type: Number,
default: 0 default: 0
}, },
@@ -39,16 +39,18 @@ export default {
<template> <template>
<div class="bar-list"> <div class="bar-list">
<h4>{{ title }} <span class="float-r text-info">{{ precent }}%</span></h4> <h4>{{ title }} <span class="float-r text-info">{{ percent }}%</span></h4>
<div> <div>
<div> <div>
<Collapse v-model:open="open"> <Collapse v-model:open="open">
<template #title> <template #title>
<div class="total-bar"> <div class="total-bar">
<span class="bar"><PercentageBar <span class="bar">
:model-value="precent" <PercentageBar
:model-value="percent"
preferred-direction="MORE" preferred-direction="MORE"
/></span> />
</span>
<span <span
class="on-off" class="on-off"
@click="handleSwitch" @click="handleSwitch"
@@ -56,7 +58,6 @@ export default {
</div> </div>
</template> </template>
<template>
<div class="custom-content"> <div class="custom-content">
<div <div
v-for="(item, i) in list" v-for="(item, i) in list"
@@ -77,7 +78,6 @@ export default {
</p> </p>
</div> </div>
</div> </div>
</template>
</Collapse> </Collapse>
</div> </div>
</div> </div>
@@ -93,7 +93,7 @@ export default {
.total-bar { .total-bar {
display: flex; display: flex;
user-select: none; user-select: none;
.bar { > .bar {
width: 85%; width: 85%;
} }
.on-off { .on-off {
@@ -102,7 +102,6 @@ export default {
} }
} }
.custom-content { .custom-content {
.item {
margin-bottom: 14px; margin-bottom: 14px;
p { p {
margin-bottom: 4px; margin-bottom: 4px;
@@ -120,7 +119,5 @@ export default {
color: var(--error); color: var(--error);
} }
} }
}
} }
</style> </style>
@@ -60,7 +60,8 @@ export default {
}); });
this.queue = []; this.queue = [];
}, 5) }, 10),
deep: true
} }
}, },
@@ -6,6 +6,7 @@ import CreateEditView from '@shell/mixins/create-edit-view';
import { LabeledInput } from '@components/Form/LabeledInput'; import { LabeledInput } from '@components/Form/LabeledInput';
import LabeledSelect from '@shell/components/form/LabeledSelect'; import LabeledSelect from '@shell/components/form/LabeledSelect';
import { HCI_SETTING } from '../../config/settings'; import { HCI_SETTING } from '../../config/settings';
import UnitInput from '@shell/components/form/UnitInput';
const DEFAULT_TYPE = 's3'; const DEFAULT_TYPE = 's3';
@@ -13,7 +14,7 @@ export default {
name: 'HarvesterEditBackupTarget', name: 'HarvesterEditBackupTarget',
components: { components: {
LabeledInput, LabeledSelect, Tip, Password, MessageLink LabeledInput, LabeledSelect, Tip, Password, MessageLink, UnitInput
}, },
mixins: [CreateEditView], mixins: [CreateEditView],
@@ -24,7 +25,9 @@ export default {
try { try {
parseDefaultValue = JSON.parse(this.value.value); parseDefaultValue = JSON.parse(this.value.value);
} catch (error) { } catch (error) {
parseDefaultValue = { type: '', endpoint: '' }; parseDefaultValue = {
type: '', endpoint: '', refreshIntervalInSeconds: 0
};
} }
// set default type to s3 // set default type to s3
@@ -62,6 +65,10 @@ export default {
}]; }];
}, },
refreshIntervalInSecondEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('refreshIntervalInSecond');
},
isS3() { isS3() {
return this.parseDefaultValue.type === DEFAULT_TYPE; return this.parseDefaultValue.type === DEFAULT_TYPE;
}, },
@@ -83,7 +90,9 @@ export default {
try { try {
parseDefaultValue = JSON.parse(neu.value); parseDefaultValue = JSON.parse(neu.value);
} catch (err) { } catch (err) {
parseDefaultValue = { type: '', endpoint: '' }; parseDefaultValue = {
type: '', endpoint: '', refreshIntervalInSeconds: 0
};
} }
this['parseDefaultValue'] = parseDefaultValue; this['parseDefaultValue'] = parseDefaultValue;
@@ -111,7 +120,6 @@ export default {
if (this.isS3 && !this.parseDefaultValue.virtualHostedStyle) { if (this.isS3 && !this.parseDefaultValue.virtualHostedStyle) {
this.parseDefaultValue.virtualHostedStyle = false; this.parseDefaultValue.virtualHostedStyle = false;
} }
if (!this.parseDefaultValue.type) { if (!this.parseDefaultValue.type) {
delete this.value['value']; delete this.value['value'];
} else { } else {
@@ -120,7 +128,9 @@ export default {
}, },
useDefault() { useDefault() {
this['parseDefaultValue'] = { type: '', endpoint: '' }; this['parseDefaultValue'] = {
type: '', endpoint: '', refreshIntervalInSeconds: 0
};
} }
} }
}; };
@@ -139,6 +149,23 @@ export default {
:options="typeOption" :options="typeOption"
@update:value="update" @update:value="update"
/> />
<UnitInput
v-if="refreshIntervalInSecondEnabled"
v-model:value="parseDefaultValue.refreshIntervalInSeconds"
:suffix="parseDefaultValue.refreshIntervalInSeconds <= 1 ? 'Second' : 'Seconds'"
:label="t('harvester.backup.refreshInterval.label')"
:mode="mode"
:positive="true"
class="mb-5"
required
@update:value="update"
/>
<Tip
v-if="refreshIntervalInSecondEnabled"
class="mb-20"
icon="icon icon-info"
:text="t('harvester.backup.refreshInterval.tip')"
/>
<LabeledInput <LabeledInput
v-model:value="parseDefaultValue.endpoint" v-model:value="parseDefaultValue.endpoint"
class="mb-5" class="mb-5"
@@ -75,7 +75,11 @@ export default {
const csiDrivers = this.$store.getters[`${ inStore }/all`](CSI_DRIVER) || []; const csiDrivers = this.$store.getters[`${ inStore }/all`](CSI_DRIVER) || [];
return this.configArr.length >= csiDrivers.length; return this.configArr.length >= csiDrivers.length;
} },
allowEmptySnapshotClassNameFeatureEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('allowEmptySnapshotClassName');
},
}, },
methods: { methods: {
@@ -139,7 +143,7 @@ export default {
errors.push(this.t('validation.required', { key: this.t('harvester.setting.csiDriverConfig.volumeSnapshotClassName') }, true)); errors.push(this.t('validation.required', { key: this.t('harvester.setting.csiDriverConfig.volumeSnapshotClassName') }, true));
} }
if (!config.value.backupVolumeSnapshotClassName) { if (!this.allowEmptySnapshotClassNameFeatureEnabled && !config.value.backupVolumeSnapshotClassName) {
errors.push(this.t('validation.required', { key: this.t('harvester.setting.csiDriverConfig.backupVolumeSnapshotClassName') }, true)); errors.push(this.t('validation.required', { key: this.t('harvester.setting.csiDriverConfig.backupVolumeSnapshotClassName') }, true));
} }
}); });
@@ -158,10 +162,18 @@ export default {
this.configArr.splice(idx, 1); this.configArr.splice(idx, 1);
}, },
isBackupVolumeSnapshotRequired(driver) {
return driver === LONGHORN_DRIVER;
},
disableEdit(driver) { disableEdit(driver) {
return driver === LONGHORN_DRIVER; return driver === LONGHORN_DRIVER;
}, },
isBackupVolumeSnapshotClassNameDisabled(driver) {
return driver === LONGHORN_DRIVER || this.allowEmptySnapshotClassNameFeatureEnabled;
},
add() { add() {
this.configArr.push({ this.configArr.push({
key: '', key: '',
@@ -184,6 +196,7 @@ export default {
<InfoBox <InfoBox
v-for="(driver, idx) in configArr" v-for="(driver, idx) in configArr"
:key="idx" :key="idx"
class="box"
> >
<button <button
:disabled="disableEdit(driver.key)" :disabled="disableEdit(driver.key)"
@@ -226,9 +239,9 @@ export default {
<LabeledSelect <LabeledSelect
v-model:value="driver.value.backupVolumeSnapshotClassName" v-model:value="driver.value.backupVolumeSnapshotClassName"
:mode="mode" :mode="mode"
required :disabled="isBackupVolumeSnapshotClassNameDisabled(driver.key)"
:disabled="disableEdit(driver.key)"
:options="getVolumeSnapshotOptions(driver.key)" :options="getVolumeSnapshotOptions(driver.key)"
:required="isBackupVolumeSnapshotRequired(driver.key)"
:label="t('harvester.setting.csiDriverConfig.backupVolumeSnapshotClassName')" :label="t('harvester.setting.csiDriverConfig.backupVolumeSnapshotClassName')"
@keydown.native.enter.prevent="()=>{}" @keydown.native.enter.prevent="()=>{}"
@update:value="update" @update:value="update"
@@ -12,6 +12,9 @@ import { NODE } from '@shell/config/types';
import { HCI } from '../../types'; import { HCI } from '../../types';
import { DOC } from '../../config/doc-links'; import { DOC } from '../../config/doc-links';
import { docLink } from '../../utils/feature-flags'; import { docLink } from '../../utils/feature-flags';
import { NETWORK_TYPE } from '../../config/types';
const { L2VLAN, UNTAGGED } = NETWORK_TYPE;
export default { export default {
name: 'HarvesterEditStorageNetwork', name: 'HarvesterEditStorageNetwork',
@@ -57,11 +60,14 @@ export default {
data() { data() {
let parsedDefaultValue = {}; let parsedDefaultValue = {};
let openVlan = false; let openVlan = false;
let networkType = L2VLAN;
try { try {
parsedDefaultValue = JSON.parse(this.value.value); parsedDefaultValue = JSON.parse(this.value.value);
networkType = 'vlan' in parsedDefaultValue ? L2VLAN : UNTAGGED; // backend doesn't provide networkType, so we check if vlan is provided instead
openVlan = true; openVlan = true;
} catch (error) { } catch (error) {
networkType = L2VLAN;
parsedDefaultValue = { parsedDefaultValue = {
vlan: '', vlan: '',
clusterNetwork: '', clusterNetwork: '',
@@ -73,6 +79,7 @@ export default {
return { return {
openVlan, openVlan,
networkType,
errors: [], errors: [],
exclude, exclude,
parsedDefaultValue, parsedDefaultValue,
@@ -87,16 +94,35 @@ export default {
}, },
computed: { computed: {
showVlan() {
return this.networkType === L2VLAN;
},
networkTypes() {
const types = [L2VLAN];
if (this.untaggedNetworkSettingEnabled) {
types.push(UNTAGGED);
}
return types;
},
storageNetworkExampleLink() { storageNetworkExampleLink() {
const version = this.$store.getters['harvester-common/getServerVersion'](); const version = this.$store.getters['harvester-common/getServerVersion']();
return docLink(DOC.STORAGE_NETWORK_EXAMPLE, version); return docLink(DOC.STORAGE_NETWORK_EXAMPLE, version);
}, },
untaggedNetworkSettingEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('untaggedNetworkSetting');
},
clusterNetworkOptions() { clusterNetworkOptions() {
const inStore = this.$store.getters['currentProduct'].inStore; const inStore = this.$store.getters['currentProduct'].inStore;
const clusterNetworks = this.$store.getters[`${ inStore }/all`](HCI.CLUSTER_NETWORK) || []; const clusterNetworks = this.$store.getters[`${ inStore }/all`](HCI.CLUSTER_NETWORK) || [];
// untaggedNetwork filter out mgmt cluster network
const clusterNetworksOptions = this.networkType === UNTAGGED ? clusterNetworks.filter((net) => net.id !== 'mgmt') : clusterNetworks;
return clusterNetworks.map((n) => { return clusterNetworksOptions.map((n) => {
const disabled = !n.isReadyForStorageNetwork; const disabled = !n.isReadyForStorageNetwork;
return { return {
@@ -108,7 +134,50 @@ export default {
}, },
}, },
watch: {
networkType: {
handler(neu) {
this.parsedDefaultValue.clusterNetwork = '';
if (neu === L2VLAN) {
this.parsedDefaultValue.vlan = '';
} else {
delete this.parsedDefaultValue.vlan;
}
},
deep: true
}
},
methods: { methods: {
inputVlan(neu) {
if (neu === '') {
this.parsedDefaultValue.vlan = '';
return;
}
const newValue = Number(neu);
if (newValue > 4094) {
this.parsedDefaultValue.vlan = 4094;
} else if (newValue < 1) {
this.parsedDefaultValue.vlan = 1;
} else {
this.parsedDefaultValue.vlan = newValue;
}
},
useDefault() {
this.openVlan = false;
this.networkType = L2VLAN;
this.parsedDefaultValue = {
vlan: '',
clusterNetwork: '',
range: '',
exclude: []
};
},
update() { update() {
const exclude = this.exclude.filter((ip) => ip); const exclude = this.exclude.filter((ip) => ip);
@@ -138,7 +207,7 @@ export default {
errors.push(this.t('harvester.setting.storageNetwork.range.invalid', null, true)); errors.push(this.t('harvester.setting.storageNetwork.range.invalid', null, true));
} }
if (!this.parsedDefaultValue.vlan) { if (this.networkType === L2VLAN && !this.parsedDefaultValue.vlan) {
errors.push(this.t('validation.required', { key: this.t('harvester.setting.storageNetwork.vlan') }, true)); errors.push(this.t('validation.required', { key: this.t('harvester.setting.storageNetwork.vlan') }, true));
} }
@@ -191,13 +260,25 @@ export default {
/> />
<div v-if="openVlan"> <div v-if="openVlan">
<LabeledSelect
v-model:value="networkType"
class="mb-20"
:options="networkTypes"
:mode="mode"
:label="t('harvester.fields.type')"
required
/>
<LabeledInput <LabeledInput
v-if="showVlan"
v-model:value.number="parsedDefaultValue.vlan" v-model:value.number="parsedDefaultValue.vlan"
type="number" type="number"
class="mb-20" class="mb-20"
:mode="mode" :mode="mode"
required required
placeholder="e.g. 1 - 4094"
label-key="harvester.setting.storageNetwork.vlan" label-key="harvester.setting.storageNetwork.vlan"
@update:value="inputVlan"
/> />
<LabeledSelect <LabeledSelect
+28 -3
View File
@@ -17,9 +17,15 @@ const featuresV132 = [
'improveMaintenanceMode', 'improveMaintenanceMode',
]; ];
// TODO: add v1.3.3 official release note
// https://github.com/harvester/dashboard/releases/tag/v1.3.3-dev-20250105
const featuresV133 = [
...featuresV132,
];
// https://github.com/harvester/dashboard/releases/tag/v1.4.0 // https://github.com/harvester/dashboard/releases/tag/v1.4.0
const featuresV140 = [ const featuresV140 = [
...featuresV132, ...featuresV133,
'cpuPinning', 'cpuPinning',
'usbPassthrough', 'usbPassthrough',
'volumeEncryption', 'volumeEncryption',
@@ -29,16 +35,35 @@ const featuresV140 = [
'improveMaintenanceMode', 'improveMaintenanceMode',
]; ];
// TODO: add v1.4.1 official release note // https://github.com/harvester/dashboard/releases/tag/v1.4.1
// https://github.com/harvester/dashboard/releases/tag/v1.4.1-rc1
const featuresV141 = [ const featuresV141 = [
...featuresV140 ...featuresV140
]; ];
// TODO: add v1.4.2 official release note
const featuresV142 = [
...featuresV141,
'refreshIntervalInSecond',
'allowEmptySnapshotClassName'
];
// TODO: add v1.5.0 official release note
const featuresV150 = [
...featuresV142,
'tpmPersistentState',
'efiPersistentState',
'untaggedNetworkSetting',
'skipSingleReplicaDetachedVol',
'thirdPartyStorage'
];
export const RELEASE_FEATURES = { export const RELEASE_FEATURES = {
'v1.3.0': featuresV130, 'v1.3.0': featuresV130,
'v1.3.1': featuresV131, 'v1.3.1': featuresV131,
'v1.3.2': featuresV132, 'v1.3.2': featuresV132,
'v1.3.3': featuresV133,
'v1.4.0': featuresV140, 'v1.4.0': featuresV140,
'v1.4.1': featuresV141, 'v1.4.1': featuresV141,
'v1.4.2': featuresV142,
'v1.5.0': featuresV150
}; };
+3 -1
View File
@@ -31,7 +31,8 @@ import {
FINGERPRINT, FINGERPRINT,
IMAGE_PROGRESS, IMAGE_PROGRESS,
SNAPSHOT_TARGET_VOLUME, SNAPSHOT_TARGET_VOLUME,
IMAGE_VIRTUAL_SIZE IMAGE_VIRTUAL_SIZE,
IMAGE_STORAGE_CLASS
} from './table-headers'; } from './table-headers';
const TEMPLATE = HCI.VM_VERSION; const TEMPLATE = HCI.VM_VERSION;
@@ -221,6 +222,7 @@ export function init($plugin, store) {
STATE, STATE,
NAME_COL, NAME_COL,
NAMESPACE_COL, NAMESPACE_COL,
IMAGE_STORAGE_CLASS,
IMAGE_PROGRESS, IMAGE_PROGRESS,
IMAGE_DOWNLOAD_SIZE, IMAGE_DOWNLOAD_SIZE,
IMAGE_VIRTUAL_SIZE, IMAGE_VIRTUAL_SIZE,
+1
View File
@@ -1,3 +1,4 @@
// TODO: delete this not used variable
export const MemoryUnit = [{ export const MemoryUnit = [{
label: 'Mi', label: 'Mi',
value: 'Mi' value: 'Mi'
@@ -15,6 +15,7 @@ export const HCI = {
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',
GOLDEN_IMAGE: 'harvesterhci.io/goldenImage',
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',
@@ -43,11 +44,13 @@ export const HCI = {
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',
SKIP_SINGLE_REPLICA_DETACHED_VOL: 'harvesterhci.io/skipSingleReplicaDetachedVol',
HOST_REQUEST: 'management.cattle.io/pod-requests', HOST_REQUEST: 'management.cattle.io/pod-requests',
STORAGE_CLASS: 'harvesterhci.io/storageClassName', STORAGE_CLASS: 'harvesterhci.io/storageClassName',
STORAGE_NETWORK: 'storage-network.settings.harvesterhci.io', STORAGE_NETWORK: 'storage-network.settings.harvesterhci.io',
ADDON_EXPERIMENTAL: 'addon.harvesterhci.io/experimental', ADDON_EXPERIMENTAL: 'addon.harvesterhci.io/experimental',
VOLUME_ERROR: 'longhorn.io/volume-scheduling-error', VOLUME_ERROR: 'longhorn.io/volume-scheduling-error',
VOLUME_FOR_VM: 'harvesterhci.io/volumeForVirtualMachine',
KVM_AMD_CPU: 'cpu-feature.node.kubevirt.io/svm', KVM_AMD_CPU: 'cpu-feature.node.kubevirt.io/svm',
KVM_INTEL_CPU: 'cpu-feature.node.kubevirt.io/vmx', KVM_INTEL_CPU: 'cpu-feature.node.kubevirt.io/vmx',
NODE_MANUFACTURER: 'manufacturer', NODE_MANUFACTURER: 'manufacturer',
+3 -1
View File
@@ -65,7 +65,9 @@ export const HCI_ALLOWED_SETTINGS = {
[HCI_SETTING.SUPPORT_BUNDLE_EXPIRATION]: {}, [HCI_SETTING.SUPPORT_BUNDLE_EXPIRATION]: {},
[HCI_SETTING.SUPPORT_BUNDLE_NODE_COLLECTION_TIMEOUT]: { featureFlag: 'supportBundleNodeCollectionTimeoutSetting' }, [HCI_SETTING.SUPPORT_BUNDLE_NODE_COLLECTION_TIMEOUT]: { featureFlag: 'supportBundleNodeCollectionTimeoutSetting' },
[HCI_SETTING.SUPPORT_BUNDLE_IMAGE]: { kind: 'json', from: 'import' }, [HCI_SETTING.SUPPORT_BUNDLE_IMAGE]: { kind: 'json', from: 'import' },
[HCI_SETTING.STORAGE_NETWORK]: { kind: 'custom', from: 'import' }, [HCI_SETTING.STORAGE_NETWORK]: {
kind: 'custom', from: 'import', canReset: true
},
[HCI_SETTING.VM_FORCE_RESET_POLICY]: { kind: 'json', from: 'import' }, [HCI_SETTING.VM_FORCE_RESET_POLICY]: { kind: 'json', from: 'import' },
[HCI_SETTING.SSL_CERTIFICATES]: { kind: 'json', from: 'import' }, [HCI_SETTING.SSL_CERTIFICATES]: { kind: 'json', from: 'import' },
[HCI_SETTING.SSL_PARAMETERS]: { [HCI_SETTING.SSL_PARAMETERS]: {
+10
View File
@@ -88,3 +88,13 @@ export const MACHINE_POOLS = {
align: 'center', align: 'center',
width: 100, width: 100,
}; };
// The STORAGE_CLASS column in VM image list page
export const IMAGE_STORAGE_CLASS = {
name: 'imageStorageClass',
labelKey: 'harvester.tableHeaders.storageClass',
sort: 'imageStorageClass',
value: 'imageStorageClass',
align: 'left',
width: 200,
};
+10
View File
@@ -2,3 +2,13 @@ export const BACKUP_TYPE = {
BACKUP: 'backup', BACKUP: 'backup',
SNAPSHOT: 'snapshot' SNAPSHOT: 'snapshot'
}; };
export const NETWORK_TYPE = {
L2VLAN: 'L2VlanNetwork',
UNTAGGED: 'UntaggedNetwork'
};
export const VOLUME_MODE = {
BLOCK: 'Block',
FILE_SYSTEM: 'Filesystem'
};
@@ -4,6 +4,7 @@ import { formatSi, exponentNeeded, UNITS } from '@shell/utils/units';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
import { LONGHORN, METRIC } from '@shell/config/types'; import { LONGHORN, METRIC } from '@shell/config/types';
import { Banner } from '@components/Banner'; import { Banner } from '@components/Banner';
import { UNIT_SUFFIX } from '../../utils/unit';
import HarvesterCPUUsed from '../../formatters/HarvesterCPUUsed'; import HarvesterCPUUsed from '../../formatters/HarvesterCPUUsed';
import HarvesterMemoryUsed from '../../formatters/HarvesterMemoryUsed'; import HarvesterMemoryUsed from '../../formatters/HarvesterMemoryUsed';
import HarvesterStorageUsed from '../../formatters/HarvesterStorageUsed'; import HarvesterStorageUsed from '../../formatters/HarvesterStorageUsed';
@@ -121,7 +122,7 @@ export default {
memoryUnits() { memoryUnits() {
const exponent = exponentNeeded(this.memoryTotal, 1024); const exponent = exponentNeeded(this.memoryTotal, 1024);
return `${ UNITS[exponent] }iB`; return `${ UNITS[exponent] }${ UNIT_SUFFIX }`;
}, },
nodeType() { nodeType() {
@@ -24,35 +24,24 @@ export default {
}, },
async fetch() { async fetch() {
const hash = await allHash({ await allHash({
vms: this.$store.dispatch('harvester/findAll', { type: HCI.VM }), vms: this.$store.dispatch('harvester/findAll', { type: HCI.VM }),
vmis: this.$store.dispatch('harvester/findAll', { type: HCI.VMI }), vmis: this.$store.dispatch('harvester/findAll', { type: HCI.VMI }),
allClusterNetwork: this.$store.dispatch('harvester/findAll', { type: HCI.CLUSTER_NETWORK }), allClusterNetwork: this.$store.dispatch('harvester/findAll', { type: HCI.CLUSTER_NETWORK }),
}); });
const instanceMap = {};
(hash.vmis || []).forEach((vmi) => {
const vmiUID = vmi?.metadata?.ownerReferences?.[0]?.uid;
if (vmiUID) {
instanceMap[vmiUID] = vmi;
}
});
this.allClusterNetwork = hash.allClusterNetwork;
this.rows = hash.vms.filter((row) => {
return instanceMap[row.metadata?.uid]?.status?.nodeName === this.node?.metadata?.labels?.[HOSTNAME];
});
},
data() {
return {
rows: [],
allClusterNetwork: []
};
}, },
computed: { computed: {
allClusterNetwork() {
return this.$store.getters['harvester/all'](HCI.CLUSTER_NETWORK);
},
rows() {
const vms = this.$store.getters['harvester/all'](HCI.VM);
return vms.filter((vm) => vm.vmi?.status?.nodeName === this.node?.metadata?.labels?.[HOSTNAME]);
},
headers() { headers() {
return [ return [
STATE, STATE,
@@ -87,8 +76,6 @@ export default {
]; ];
}, },
}, },
methods: {}
}; };
</script> </script>
@@ -9,7 +9,7 @@ import ArrayListGrouped from '@shell/components/form/ArrayListGrouped';
import Loading from '@shell/components/Loading.vue'; import Loading from '@shell/components/Loading.vue';
import SortableTable from '@shell/components/SortableTable'; import SortableTable from '@shell/components/SortableTable';
import Banner from '@components/Banner/Banner.vue'; import Banner from '@components/Banner/Banner.vue';
import { UNIT_SUFFIX } from '../../utils/unit';
import metricPoller from '@shell/mixins/metric-poller'; import metricPoller from '@shell/mixins/metric-poller';
import { import {
METRIC, NODE, LONGHORN, POD, EVENT METRIC, NODE, LONGHORN, POD, EVENT
@@ -178,7 +178,7 @@ export default {
minExponent: 3, minExponent: 3,
maxExponent: 3, maxExponent: 3,
maxPrecision: 2, maxPrecision: 2,
suffix: 'iB', suffix: UNIT_SUFFIX,
}; };
const longhornDisks = Object.keys(diskStatus).map((key) => { const longhornDisks = Object.keys(diskStatus).map((key) => {
@@ -0,0 +1,175 @@
<script>
import { mapState } from 'vuex';
import { exceptionToErrorsArray } from '@shell/utils/error';
import { alternateLabel } from '@shell/utils/platform';
import AsyncButton from '@shell/components/AsyncButton';
import { Banner } from '@components/Banner';
import { Card } from '@components/Card';
import { escapeHtml } from '@shell/utils/string';
/**
* @name ConfirmExecutionDialog
* @description Dialog component to confirm the related resources before executing the action.
*/
export default {
name: 'ConfirmExecutionDialog',
emits: ['close'],
components: {
AsyncButton,
Banner,
Card,
},
props: {
/**
* @property resources to be deleted.
* @type {Resource[]} Array of the resource model's instance
*/
resources: {
type: Array,
required: true
}
},
data() {
return { errors: [] };
},
computed: {
...mapState('action-menu', ['modalData']),
warningMessageKey() {
return this.modalData.warningMessageKey;
},
names() {
return this.resources.map((obj) => obj.nameDisplay).slice(0, 5);
},
resourceNames() {
return this.names.reduce((res, name, i) => {
if (i >= 5) {
return res;
}
res += `<b>${ escapeHtml(name) }</b>`;
if (i === this.names.length - 1) {
res += this.plusMore;
} else {
res += i === this.resources.length - 2 ? ' and ' : ', ';
}
return res;
}, '');
},
plusMore() {
const remaining = this.resources.length - this.names.length;
return this.t('dialog.confirmExecution.andOthers', { count: remaining });
},
type() {
const types = new Set(this.resources.reduce((array, each) => {
array.push(each.type);
return array;
}, []));
if (types.size > 1) {
return this.t('generic.resource', { count: this.resources.length });
}
const schema = this.resources[0]?.schema;
if ( !schema ) {
return `resource${ this.resources.length === 1 ? '' : 's' }`;
}
return this.$store.getters['type-map/labelFor'](schema, this.resources.length);
},
protip() {
return this.t('dialog.confirmExecution.protip', { alternateLabel });
},
},
methods: {
escapeHtml,
close() {
this.errors = [];
this.$emit('close');
},
async apply(buttonDone) {
try {
for (const resource of this.resources) {
await resource.doActionGrowl(this.modalData.action, {});
}
buttonDone(true);
this.close();
} catch (e) {
this.errors = exceptionToErrorsArray(e);
buttonDone(false);
}
}
}
};
</script>
<template>
<Card :show-highlight-border="false">
<template #title>
<h4 class="text-default-text">
{{ t('dialog.confirmExecution.title') }}
</h4>
</template>
<template #body>
<div class="pl-10 pr-10">
<span
v-clean-html="t(warningMessageKey, { type, names: resourceNames }, true)"
></span>
<div class="text-info mt-20">
{{ protip }}
</div>
<Banner
v-for="(error, i) in errors"
:key="i"
:label="error"
color="error"
/>
</div>
</template>
<template #actions>
<div class="actions">
<button
class="btn role-secondary"
@click="close"
>
{{ t('generic.cancel') }}
</button>
<AsyncButton
mode="apply"
class="btn bg-primary ml-10"
:disabled="applyDisabled"
@click="apply"
/>
</div>
</template>
</Card>
</template>
<style lang='scss' scoped>
.modal-container {
max-width: 400px;
}
.actions {
width: 100%;
text-align: right;
}
</style>
@@ -166,6 +166,8 @@ export default {
<Banner <Banner
v-for="(error, i) in errors" v-for="(error, i) in errors"
:key="i" :key="i"
:label="error"
color="error"
/> />
</div> </div>
</template> </template>
+6 -7
View File
@@ -106,6 +106,12 @@ export default {
:label="t('harvester.modal.cloneVM.name')" :label="t('harvester.modal.cloneVM.name')"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
:label="err"
color="error"
/>
</template> </template>
<template #actions> <template #actions>
@@ -125,13 +131,6 @@ export default {
@click="create" @click="create"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -137,6 +137,12 @@ export default {
class="mt-20" class="mt-20"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
:label="err"
color="error"
/>
</template> </template>
<template #actions> <template #actions>
@@ -156,11 +162,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -103,6 +103,12 @@ export default {
:label="t('generic.name')" :label="t('generic.name')"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -121,13 +127,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -120,6 +120,12 @@ export default {
v-model:value="description" v-model:value="description"
:label="t('harvester.modal.createTemplate.description')" :label="t('harvester.modal.createTemplate.description')"
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -138,11 +144,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -128,6 +128,12 @@ export default {
<Banner color="warning"> <Banner color="warning">
<span>{{ t('harvester.modal.ejectCDROM.warnTip') }}</span> <span>{{ t('harvester.modal.ejectCDROM.warnTip') }}</span>
</Banner> </Banner>
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -147,13 +153,6 @@ export default {
@click="remove" @click="remove"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -34,9 +34,14 @@ export default {
await allHash(hash); await allHash(hash);
const defaultStorage = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS).find((s) => s.isDefault); const allStorages = this.allStorageClasses;
const defaultStorage = allStorages.find((s) => s.isDefault);
if (this.isLonghornV1Volume) {
this['storageClassName'] = defaultStorage?.metadata?.name || 'longhorn'; this['storageClassName'] = defaultStorage?.metadata?.name || 'longhorn';
} else {
this['storageClassName'] = this.nonLonghornV1StorageClasses[0]?.metadata?.name || '';
}
}, },
data() { data() {
@@ -54,7 +59,7 @@ export default {
...mapGetters({ t: 'i18n/t' }), ...mapGetters({ t: 'i18n/t' }),
actionResource() { actionResource() {
return this.resources[0]; return this.resources[0] || {};
}, },
namespaces() { namespaces() {
@@ -73,15 +78,33 @@ export default {
return out; return out;
}, },
isLonghornV1Volume() {
return this.actionResource?.isLonghornV1 === true;
},
disableSave() { disableSave() {
return !(this.name && this.namespace && this.storageClassName); return !(this.name && this.namespace && this.storageClassName);
}, },
storageClassOptions() { allStorageClasses() {
const inStore = this.$store.getters['currentProduct'].inStore; const inStore = this.$store.getters['currentProduct'].inStore;
const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
const out = storages.filter((s) => !s.parameters?.backingImage).map((s) => { return this.$store.getters[`${ inStore }/all`](STORAGE_CLASS) || [];
},
nonLonghornV1StorageClasses() {
return this.allStorageClasses.filter((s) => s.isLonghornV1 === false) || [];
},
storageClassOptions() {
let storages = this.allStorageClasses;
// Volume with non-longhorn v1 sc can't be exported to longhorn v1 sc image
if (!this.isLonghornV1Volume) {
storages = this.allStorageClasses.filter((s) => s.isLonghornV1 === false);
}
const options = storages.filter((s) => !s.parameters?.backingImage).map((s) => {
const label = s.isDefault ? `${ s.name } (${ this.t('generic.default') })` : s.name; const label = s.isDefault ? `${ s.name } (${ this.t('generic.default') })` : s.name;
return { return {
@@ -90,7 +113,7 @@ export default {
}; };
}) || []; }) || [];
return out; return options;
}, },
}, },
@@ -164,6 +187,12 @@ export default {
class="mt-20" class="mt-20"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -182,11 +211,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -0,0 +1,165 @@
<script>
import { mapGetters } from 'vuex';
import { exceptionToErrorsArray } from '@shell/utils/error';
import { HCI } from '../types';
import { Card } from '@components/Card';
import { Banner } from '@components/Banner';
import AsyncButton from '@shell/components/AsyncButton';
import AppModal from '@shell/components/AppModal';
export default {
name: 'HarvesterImageDownloaderDialog',
emits: ['close'],
components: {
AsyncButton, Banner, Card, AppModal
},
props: {
resources: {
type: Array,
required: true
}
},
data() {
return { errors: [], isOpen: false };
},
computed: {
...mapGetters({ t: 'i18n/t' }),
downloadImageInProgress() {
return this.$store.getters['harvester-common/isDownloadImageInProgress'];
},
image() {
return this.resources[0] || {};
},
imageName() {
return this.image?.name || '';
},
imageVirtualSize() {
return this.image?.virtualSize || this.image?.downSize || '';
}
},
methods: {
async cancelDownload() {
const url = this.image?.links?.downloadcancel;
if (url) {
await this.$store.dispatch('harvester/request', { url });
}
},
async close() {
if (this.downloadImageInProgress) {
this.$store.commit('harvester-common/setDownloadImageCancel', true);
this.$store.commit('harvester-common/setDownloadImageInProgress', false);
await this.cancelDownload();
}
this.$emit('close');
},
async startDownload(buttonCb) {
// clean the download image CRD first.
await this.cancelDownload();
this.$store.commit('harvester-common/setDownloadImageCancel', false);
this.$store.commit('harvester-common/setDownloadImageInProgress', false);
this.errors = [];
const name = this.image?.name || '';
const namespace = this.image?.namespace || '';
const imageCrd = {
apiVersion: 'harvesterhci.io/v1beta1',
type: HCI.VM_IMAGE_DOWNLOADER,
kind: 'VirtualMachineImageDownloader',
metadata: {
name,
namespace
},
spec: { imageName: name }
};
const inStore = this.$store.getters['currentProduct'].inStore;
const imageCreate = await this.$store.dispatch(`${ inStore }/create`, imageCrd);
try {
await imageCreate.save();
this.$store.commit('harvester-common/setDownloadImageId', `${ namespace }/${ name }`, { root: true });
this.$store.dispatch('harvester-common/downloadImageProgress', { root: true });
} catch (err) {
this.errors = exceptionToErrorsArray(err);
buttonCb(false);
}
}
},
};
</script>
<template>
<app-modal
class="image-downloader-modal"
name="image-download-dialog"
height="auto"
:width="600"
:click-to-close="false"
@close="close"
>
<Card :show-highlight-border="false">
<template #title>
{{ t('harvester.modal.downloadImage.title') }}
</template>
<template #body>
<Banner color="info">
{{ t('harvester.modal.downloadImage.banner', { size: imageVirtualSize }) }}
</Banner>
{{ t('harvester.modal.downloadImage.startMessage') }}
<br /><br />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template>
<template #actions>
<div class="actions">
<div class="buttons">
<button
class="btn role-secondary mr-10"
@click="close"
>
{{ t('generic.cancel') }}
</button>
<AsyncButton
type="submit"
mode="download"
:disabled="downloadImageInProgress"
@click="startDownload"
/>
</div>
</div>
</template>
</Card>
</app-modal>
</template>
<style lang="scss" scoped>
.actions {
width: 100%;
}
.buttons {
display: flex;
justify-content: flex-end;
width: 100%;
}
</style>
@@ -161,6 +161,12 @@ export default {
:placeholder="t('harvester.modal.migration.fields.nodeName.placeholder')" :placeholder="t('harvester.modal.migration.fields.nodeName.placeholder')"
:options="nodeNameList" :options="nodeNameList"
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template <template
@@ -181,12 +187,6 @@ export default {
@click="apply" @click="apply"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
</Card> </Card>
</template> </template>
@@ -5,6 +5,7 @@ import { Banner } from '@components/Banner';
import AsyncButton from '@shell/components/AsyncButton'; import AsyncButton from '@shell/components/AsyncButton';
import UnitInput from '@shell/components/form/UnitInput'; import UnitInput from '@shell/components/form/UnitInput';
import { exceptionToErrorsArray } from '@shell/utils/error'; import { exceptionToErrorsArray } from '@shell/utils/error';
import { GIBIBYTE } from '../utils/unit';
export default { export default {
name: 'HarvesterVMQuotaDialog', name: 'HarvesterVMQuotaDialog',
@@ -29,6 +30,7 @@ export default {
data() { data() {
return { return {
GIBIBYTE,
totalSnapshotSize: '', totalSnapshotSize: '',
errors: [] errors: []
}; };
@@ -44,7 +46,6 @@ export default {
}, },
methods: { methods: {
close() { close() {
this.totalSnapshotSize = ''; this.totalSnapshotSize = '';
this.$emit('close'); this.$emit('close');
@@ -92,9 +93,15 @@ export default {
:input-exponent="3" :input-exponent="3"
:increment="1024" :increment="1024"
:output-modifier="true" :output-modifier="true"
suffix="GiB" :suffix="GIBIBYTE"
class="mb-20" class="mb-20"
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -108,12 +115,6 @@ export default {
</button> </button>
<AsyncButton @click="save" /> <AsyncButton @click="save" />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -136,6 +136,12 @@ export default {
:options="backupOption" :options="backupOption"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -154,11 +160,6 @@ export default {
@click="saveRestore" @click="saveRestore"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -90,6 +90,12 @@ export default {
v-clean-html="t('harvester.virtualMachine.unplug.title', { name: diskName })" v-clean-html="t('harvester.virtualMachine.unplug.title', { name: diskName })"
class="text-default-text" class="text-default-text"
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -111,13 +117,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -132,6 +132,12 @@ export default {
:label="t('generic.name')" :label="t('generic.name')"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -150,11 +156,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -107,6 +107,12 @@ export default {
:placeholder="t('harvester.harvesterVlanConfigMigrateDialog.targetClusterNetwork.placeholder')" :placeholder="t('harvester.harvesterVlanConfigMigrateDialog.targetClusterNetwork.placeholder')"
:options="clusterNetworks" :options="clusterNetworks"
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -125,11 +131,6 @@ export default {
@click="apply" @click="apply"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
/>
</div> </div>
</template> </template>
</Card> </Card>
+4 -4
View File
@@ -70,16 +70,16 @@ export default {
v-clean-html="t('harvester.modal.restart.tip')" v-clean-html="t('harvester.modal.restart.tip')"
class="pl-10 pr-10" class="pl-10 pr-10"
/> />
</template>
<template #actions>
<div class="bottom">
<Banner <Banner
v-for="(err, i) in errors" v-for="(err, i) in errors"
:key="i" :key="i"
color="error" color="error"
:label="err" :label="err"
/> />
</template>
<template #actions>
<div class="bottom">
<div class="buttons"> <div class="buttons">
<button <button
class="btn role-secondary mr-10" class="btn role-secondary mr-10"
@@ -145,6 +145,12 @@ export default {
class="mt-20" class="mt-20"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -162,10 +168,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
/>
</div> </div>
</template> </template>
</Card> </Card>
+6 -6
View File
@@ -79,6 +79,12 @@ export default {
:label="t('harvester.modal.snapshot.name')" :label="t('harvester.modal.snapshot.name')"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -96,12 +102,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</div> </div>
</template> </template>
</Card> </Card>
+6 -4
View File
@@ -98,6 +98,12 @@ export default {
:label="t('harvester.modal.volumeClone.name')" :label="t('harvester.modal.volumeClone.name')"
required required
/> />
<Banner
v-for="(err, i) in errors"
:key="i"
color="error"
:label="err"
/>
</template> </template>
<template #actions> <template #actions>
@@ -115,10 +121,6 @@ export default {
@click="save" @click="save"
/> />
</div> </div>
<Banner
v-for="(err, i) in errors"
:key="i"
/>
</div> </div>
</template> </template>
</Card> </Card>
@@ -10,7 +10,7 @@ import { Banner } from '@components/Banner';
import CreateEditView from '@shell/mixins/create-edit-view'; import CreateEditView from '@shell/mixins/create-edit-view';
const DEFAULT_VALUE = { image: { repo: 'rancher/harvester-nvidia-driver-toolkit' } }; const DEFAULT_VALUE = { image: { repository: 'rancher/harvester-nvidia-driver-toolkit' } };
export default { export default {
name: 'EditAddonNvidiaDriverToolkit', name: 'EditAddonNvidiaDriverToolkit',
@@ -122,7 +122,7 @@ export default {
> >
<div class="col span-6"> <div class="col span-6">
<LabeledInput <LabeledInput
v-model:value="valuesContentJson.image.repo" v-model:value="valuesContentJson.image.repository"
:mode="mode" :mode="mode"
:required="true" :required="true"
label-key="harvester.addons.nvidiaDriverToolkit.image.repository" label-key="harvester.addons.nvidiaDriverToolkit.image.repository"
@@ -1,34 +1,31 @@
<script> <script>
import merge from 'lodash/merge';
import jsyaml from 'js-yaml';
import { LabeledInput } from '@components/Form/LabeledInput'; import { LabeledInput } from '@components/Form/LabeledInput';
import Tabbed from '@shell/components/Tabbed'; import Tabbed from '@shell/components/Tabbed';
import Tab from '@shell/components/Tabbed/Tab'; import Tab from '@shell/components/Tabbed/Tab';
import { RadioGroup } from '@components/Form/Radio'; import { RadioGroup } from '@components/Form/Radio';
import LabeledSelect from '@shell/components/form/LabeledSelect'; import LabeledSelect from '@shell/components/form/LabeledSelect';
import CreateEditView from '@shell/mixins/create-edit-view'; import CreateEditView from '@shell/mixins/create-edit-view';
import { STORAGE_CLASS } from '@shell/config/types'; import { STORAGE_CLASS } from '@shell/config/types';
import { allHash } from '@shell/utils/promise'; import { allHash } from '@shell/utils/promise';
import { set, get, clone } from '@shell/utils/object';
const VALUES_YAML_KEYS = [
'resources.requests.cpu',
'resources.requests.memory',
'resources.limits.cpu',
'resources.limits.memory',
'pvcClaim.enabled',
'pvcClaim.size',
'pvcClaim.storageClassName',
];
const DEFAULT_VALUES = { const DEFAULT_VALUES = {
'resources.requests.cpu': '0.5', resources: {
'resources.requests.memory': '2Gi', requests: {
'resources.limits.cpu': '2', cpu: '0.5',
'resources.limits.memory': '4Gi', memory: '2Gi'
'pvcClaim.enabled': false, },
'pvcClaim.size': '200Gi', limits: {
'pvcClaim.storageClassName': '', cpu: '2',
memory: '4Gi'
}
},
pvcClaim: {
enabled: false,
size: '200Gi',
storageClassName: ''
}
}; };
export default { export default {
@@ -64,19 +61,7 @@ export default {
}, },
data() { data() {
let valuesObj = {}; const valuesContent = this.parseValuesContent();
try {
valuesObj = JSON.parse(this.value?.spec?.valuesContent || '{}');
} catch (err) {}
const valuesContent = clone(valuesObj);
VALUES_YAML_KEYS.map((key) => {
if (!get(valuesObj, key)) {
set(valuesContent, key, DEFAULT_VALUES[key]);
}
});
return { valuesContent }; return { valuesContent };
}, },
@@ -100,8 +85,21 @@ export default {
}, },
methods: { methods: {
parseValuesContent() {
try {
return merge({}, DEFAULT_VALUES, jsyaml.load(this.value.spec.valuesContent));
} catch (err) {
this.$store.dispatch('growl/fromError', {
title: this.$store.getters['i18n/t']('generic.notification.title.error'),
err: err.data || err,
}, { root: true });
return DEFAULT_VALUES;
}
},
update() { update() {
set(this.value, 'spec.valuesContent', JSON.stringify(this.valuesContent)); this.value.spec.valuesContent = jsyaml.dump(this.valuesContent);
}, },
setDefaultClassName() { setDefaultClassName() {
@@ -20,7 +20,7 @@ import Loading from '@shell/components/Loading.vue';
import MessageLink from '@shell/components/MessageLink'; import MessageLink from '@shell/components/MessageLink';
import { ADD_ONS } from '@pkg/harvester/config/harvester-map'; import { ADD_ONS } from '@pkg/harvester/config/harvester-map';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '@pkg/harvester/config/harvester'; import { PRODUCT_NAME as HARVESTER_PRODUCT } from '@pkg/harvester/config/harvester';
import { UNIT_SUFFIX } from '../../utils/unit';
import { _EDIT } from '@shell/config/query-params'; import { _EDIT } from '@shell/config/query-params';
import { sortBy } from '@shell/utils/sort'; import { sortBy } from '@shell/utils/sort';
import { Banner } from '@components/Banner'; import { Banner } from '@components/Banner';
@@ -185,7 +185,7 @@ export default {
minExponent: 3, minExponent: 3,
maxExponent: 3, maxExponent: 3,
maxPrecision: 2, maxPrecision: 2,
suffix: 'iB', suffix: UNIT_SUFFIX,
}; };
const longhornDisks = Object.keys(diskStatus).map((key) => { const longhornDisks = Object.keys(diskStatus).map((key) => {
@@ -457,7 +457,7 @@ export default {
const devPath = d.spec?.devPath; const devPath = d.spec?.devPath;
const deviceType = d.status?.deviceStatus?.details?.deviceType; const deviceType = d.status?.deviceStatus?.details?.deviceType;
const sizeBytes = d.status?.deviceStatus?.capacity?.sizeBytes; const sizeBytes = d.status?.deviceStatus?.capacity?.sizeBytes;
const size = formatSi(sizeBytes, { increment: 1024 }); const size = formatSi(sizeBytes, { increment: 1024, suffix: UNIT_SUFFIX });
const parentDevice = d.status?.deviceStatus?.parentDevice; const parentDevice = d.status?.deviceStatus?.parentDevice;
const isChildAdded = this.newDisks.find((newDisk) => newDisk.blockDevice?.status?.deviceStatus?.parentDevice === devPath); const isChildAdded = this.newDisks.find((newDisk) => newDisk.blockDevice?.status?.deviceStatus?.parentDevice === devPath);
const name = d.displayName; const name = d.displayName;
@@ -93,7 +93,7 @@ export default {
const selectedProviderDefault = providers.find((p) => p.name === selectedProvider)?.default || providers[0].default; const selectedProviderDefault = providers.find((p) => p.name === selectedProvider)?.default || providers[0].default;
if (this.mode !== _VIEW) { if (this.mode !== _VIEW) {
this.$set(this.value.spec, selectedProvider, this.value.spec[selectedProvider] || clone(selectedProviderDefault)); set(this.value.spec, selectedProvider, this.value.spec[selectedProvider] || clone(selectedProviderDefault));
} }
return { return {
@@ -11,6 +11,9 @@ import { HCI as HCI_LABELS_ANNOTATIONS } from '@pkg/harvester/config/labels-anno
import CreateEditView from '@shell/mixins/create-edit-view'; import CreateEditView from '@shell/mixins/create-edit-view';
import { allHash } from '@shell/utils/promise'; import { allHash } from '@shell/utils/promise';
import { HCI } from '../types'; import { HCI } from '../types';
import { NETWORK_TYPE } from '../config/types';
const { L2VLAN, UNTAGGED } = NETWORK_TYPE;
const AUTO = 'auto'; const AUTO = 'auto';
const MANUAL = 'manual'; const MANUAL = 'manual';
@@ -48,7 +51,7 @@ export default {
config.bridge = config.bridge.slice(0, -3); config.bridge = config.bridge.slice(0, -3);
} }
const type = this.value.vlanType || 'L2VlanNetwork' ; const type = this.value.vlanType || L2VLAN ;
return { return {
config, config,
@@ -101,15 +104,15 @@ export default {
}, },
networkType() { networkType() {
return ['L2VlanNetwork', 'UntaggedNetwork']; return [L2VLAN, UNTAGGED];
}, },
isUntaggedNetwork() { isUntaggedNetwork() {
if (this.isView) { if (this.isView) {
return this.value.vlanType === 'UntaggedNetwork'; return this.value.vlanType === UNTAGGED;
} }
return this.type === 'UntaggedNetwork'; return this.type === UNTAGGED;
} }
}, },
@@ -23,10 +23,9 @@ import Tags from '../../components/DiskTags';
import { DATA_ENGINE_V1, DATA_ENGINE_V2 } from '../../models/harvester/persistentvolumeclaim'; import { DATA_ENGINE_V1, DATA_ENGINE_V2 } from '../../models/harvester/persistentvolumeclaim';
import { LVM_DRIVER } from '../../models/harvester/storage.k8s.io.storageclass'; import { LVM_DRIVER } from '../../models/harvester/storage.k8s.io.storageclass';
const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';
export const LVM_TOPOLOGY_LABEL = 'topology.lvm.csi/node'; export const LVM_TOPOLOGY_LABEL = 'topology.lvm.csi/node';
const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';
const VOLUME_BINDING_MODE_IMMEDIATE = 'Immediate'; const VOLUME_BINDING_MODE_IMMEDIATE = 'Immediate';
const VOLUME_BINDING_MODE_WAIT = 'WaitForFirstConsumer'; const VOLUME_BINDING_MODE_WAIT = 'WaitForFirstConsumer';
@@ -63,7 +63,7 @@ export default {
diskSelector: null, diskSelector: null,
nodeSelector: null, nodeSelector: null,
encrypted: 'false', encrypted: 'false',
migratable: 'false', migratable: this.value.thirdPartyStorageFeatureEnabled ? 'true' : 'false',
dataEngine: DATA_ENGINE_V2 dataEngine: DATA_ENGINE_V2
}; };
} }
@@ -318,7 +318,7 @@ export default {
:label="t('harvester.storage.parameters.migratable.label')" :label="t('harvester.storage.parameters.migratable.label')"
:mode="mode" :mode="mode"
:options="migratableOptions" :options="migratableOptions"
:disabled="true" :disabled="!value.thirdPartyStorageFeatureEnabled"
/> />
</div> </div>
<div class="row mt-20"> <div class="row mt-20">
@@ -24,6 +24,7 @@ const CLONE = 'clone';
const DOWNLOAD = 'download'; const DOWNLOAD = 'download';
const UPLOAD = 'upload'; const UPLOAD = 'upload';
const rawORqcow2 = 'raw_qcow2'; const rawORqcow2 = 'raw_qcow2';
const LONGHORN = 'longhorn';
export default { export default {
name: 'EditImage', name: 'EditImage',
@@ -61,11 +62,11 @@ export default {
storageClasses: this.$store.dispatch(`${ inStore }/findAll`, { type: STORAGE_CLASS }), storageClasses: this.$store.dispatch(`${ inStore }/findAll`, { type: STORAGE_CLASS }),
}); });
const defaultStorage = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS).find((s) => s.isDefault); this['storageClassName'] = this.storageClassName || this.defaultStorageClassName();
this['storageClassName'] = this.storageClassName || defaultStorage?.metadata?.name || 'longhorn';
this.images = this.$store.getters[`${ inStore }/all`](HCI.IMAGE); this.images = this.$store.getters[`${ inStore }/all`](HCI.IMAGE);
this.storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
const { securityParameters } = this.value.spec; const { securityParameters } = this.value.spec;
// edit and view mode should show the source image // edit and view mode should show the source image
@@ -101,6 +102,7 @@ export default {
return { return {
selectedImage: null, selectedImage: null,
storageClasses: [],
images: [], images: [],
url: this.value.spec.url, url: this.value.spec.url,
files: [], files: [],
@@ -144,12 +146,26 @@ export default {
]; ];
}, },
storageClassOptions() { encryptedStorageClasses() {
const inStore = this.$store.getters['currentProduct'].inStore; const inStore = this.$store.getters['currentProduct'].inStore;
const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS); const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
return storages return storages.filter((s) => s.isEncrypted);
.filter((s) => !s.parameters?.backingImage && s.provisioner !== LVM_DRIVER) // Lvm storage is not supported. },
nonEncryptedStorageClasses() {
const inStore = this.$store.getters['currentProduct'].inStore;
const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
return storages.filter((s) => !s.isEncrypted);
},
storageClassOptions() {
const storages = this.value.spec?.securityParameters?.cryptoOperation === ENCRYPT ? this.encryptedStorageClasses : this.nonEncryptedStorageClasses;
const filteredStorages = this.value.thirdPartyStorageFeatureEnabled ? storages.filter((s) => !s.parameters?.backingImage) : storages
.filter((s) => !s.parameters?.backingImage && s.provisioner !== LVM_DRIVER) ;
return filteredStorages
.map((s) => { .map((s) => {
const label = s.isDefault ? `${ s.name } (${ this.t('generic.default') })` : s.name; const label = s.isDefault ? `${ s.name } (${ this.t('generic.default') })` : s.name;
@@ -167,6 +183,9 @@ export default {
set(nue) { set(nue) {
this.value.metadata.annotations[HCI_ANNOTATIONS.STORAGE_CLASS] = nue; this.value.metadata.annotations[HCI_ANNOTATIONS.STORAGE_CLASS] = nue;
if (this.value.thirdPartyStorageFeatureEnabled) {
this.value.spec.targetStorageClassName = nue;
}
} }
}, },
sourceImageOptions() { sourceImageOptions() {
@@ -239,6 +258,20 @@ export default {
this.$refs.file.value = null; this.$refs.file.value = null;
} }
}, },
'value.spec.securityParameters.cryptoOperation'() {
if (this.value.spec?.securityParameters?.cryptoOperation === ENCRYPT) {
this.storageClassName = this.encryptedStorageClasses[0]?.name || '';
} else { // URL / FILE / DECRYPT should use default storage class
this.storageClassName = this.defaultStorageClassName();
}
},
'storageClassName'(neu) {
const storageClass = this.storages.find((s) => s.id === neu);
if (storageClass && this.value.thirdPartyStorageFeatureEnabled) {
this.value.spec.backend = storageClass.isLonghornV1 ? 'backingimage' : 'cdi';
}
}
}, },
methods: { methods: {
@@ -385,6 +418,18 @@ export default {
return str.toLowerCase().includes(os.value.toLowerCase()) ? os.value : false; return str.toLowerCase().includes(os.value.toLowerCase()) ? os.value : false;
} }
}); });
},
defaultStorageClassName() {
const inStore = this.$store.getters['currentProduct'].inStore;
const defaultStorage = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS).find((s) => s.isDefault);
if (!defaultStorage) {
return LONGHORN;
}
// if default sc is encrypted, use longhorn as default
return defaultStorage.isEncrypted ? LONGHORN : defaultStorage?.metadata?.name;
} }
}, },
}; };
@@ -6,12 +6,11 @@ import { Checkbox } from '@components/Form/Checkbox';
import CruResource from '@shell/components/CruResource'; import CruResource from '@shell/components/CruResource';
import NameNsDescription from '@shell/components/form/NameNsDescription'; import NameNsDescription from '@shell/components/form/NameNsDescription';
import LabeledSelect from '@shell/components/form/LabeledSelect'; import LabeledSelect from '@shell/components/form/LabeledSelect';
import Labels from '@shell/components/form/Labels'; import { Banner } from '@components/Banner';
import KeyValue from '@shell/components/form/KeyValue'; import KeyValue from '@shell/components/form/KeyValue';
import NodeScheduling from '@shell/components/form/NodeScheduling'; import NodeScheduling from '@shell/components/form/NodeScheduling';
import PodAffinity from '@shell/components/form/PodAffinity'; import PodAffinity from '@shell/components/form/PodAffinity';
import UnitInput from '@shell/components/form/UnitInput'; import UnitInput from '@shell/components/form/UnitInput';
import { randomStr } from '@shell/utils/string'; import { randomStr } from '@shell/utils/string';
import { _CONFIG, _EDIT, _VIEW } from '@shell/config/query-params'; import { _CONFIG, _EDIT, _VIEW } from '@shell/config/query-params';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
@@ -47,7 +46,7 @@ export default {
PodAffinity, PodAffinity,
Reserved, Reserved,
UnitInput, UnitInput,
Labels, Banner,
KeyValue, KeyValue,
}, },
@@ -321,21 +320,34 @@ export default {
</Tab> </Tab>
<Tab <Tab
:name="t('generic.labels')" name="labels"
:label="t('harvester.tab.instanceLabel')" :label="t('generic.labels')"
:weight="-5" :weight="-9"
> >
<Labels <Banner color="info">
:default-container-class="'labels-and-annotations-container'" <t k="harvester.virtualMachine.labels.banner" />
:value="value" </Banner>
:mode="mode"
:display-side-by-side="false"
:show-annotations="false"
:show-label-title="false"
>
<template #labels="{toggler}">
<KeyValue <KeyValue
key="labels" key="labels"
:value="value.labels"
:add-label="t('labels.addLabel')"
:mode="mode"
:read-allowed="false"
:value-can-be-empty="true"
@update:value="value.setLabels($event)"
/>
</Tab>
<Tab
name="instanceLabel"
:label="t('harvester.tab.instanceLabel')"
:weight="-10"
>
<Banner color="info">
<t k="harvester.virtualMachine.instanceLabels.banner" />
</Banner>
<KeyValue
key="instance-labels"
:value="value.instanceLabels" :value="value.instanceLabels"
:protected-keys="value.systemLabels || []" :protected-keys="value.systemLabels || []"
:toggle-filter="toggler" :toggle-filter="toggler"
@@ -343,12 +355,9 @@ export default {
:mode="mode" :mode="mode"
:read-allowed="false" :read-allowed="false"
:value-can-be-empty="true" :value-can-be-empty="true"
@input="value.setInstanceLabels($event)" @update:value="value.setInstanceLabels($event)"
/> />
</template>
</Labels>
</Tab> </Tab>
<Tab <Tab
name="advanced" name="advanced"
:label="t('harvester.tab.advanced')" :label="t('harvester.tab.advanced')"
@@ -434,7 +443,7 @@ export default {
<div class="spacer"></div> <div class="spacer"></div>
<Checkbox <Checkbox
v-if="value.cpuPinningFeatureEnabled" v-if="value.cpuPinningFeatureEnabled"
v-model="cpuPinning" v-model:value="cpuPinning"
class="check" class="check"
type="checkbox" type="checkbox"
tooltip-key="harvester.virtualMachine.cpuPinning.tooltip" tooltip-key="harvester.virtualMachine.cpuPinning.tooltip"
@@ -465,11 +474,29 @@ export default {
:mode="mode" :mode="mode"
/> />
<Checkbox
v-if="value.tpmPersistentStateFeatureEnabled && tpmEnabled"
v-model:value="tpmPersistentStateEnabled"
class="check"
type="checkbox"
:label="t('harvester.virtualMachine.advancedOptions.tpmPersistentState')"
:mode="mode"
/>
<Checkbox <Checkbox
v-model:value="efiEnabled" v-model:value="efiEnabled"
class="check" class="check"
type="checkbox" type="checkbox"
:label="t('harvester.virtualMachine.efiEnabled')" :label="t('harvester.virtualMachine.advancedOptions.efiEnabled')"
:mode="mode"
/>
<Checkbox
v-if="value.efiPersistentStateFeatureEnabled && efiEnabled"
v-model:value="efiPersistentStateEnabled"
class="check"
type="checkbox"
:label="t('harvester.virtualMachine.advancedOptions.efiPersistentState')"
:mode="mode" :mode="mode"
/> />
@@ -478,7 +505,7 @@ export default {
v-model:value="secureBoot" v-model:value="secureBoot"
class="check" class="check"
type="checkbox" type="checkbox"
:label="t('harvester.virtualMachine.secureBoot')" :label="t('harvester.virtualMachine.advancedOptions.secureBoot')"
:mode="mode" :mode="mode"
/> />
</Tab> </Tab>
+81 -5
View File
@@ -21,6 +21,8 @@ import { InterfaceOption, VOLUME_DATA_SOURCE_KIND } from '../config/harvester-ma
import { HCI, VOLUME_SNAPSHOT } from '../types'; import { HCI, VOLUME_SNAPSHOT } from '../types';
import { LVM_DRIVER } from '../models/harvester/storage.k8s.io.storageclass'; import { LVM_DRIVER } from '../models/harvester/storage.k8s.io.storageclass';
import { DATA_ENGINE_V2 } from '../models/harvester/persistentvolumeclaim'; import { DATA_ENGINE_V2 } from '../models/harvester/persistentvolumeclaim';
import { GIBIBYTE } from '../utils/unit';
import { VOLUME_MODE } from '@pkg/harvester/config/types';
export default { export default {
name: 'HarvesterVolume', name: 'HarvesterVolume',
@@ -72,7 +74,8 @@ export default {
data() { data() {
if (this.mode === _CREATE) { if (this.mode === _CREATE) {
this.value.spec.volumeMode = 'Block'; // default volumeMode to Block
this.value.spec.volumeMode = VOLUME_MODE.BLOCK;
this.value.spec.accessModes = ['ReadWriteMany']; this.value.spec.accessModes = ['ReadWriteMany'];
} }
@@ -86,6 +89,7 @@ export default {
imageId, imageId,
snapshots: [], snapshots: [],
images: [], images: [],
GIBIBYTE
}; };
}, },
@@ -124,6 +128,10 @@ export default {
return InterfaceOption; return InterfaceOption;
}, },
volumeModeOptions() {
return Object.values(VOLUME_MODE);
},
imageOption() { imageOption() {
return sortBy( return sortBy(
this.images this.images
@@ -177,6 +185,25 @@ export default {
return this.$store.getters[`${ inStore }/all`](STORAGE_CLASS); return this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
}, },
isLonghornStorageClass() {
const selectedSC = this.storageClasses.find((sc) => sc.name === this.value?.spec?.storageClassName) || {};
return selectedSC && selectedSC.isLonghorn;
},
showVolumeMode() {
// we won't let user choose volumeMode if source = vmimage
if (!this.value.thirdPartyStorageFeatureEnabled || this.isVMImage || !!this.value?.spec?.storageClassName === false) {
return false;
}
if (this.isLonghornStorageClass) {
return false;
}
return true;
},
storageClassOptions() { storageClassOptions() {
return this.storageClasses.filter((s) => !s.parameters?.backingImage).map((s) => { return this.storageClasses.filter((s) => !s.parameters?.backingImage).map((s) => {
const label = s.isDefault ? `${ s.name } (${ this.t('generic.default') })` : s.name; const label = s.isDefault ? `${ s.name } (${ this.t('generic.default') })` : s.name;
@@ -235,7 +262,43 @@ export default {
} }
}, },
watch: {
'source'(neu) {
if (neu === 'url') {
this.setBlockVolumeMode();
this.deleteVolumeForVmAnnotation();
}
},
'value.spec.storageClassName'() {
if (this.isLonghornStorageClass) {
this.setBlockVolumeMode();
this.deleteVolumeForVmAnnotation();
}
},
'value.spec.volumeMode'(neu) {
if (neu === VOLUME_MODE.FILE_SYSTEM) {
this.setVolumeForVmAnnotation();
} else if (neu === VOLUME_MODE.BLOCK ) {
this.deleteVolumeForVmAnnotation();
}
}
},
methods: { methods: {
setBlockVolumeMode() {
this.value.spec.volumeMode = VOLUME_MODE.BLOCK;
},
setVolumeForVmAnnotation() {
this.value.setAnnotation(HCI_ANNOTATIONS.VOLUME_FOR_VM, 'true');
},
deleteVolumeForVmAnnotation() {
if (this.value?.metadata?.annotations?.[HCI_ANNOTATIONS.VOLUME_FOR_VM]) {
delete this.value.metadata.annotations[HCI_ANNOTATIONS.VOLUME_FOR_VM];
}
},
getAccessMode() { getAccessMode() {
if (!this.longhornV2LVMSupport) { if (!this.longhornV2LVMSupport) {
return ['ReadWriteMany']; return ['ReadWriteMany'];
@@ -244,10 +307,10 @@ export default {
const storageClassName = this.value.spec.storageClassName; const storageClassName = this.value.spec.storageClassName;
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName); const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
let readWriteOnce = this.value.isLvm || this.value.isLonghornV2; let readWriteOnce = this.value.isLvm || (!this.value.thirdPartyStorageFeatureEnabled && this.value.isLonghornV2);
if (storageClass) { if (storageClass) {
readWriteOnce = storageClass.provisioner === LVM_DRIVER || storageClass.parameters?.dataEngine === DATA_ENGINE_V2; readWriteOnce = storageClass.provisioner === LVM_DRIVER || (!this.value.thirdPartyStorageFeatureEnabled && storageClass.parameters?.dataEngine === DATA_ENGINE_V2);
} }
return readWriteOnce ? ['ReadWriteOnce'] : ['ReadWriteMany']; return readWriteOnce ? ['ReadWriteOnce'] : ['ReadWriteMany'];
@@ -288,7 +351,7 @@ export default {
const imageSize = Math.max(imageResource?.status?.size, imageResource?.status?.virtualSize); const imageSize = Math.max(imageResource?.status?.size, imageResource?.status?.virtualSize);
if (imageSize) { if (imageSize) {
this.storage = `${ Math.ceil(imageSize / 1024 / 1024 / 1024) }Gi`; this.storage = `${ Math.ceil(imageSize / 1024 / 1024 / 1024) }${ GIBIBYTE }`;
} }
} }
this.update(); this.update();
@@ -357,7 +420,7 @@ export default {
/> />
<LabeledSelect <LabeledSelect
v-if="source === 'blank'" v-if="isBlank"
v-model:value="value.spec.storageClassName" v-model:value="value.spec.storageClassName"
:options="storageClassOptions" :options="storageClassOptions"
:label="t('harvester.storage.storageClass.label')" :label="t('harvester.storage.storageClass.label')"
@@ -367,6 +430,18 @@ export default {
@update:value="update" @update:value="update"
/> />
<LabeledSelect
v-if="showVolumeMode"
v-model:value="value.spec.volumeMode"
:label="t('harvester.volume.volumeMode')"
:options="volumeModeOptions"
required
:disabled="!isCreate"
:mode="mode"
class="mb-20"
@update:value="update"
/>
<UnitInput <UnitInput
v-model:value="storage" v-model:value="storage"
:label="t('harvester.volume.size')" :label="t('harvester.volume.size')"
@@ -377,6 +452,7 @@ export default {
:disabled="value?.isLonghornV2 && isEdit" :disabled="value?.isLonghornV2 && isEdit"
required required
class="mb-20" class="mb-20"
:suffix="GIBIBYTE"
@update:value="update" @update:value="update"
/> />
@@ -1,6 +1,7 @@
<script> <script>
import UnitInput from '@shell/components/form/UnitInput'; import UnitInput from '@shell/components/form/UnitInput';
import InputOrDisplay from '@shell/components/InputOrDisplay'; import InputOrDisplay from '@shell/components/InputOrDisplay';
import { GIBIBYTE } from '../../utils/unit';
export default { export default {
name: 'HarvesterEditCpuMemory', name: 'HarvesterEditCpuMemory',
@@ -30,6 +31,7 @@ export default {
data() { data() {
return { return {
GIBIBYTE,
localCpu: this.cpu, localCpu: this.cpu,
localMemory: this.memory localMemory: this.memory
}; };
@@ -63,7 +65,7 @@ export default {
if (String(this.localMemory).includes('Gi')) { if (String(this.localMemory).includes('Gi')) {
memory = this.localMemory; memory = this.localMemory;
} else { } else {
memory = `${ this.localMemory }Gi`; memory = `${ this.localMemory }${ GIBIBYTE }`;
} }
if (memory.includes('null')) { if (memory.includes('null')) {
memory = null; memory = null;
@@ -113,6 +115,7 @@ export default {
:output-modifier="true" :output-modifier="true"
:disabled="disabled" :disabled="disabled"
required required
:suffix="GIBIBYTE"
class="mb-20" class="mb-20"
@update:value="change" @update:value="change"
/> />
@@ -97,12 +97,14 @@ export default {
}); });
const devices = [ const devices = [
...this.otherDevices(this.value.domain.devices.hostDevices || []), ...this.otherDevices(this.value?.domain?.devices?.hostDevices || []),
...formatted, ...formatted,
]; ];
if (devices.length > 0) {
set(this.value.domain.devices, 'hostDevices', devices); set(this.value.domain.devices, 'hostDevices', devices);
} }
}
}, },
computed: { computed: {
@@ -121,7 +123,9 @@ export default {
return inUse; return inUse;
} }
vm.hostDevices.forEach((device) => { const hostDevices = vm?.hostDevices || [];
hostDevices.forEach((device) => {
inUse[device.name] = { usedBy: [vm.metadata.name] }; inUse[device.name] = { usedBy: [vm.metadata.name] };
}); });
@@ -1,6 +1,6 @@
<script> <script>
import UnitInput from '@shell/components/form/UnitInput'; import UnitInput from '@shell/components/form/UnitInput';
import { MEBIBYTE } from '../../utils/unit';
export default { export default {
name: 'HarvesterReserved', name: 'HarvesterReserved',
@@ -20,7 +20,7 @@ export default {
}, },
data() { data() {
return { memory: this.reservedMemory }; return { MEBIBYTE, memory: this.reservedMemory };
}, },
watch: { watch: {
@@ -47,6 +47,7 @@ export default {
:input-exponent="2" :input-exponent="2"
:increment="1024" :increment="1024"
:output-modifier="true" :output-modifier="true"
:suffix="MEBIBYTE"
@update:value="change" @update:value="change"
/> />
</template> </template>
@@ -6,8 +6,7 @@ import { LabeledInput } from '@components/Form/LabeledInput';
import LabeledSelect from '@shell/components/form/LabeledSelect'; import LabeledSelect from '@shell/components/form/LabeledSelect';
import ModalWithCard from '@shell/components/ModalWithCard'; import ModalWithCard from '@shell/components/ModalWithCard';
import { clone } from '@shell/utils/object'; import { _VIEW, _EDIT } from '@shell/config/query-params';
import { _VIEW } from '@shell/config/query-params';
import { NAMESPACE } from '@shell/config/types'; import { NAMESPACE } from '@shell/config/types';
import { HCI } from '../../types'; import { HCI } from '../../types';
@@ -91,6 +90,9 @@ export default {
}, },
sshOption() { sshOption() {
if (this.mode === _VIEW || this.mode === _EDIT) {
return [];
}
const out = this.$store.getters['harvester/all'](HCI.SSH).map( (O) => { const out = this.$store.getters['harvester/all'](HCI.SSH).map( (O) => {
return { return {
label: O.id, label: O.id,
@@ -126,10 +128,9 @@ export default {
this.checkedSsh = neu; this.checkedSsh = neu;
}, },
checkedSsh(val, old) { checkedSsh(val) {
if ( val.includes(_NEW)) { // if click on Create a New...
this['checkedSsh'] = old; if (val.includes(_NEW)) {
this.update();
this.show(); this.show();
} }
} }
@@ -175,6 +176,7 @@ export default {
if (res.id) { if (res.id) {
this.checkedSsh.push(`${ this.namespace }/${ this.sshName }`); this.checkedSsh.push(`${ this.namespace }/${ this.sshName }`);
this.update();
} }
}, },
@@ -232,7 +234,9 @@ export default {
}, },
update() { update() {
this.$emit('update:sshKey', clone(this.checkedSsh)); const sshKeys = this.checkedSsh.filter((key) => key !== _NEW);
this.$emit('update:sshKey', sshKeys);
}, },
} }
}; };
@@ -243,7 +247,7 @@ export default {
<LabeledSelect <LabeledSelect
v-model:value="checkedSsh" v-model:value="checkedSsh"
:label="t('harvester.virtualMachine.input.sshKey')" :label="t('harvester.virtualMachine.input.sshKey')"
:taggable="true" :taggable="!disabled"
:mode="mode" :mode="mode"
:multiple="true" :multiple="true"
:searchable="searchable" :searchable="searchable"
@@ -80,12 +80,14 @@ export default {
}); });
const devices = [ const devices = [
...this.otherDevices(this.value.domain.devices.hostDevices || []), ...this.otherDevices(this.value?.domain?.devices?.hostDevices || []),
...formatted, ...formatted,
]; ];
if (devices.length > 0) {
set(this.value.domain.devices, 'hostDevices', devices); set(this.value.domain.devices, 'hostDevices', devices);
} }
}
}, },
computed: { computed: {
@@ -121,7 +123,9 @@ export default {
return inUse; return inUse;
} }
vm.hostDevices.forEach((device) => { const hostDevices = vm?.hostDevices || [];
hostDevices.forEach((device) => {
inUse[device.name] = { usedBy: [vm.metadata.name] }; inUse[device.name] = { usedBy: [vm.metadata.name] };
}); });
@@ -46,10 +46,13 @@ export default {
this[key] = res[key]; this[key] = res[key];
} }
uniq([ const vGpus = this.vm.isOff ? [
...(this.value?.domain?.devices?.gpus || []).map(({ name }) => name), ...(this.value?.domain?.devices?.gpus || []).map(({ name }) => name),
] : [
...Object.values(this.vm?.provisionedVGpus).reduce((acc, gpus) => [...acc, ...gpus], []) ...Object.values(this.vm?.provisionedVGpus).reduce((acc, gpus) => [...acc, ...gpus], [])
]).forEach((name) => { ];
uniq(vGpus).forEach((name) => {
if (this.enabledDevices.find((device) => device?.metadata?.name === name)) { if (this.enabledDevices.find((device) => device?.metadata?.name === name)) {
this.selectedDevices.push(name); this.selectedDevices.push(name);
} }
@@ -1,5 +1,5 @@
<script> <script>
import { Sortable } from 'sortablejs-vue3'; import { VueDraggableNext } from 'vue-draggable-next';
import InfoBox from '@shell/components/InfoBox'; import InfoBox from '@shell/components/InfoBox';
import { Banner } from '@components/Banner'; import { Banner } from '@components/Banner';
import BadgeStateFormatter from '@shell/components/formatter/BadgeStateFormatter'; import BadgeStateFormatter from '@shell/components/formatter/BadgeStateFormatter';
@@ -7,8 +7,7 @@ import UnitInput from '@shell/components/form/UnitInput';
import { LabeledInput } from '@components/Form/LabeledInput'; import { LabeledInput } from '@components/Form/LabeledInput';
import LabeledSelect from '@shell/components/form/LabeledSelect'; import LabeledSelect from '@shell/components/form/LabeledSelect';
import ModalWithCard from '@shell/components/ModalWithCard'; import ModalWithCard from '@shell/components/ModalWithCard';
import { PVC, STORAGE_CLASS } from '@shell/config/types';
import { PVC } from '@shell/config/types';
import { clone } from '@shell/utils/object'; import { clone } from '@shell/utils/object';
import { ucFirst, randomStr } from '@shell/utils/string'; import { ucFirst, randomStr } from '@shell/utils/string';
import { removeObject } from '@shell/utils/array'; import { removeObject } from '@shell/utils/array';
@@ -17,12 +16,13 @@ import { PLUGIN_DEVELOPER, DEV } from '@shell/store/prefs';
import { SOURCE_TYPE } from '../../../config/harvester-map'; import { SOURCE_TYPE } from '../../../config/harvester-map';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../../config/harvester'; import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../../config/harvester';
import { HCI } from '../../../types'; import { HCI } from '../../../types';
import { VOLUME_MODE } from '@pkg/harvester/config/types';
export default { export default {
emits: ['update:value'], emits: ['update:value'],
components: { components: {
Banner, BadgeStateFormatter, Sortable, InfoBox, LabeledInput, UnitInput, LabeledSelect, ModalWithCard Banner, BadgeStateFormatter, VueDraggableNext, InfoBox, LabeledInput, UnitInput, LabeledSelect, ModalWithCard
}, },
props: { props: {
@@ -62,7 +62,7 @@ export default {
customVolumeMode: { customVolumeMode: {
type: String, type: String,
default: 'Block' default: VOLUME_MODE.Block
}, },
customAccessMode: { customAccessMode: {
@@ -116,6 +116,12 @@ export default {
return this.mode === _CREATE; return this.mode === _CREATE;
}, },
defaultStorageClass() {
const defaultStorage = this.$store.getters['harvester/all'](STORAGE_CLASS).find((sc) => sc.isDefault);
return defaultStorage;
},
showVolumeTip() { showVolumeTip() {
const imageName = this.getImageDisplayName(this.rows[0]?.image); const imageName = this.getImageDisplayName(this.rows[0]?.image);
@@ -272,14 +278,16 @@ export default {
color="info" color="info"
label-key="harvester.virtualMachine.volume.dragTip" label-key="harvester.virtualMachine.volume.dragTip"
/> />
<Sortable <VueDraggableNext
:list="rows" :list="rows"
:options="{disabled: isView}" :disabled="isView"
item-key="id" item-key="id"
@end="update" @end="update"
> >
<template #item="{element: volume, index: i}"> <div
<div :key="volume.name"> v-for="(volume, i) in rows"
:key="volume.id"
>
<InfoBox class="box"> <InfoBox class="box">
<button <button
v-if="!isView" v-if="!isView"
@@ -393,8 +401,7 @@ export default {
</div> </div>
</InfoBox> </InfoBox>
</div> </div>
</template> </VueDraggableNext>
</Sortable>
<Banner <Banner
v-if="showVolumeTip" v-if="showVolumeTip"
color="warning" color="warning"
@@ -11,6 +11,7 @@ import { _CREATE } from '@shell/config/query-params';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
import { HCI } from '../../../../types'; import { HCI } from '../../../../types';
import { VOLUME_TYPE, InterfaceOption } from '../../../../config/harvester-map'; import { VOLUME_TYPE, InterfaceOption } from '../../../../config/harvester-map';
import { GIBIBYTE } from '../../../../utils/unit';
export default { export default {
name: 'HarvesterEditExisting', name: 'HarvesterEditExisting',
@@ -59,6 +60,7 @@ export default {
} }
return { return {
GIBIBYTE,
VOLUME_TYPE, VOLUME_TYPE,
InterfaceOption, InterfaceOption,
loading: false, loading: false,
@@ -109,6 +111,10 @@ export default {
return false; return false;
} }
if (pvc.metadata?.annotations?.[HCI_ANNOTATIONS.GOLDEN_IMAGE] === 'true') {
return false;
}
if (pvc.attachVM && isAvailable && pvc.attachVM?.id === this.vm?.id && this.isEdit) { if (pvc.attachVM && isAvailable && pvc.attachVM?.id === this.vm?.id && this.isEdit) {
isBeingUsed = false; isBeingUsed = false;
} else if (pvc.attachVM) { } else if (pvc.attachVM) {
@@ -250,6 +256,7 @@ export default {
:label="t('harvester.fields.size')" :label="t('harvester.fields.size')"
:mode="mode" :mode="mode"
:disabled="true" :disabled="true"
:suffix="GIBIBYTE"
@update:value="update" @update:value="update"
/> />
</InputOrDisplay> </InputOrDisplay>
@@ -12,6 +12,7 @@ import { VOLUME_TYPE, InterfaceOption } from '../../../../config/harvester-map';
import { _VIEW } from '@shell/config/query-params'; import { _VIEW } from '@shell/config/query-params';
import LabelValue from '@shell/components/LabelValue'; import LabelValue from '@shell/components/LabelValue';
import { ucFirst } from '@shell/utils/string'; import { ucFirst } from '@shell/utils/string';
import { GIBIBYTE } from '../../../../utils/unit';
export default { export default {
name: 'HarvesterEditVMImage', name: 'HarvesterEditVMImage',
@@ -67,6 +68,7 @@ export default {
data() { data() {
return { return {
GIBIBYTE,
VOLUME_TYPE, VOLUME_TYPE,
InterfaceOption, InterfaceOption,
loading: false, loading: false,
@@ -90,7 +92,7 @@ export default {
imagesOption() { imagesOption() {
return this.images.filter((c) => c.isReady).sort((a, b) => a.creationTimestamp > b.creationTimestamp ? -1 : 1).map( (I) => { return this.images.filter((c) => c.isReady).sort((a, b) => a.creationTimestamp > b.creationTimestamp ? -1 : 1).map( (I) => {
return { return {
label: `${ I.metadata.namespace }/${ I.spec.displayName }`, label: this.imageOptionLabel(I),
value: I.id value: I.id
}; };
}); });
@@ -116,8 +118,46 @@ export default {
}); });
}, },
thirdPartyStorageEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
},
isLonghornV2() { isLonghornV2() {
return this.value.pvc?.isLonghornV2 || this.value.pvc?.storageClass?.isLonghornV2; return this.value.pvc?.isLonghornV2 || this.value.pvc?.storageClass?.isLonghornV2;
},
selectedImage() {
return this.$store.getters['harvester/all'](HCI.IMAGE)?.find( (I) => this.value.image === I.id);
},
imageVirtualSize() {
if (this.selectedImage?.virtualSize) {
return this.selectedImage.virtualSize.replace(' ', '');
}
return '0';
},
diskSize() {
const size = this.value?.size || '0';
return size;
},
imageVirtualSizeInByte() {
return Math.max(this.selectedImage?.status?.size, this.selectedImage?.status?.virtualSize);
},
diskSizeInByte() {
return parseSi(this.value?.size || '0');
},
showDiskTooSmallError() {
if (!this.thirdPartyStorageEnabled ) {
return false;
}
return this.imageVirtualSizeInByte > this.diskSizeInByte;
} }
}, },
@@ -149,7 +189,7 @@ export default {
minExponent: 3, minExponent: 3,
}); });
this.value.size = `${ formatSize }Gi`; this.value.size = `${ formatSize }${ GIBIBYTE }`;
} }
}, },
deep: true, deep: true,
@@ -158,7 +198,17 @@ export default {
}, },
methods: { methods: {
imageOptionLabel(image) {
let label = `${ image.metadata.namespace }/${ image.spec.displayName }`;
if (this.thirdPartyStorageEnabled) {
label += ` (${ image.imageStorageClass } / ${ image.virtualSize })`;
}
return label;
},
update() { update() {
this.value.hasDiskError = this.showDiskTooSmallError;
this.$emit('update'); this.$emit('update');
}, },
@@ -181,7 +231,7 @@ export default {
if (!isIsoImage) { if (!isIsoImage) {
imageSizeGiB = Math.max(imageSizeGiB, 10); imageSizeGiB = Math.max(imageSizeGiB, 10);
} }
this.value['size'] = `${ imageSizeGiB }Gi`; this.value['size'] = `${ imageSizeGiB }${ GIBIBYTE }`;
} }
this.update(); this.update();
@@ -288,7 +338,7 @@ export default {
:mode="mode" :mode="mode"
:required="validateRequired" :required="validateRequired"
:disable="isLonghornV2" :disable="isLonghornV2"
suffix="GiB" :suffix="GIBIBYTE"
@update:value="update" @update:value="update"
/> />
</InputOrDisplay> </InputOrDisplay>
@@ -341,5 +391,10 @@ export default {
class="mb-20" class="mb-20"
:label="value.volumeBackups.error.message" :label="value.volumeBackups.error.message"
/> />
<Banner
v-if="!isView && showDiskTooSmallError"
color="error"
:label="t('harvester.virtualMachine.volume.vmImageVolumeTip', {diskSize: diskSize, imageVirtualSize: imageVirtualSize})"
/>
</div> </div>
</template> </template>
@@ -12,6 +12,8 @@ import LabelValue from '@shell/components/LabelValue';
import { ucFirst } from '@shell/utils/string'; import { ucFirst } from '@shell/utils/string';
import { LVM_DRIVER } from '../../../../models/harvester/storage.k8s.io.storageclass'; import { LVM_DRIVER } from '../../../../models/harvester/storage.k8s.io.storageclass';
import { DATA_ENGINE_V2 } from '../../../../models/harvester/persistentvolumeclaim'; import { DATA_ENGINE_V2 } from '../../../../models/harvester/persistentvolumeclaim';
import { GIBIBYTE } from '../../../../utils/unit';
import { VOLUME_MODE } from '@pkg/harvester/config/types';
export default { export default {
name: 'HarvesterEditVolume', name: 'HarvesterEditVolume',
@@ -58,6 +60,7 @@ export default {
data() { data() {
return { return {
GIBIBYTE,
VOLUME_TYPE, VOLUME_TYPE,
InterfaceOption, InterfaceOption,
loading: false, loading: false,
@@ -69,6 +72,10 @@ export default {
return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport'); return this.$store.getters['harvester-common/getFeatureEnabled']('longhornV2LVMSupport');
}, },
thirdPartyStorageClassEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
},
encryptionValue() { encryptionValue() {
return ucFirst(String(this.value.isEncrypted)); return ucFirst(String(this.value.isEncrypted));
}, },
@@ -89,6 +96,18 @@ export default {
return allPVCs.find((P) => P.id === `${ this.namespace }/${ this.value.volumeName }`); return allPVCs.find((P) => P.id === `${ this.namespace }/${ this.value.volumeName }`);
}, },
showVolumeMode() {
if (!this.thirdPartyStorageClassEnabled || !!this.value?.storageClassName === false) {
return false;
}
if (this.isLonghornStorageClass) {
return false;
}
return true;
},
isDisabled() { isDisabled() {
return !this.value.newCreateId && this.isEdit && this.isVirtualType; return !this.value.newCreateId && this.isEdit && this.isVirtualType;
}, },
@@ -110,7 +129,17 @@ export default {
isLonghornV2() { isLonghornV2() {
return this.value.pvc?.isLonghornV2 || this.value.pvc?.storageClass?.isLonghornV2; return this.value.pvc?.isLonghornV2 || this.value.pvc?.storageClass?.isLonghornV2;
} },
isLonghornStorageClass() {
const selectedSC = this.storageClasses.find((sc) => sc.name === this.value?.storageClassName) || {};
return selectedSC && selectedSC.isLonghorn;
},
volumeModeOptions() {
return Object.values(VOLUME_MODE);
},
}, },
watch: { watch: {
@@ -118,6 +147,8 @@ export default {
immediate: true, immediate: true,
handler(neu) { handler(neu) {
this.value.accessMode = this.getAccessMode(neu); this.value.accessMode = this.getAccessMode(neu);
this.value.volumeMode = this.getVolumeMode(neu, this.value.volumeMode);
this.update();
} }
}, },
@@ -140,7 +171,7 @@ export default {
minExponent: 3, minExponent: 3,
}); });
this.value.size = `${ formatSize }Gi`; this.value.size = `${ formatSize }${ GIBIBYTE }`;
} }
}, },
deep: true, deep: true,
@@ -149,6 +180,20 @@ export default {
}, },
methods: { methods: {
getVolumeMode(storageClassName, originalVolumeMode) {
if (!this.thirdPartyStorageClassEnabled) {
return VOLUME_MODE.BLOCK;
}
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
// longhorn v1, v2 use block volumeMode
if (storageClass && storageClass.isLonghorn) {
return VOLUME_MODE.BLOCK;
}
return originalVolumeMode;
},
getAccessMode(storageClassName) { getAccessMode(storageClassName) {
if (!this.longhornV2LVMSupport) { if (!this.longhornV2LVMSupport) {
return 'ReadWriteMany'; return 'ReadWriteMany';
@@ -156,10 +201,10 @@ export default {
const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName); const storageClass = this.storageClasses.find((sc) => sc.name === storageClassName);
let readWriteOnce = this.value.pvc?.isLvm || this.value.pvc?.isLonghornV2; let readWriteOnce = this.value.pvc?.isLvm || (!this.thirdPartyStorageClassEnabled && this.value.pvc?.isLonghornV2);
if (storageClass) { if (storageClass) {
readWriteOnce = storageClass.provisioner === LVM_DRIVER || storageClass.parameters?.dataEngine === DATA_ENGINE_V2; readWriteOnce = storageClass.provisioner === LVM_DRIVER || (!this.thirdPartyStorageClassEnabled && storageClass.parameters?.dataEngine === DATA_ENGINE_V2);
} }
return readWriteOnce ? 'ReadWriteOnce' : 'ReadWriteMany'; return readWriteOnce ? 'ReadWriteOnce' : 'ReadWriteMany';
@@ -258,6 +303,7 @@ export default {
:required="validateRequired" :required="validateRequired"
:label="t('harvester.fields.size')" :label="t('harvester.fields.size')"
:disabled="isLonghornV2" :disabled="isLonghornV2"
:suffix="GIBIBYTE"
@update:value="update" @update:value="update"
/> />
</InputOrDisplay> </InputOrDisplay>
@@ -283,6 +329,29 @@ export default {
/> />
</InputOrDisplay> </InputOrDisplay>
</div> </div>
<div
v-if="showVolumeMode"
data-testid="input-volume-mode"
class="col span-6"
>
<InputOrDisplay
:name="t('harvester.volume.volumeMode')"
:value="value.volumeMode"
:mode="mode"
>
<LabeledSelect
v-model:value="value.volumeMode"
:label="t('harvester.volume.volumeMode')"
:mode="mode"
:options="volumeModeOptions"
:disabled="isEdit"
required
@update:value="update"
/>
</InputOrDisplay>
</div>
</div>
<div class="row mb-20">
<div <div
v-if="value.volumeEncryptionFeatureEnabled && isView" v-if="value.volumeEncryptionFeatureEnabled && isView"
class="col span-6" class="col span-6"
@@ -292,11 +361,9 @@ export default {
:value="encryptionValue" :value="encryptionValue"
/> />
</div> </div>
</div>
<div class="row mb-20">
<div <div
v-if="value.volumeBackups && isView" v-if="value.volumeBackups && isView"
class="col span-3" class="col span-6"
> >
<LabelValue <LabelValue
:name="t('harvester.virtualMachine.volume.readyToUse')" :name="t('harvester.virtualMachine.volume.readyToUse')"
@@ -2,6 +2,7 @@
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import Tabbed from '@shell/components/Tabbed'; import Tabbed from '@shell/components/Tabbed';
import { clone } from '@shell/utils/object';
import Tab from '@shell/components/Tabbed/Tab'; import Tab from '@shell/components/Tabbed/Tab';
import { Checkbox } from '@components/Form/Checkbox'; import { Checkbox } from '@components/Form/Checkbox';
import CruResource from '@shell/components/CruResource'; import CruResource from '@shell/components/CruResource';
@@ -10,8 +11,6 @@ import { LabeledInput } from '@components/Form/LabeledInput';
import LabeledSelect from '@shell/components/form/LabeledSelect'; import LabeledSelect from '@shell/components/form/LabeledSelect';
import NameNsDescription from '@shell/components/form/NameNsDescription'; import NameNsDescription from '@shell/components/form/NameNsDescription';
import UnitInput from '@shell/components/form/UnitInput'; import UnitInput from '@shell/components/form/UnitInput';
import Labels from '@shell/components/form/Labels';
import NodeScheduling from '@shell/components/form/NodeScheduling'; import NodeScheduling from '@shell/components/form/NodeScheduling';
import PodAffinity from '@shell/components/form/PodAffinity'; import PodAffinity from '@shell/components/form/PodAffinity';
import VGpuDevices from './VirtualMachineVGpuDevices/index'; import VGpuDevices from './VirtualMachineVGpuDevices/index';
@@ -19,7 +18,6 @@ import UsbDevices from './VirtualMachineUSBDevices/index';
import KeyValue from '@shell/components/form/KeyValue'; import KeyValue from '@shell/components/form/KeyValue';
import { clear } from '@shell/utils/array'; import { clear } from '@shell/utils/array';
import { clone } from '@shell/utils/object';
import { saferDump } from '@shell/utils/create-yaml'; import { saferDump } from '@shell/utils/create-yaml';
import { exceptionToErrorsArray } from '@shell/utils/error'; import { exceptionToErrorsArray } from '@shell/utils/error';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
@@ -65,7 +63,6 @@ export default {
PodAffinity, PodAffinity,
AccessCredentials, AccessCredentials,
Reserved, Reserved,
Labels,
PciDevices, PciDevices,
RestartVMDialog, RestartVMDialog,
UnitInput, UnitInput,
@@ -195,7 +192,12 @@ export default {
return true; return true;
}, },
isValidationPassed() {
// check if any disk hasDiskError is true
const hasError = this.diskRows.some((disk) => disk.hasDiskError === true);
return !hasError;
},
showCpuPinningBanner() { showCpuPinningBanner() {
if (!this.value.cpuPinningFeatureEnabled) { if (!this.value.cpuPinningFeatureEnabled) {
return false; return false;
@@ -210,7 +212,10 @@ export default {
} }
return false; return false;
} },
usbPassthroughEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('usbPassthrough');
},
}, },
watch: { watch: {
@@ -408,12 +413,16 @@ export default {
const cloneDeepNewVM = clone(this.value); const cloneDeepNewVM = clone(this.value);
delete cloneDeepNewVM?.metadata; delete cloneDeepNewVM?.metadata;
delete cloneDeepNewVM?.__clone;
delete this.cloneVM?.metadata; delete this.cloneVM?.metadata;
delete this.cloneVM?.__clone; delete this.cloneVM?.__clone;
const oldVM = JSON.parse(JSON.stringify(this.cloneVM)); const oldVM = JSON.parse(JSON.stringify(this.cloneVM));
const newVM = JSON.parse(JSON.stringify(cloneDeepNewVM)); const newVM = JSON.parse(JSON.stringify(cloneDeepNewVM));
// we won't show restart dialog in yaml page as we don't have a way to detect change in yaml editor.
// only check VM is changed in form page.
if (isEqual(oldVM, newVM)) { if (isEqual(oldVM, newVM)) {
return; return;
} }
@@ -422,7 +431,11 @@ export default {
this.isOpen = true; this.isOpen = true;
this.$nextTick(() => { this.$nextTick(() => {
if (this?.$refs?.restartDialog) {
this.$refs.restartDialog.resolve = resolve; this.$refs.restartDialog.resolve = resolve;
} else {
return resolve();
}
}); });
}); });
}, },
@@ -489,6 +502,7 @@ export default {
:resource="value" :resource="value"
:cancel-event="true" :cancel-event="true"
:mode="mode" :mode="mode"
:validation-passed="isValidationPassed"
:can-yaml="isSingle ? true : false" :can-yaml="isSingle ? true : false"
:errors="errors" :errors="errors"
:generate-yaml="generateYaml" :generate-yaml="generateYaml"
@@ -579,7 +593,7 @@ export default {
:create-namespace="true" :create-namespace="true"
:namespace="value.metadata.namespace" :namespace="value.metadata.namespace"
:mode="mode" :mode="mode"
:disabled="isWindows" :disabled="isWindows || isEdit"
@update:sshKey="updateSSHKey" @update:sshKey="updateSSHKey"
@register-after-hook="registerAfterHook" @register-after-hook="registerAfterHook"
/> />
@@ -671,7 +685,7 @@ export default {
</Tab> </Tab>
<Tab <Tab
v-if="enabledPCI" v-if="enabledPCI && usbPassthroughEnabled"
:label="t('harvester.tab.usbDevices')" :label="t('harvester.tab.usbDevices')"
name="usbDevices" name="usbDevices"
:weight="-7" :weight="-7"
@@ -698,21 +712,34 @@ export default {
</Tab> </Tab>
<Tab <Tab
name="instanceLabel" name="labels"
:label="t('harvester.tab.instanceLabel')" :label="t('generic.labels')"
:weight="-8" :weight="-9"
> >
<Labels <Banner color="info">
:default-container-class="'labels-and-annotations-container'" <t k="harvester.virtualMachine.labels.banner" />
:value="value" </Banner>
:mode="mode"
:display-side-by-side="false"
:show-annotations="false"
:show-label-title="false"
>
<template #labels="{toggler}">
<KeyValue <KeyValue
key="labels" key="labels"
:value="value.labels"
:add-label="t('labels.addLabel')"
:mode="mode"
:read-allowed="false"
:value-can-be-empty="true"
@update:value="value.setLabels($event)"
/>
</Tab>
<Tab
name="instanceLabel"
:label="t('harvester.tab.instanceLabel')"
:weight="-10"
>
<Banner color="info">
<t k="harvester.virtualMachine.instanceLabels.banner" />
</Banner>
<KeyValue
key="instance-labels"
:value="value.instanceLabels" :value="value.instanceLabels"
:protected-keys="value.systemLabels || []" :protected-keys="value.systemLabels || []"
:toggle-filter="toggler" :toggle-filter="toggler"
@@ -722,14 +749,12 @@ export default {
:value-can-be-empty="true" :value-can-be-empty="true"
@update:value="value.setInstanceLabels($event)" @update:value="value.setInstanceLabels($event)"
/> />
</template>
</Labels>
</Tab> </Tab>
<Tab <Tab
name="advanced" name="advanced"
:label="t('harvester.tab.advanced')" :label="t('harvester.tab.advanced')"
:weight="-9" :weight="-11"
> >
<div class="row mb-20"> <div class="row mb-20">
<div class="col span-6"> <div class="col span-6">
@@ -873,11 +898,29 @@ export default {
:mode="mode" :mode="mode"
/> />
<Checkbox
v-if="value.tpmPersistentStateFeatureEnabled && tpmEnabled"
v-model:value="tpmPersistentStateEnabled"
class="check"
type="checkbox"
:label="t('harvester.virtualMachine.advancedOptions.tpmPersistentState')"
:mode="mode"
/>
<Checkbox <Checkbox
v-model:value="efiEnabled" v-model:value="efiEnabled"
class="check" class="check"
type="checkbox" type="checkbox"
:label="t('harvester.virtualMachine.efiEnabled')" :label="t('harvester.virtualMachine.advancedOptions.efiEnabled')"
:mode="mode"
/>
<Checkbox
v-if="value.efiPersistentStateFeatureEnabled && efiEnabled"
v-model:value="efiPersistentStateEnabled"
class="check"
type="checkbox"
:label="t('harvester.virtualMachine.advancedOptions.efiPersistentState')"
:mode="mode" :mode="mode"
/> />
@@ -886,9 +929,10 @@ export default {
v-model:value="secureBoot" v-model:value="secureBoot"
class="check" class="check"
type="checkbox" type="checkbox"
:label="t('harvester.virtualMachine.secureBoot')" :label="t('harvester.virtualMachine.advancedOptions.secureBoot')"
:mode="mode" :mode="mode"
/> />
<Banner <Banner
v-if="showCpuPinningBanner" v-if="showCpuPinningBanner"
color="warning" color="warning"
@@ -58,7 +58,7 @@ export default {
const out = []; const out = [];
blockDevices.map((b) => { blockDevices.map((b) => {
if (b.metadata.state.error) { if (b?.metadata?.state?.error) {
out.push(b.metadata.state.message); out.push(b.metadata.state.message);
} }
}); });
@@ -2,7 +2,7 @@
import ConsumptionGauge from '@shell/components/ConsumptionGauge'; import ConsumptionGauge from '@shell/components/ConsumptionGauge';
import { METRIC, NODE } from '@shell/config/types'; import { METRIC, NODE } from '@shell/config/types';
import { formatSi, exponentNeeded, UNITS, parseSi } from '@shell/utils/units'; import { formatSi, exponentNeeded, UNITS, parseSi } from '@shell/utils/units';
import { UNIT_SUFFIX } from '../utils/unit';
export default { export default {
name: 'HarvesterMemoryUsed', name: 'HarvesterMemoryUsed',
components: { ConsumptionGauge }, components: { ConsumptionGauge },
@@ -51,7 +51,7 @@ export default {
memoryUnits() { memoryUnits() {
const exponent = exponentNeeded(this.memoryTotal, 1024); const exponent = exponentNeeded(this.memoryTotal, 1024);
return `${ UNITS[exponent] }iB`; return `${ UNITS[exponent] }${ UNIT_SUFFIX }`;
}, },
node() { node() {
@@ -2,6 +2,7 @@
import ConsumptionGauge from '@shell/components/ConsumptionGauge'; import ConsumptionGauge from '@shell/components/ConsumptionGauge';
import { LONGHORN } from '@shell/config/types'; import { LONGHORN } from '@shell/config/types';
import { formatSi, exponentNeeded, UNITS } from '@shell/utils/units'; import { formatSi, exponentNeeded, UNITS } from '@shell/utils/units';
import { UNIT_SUFFIX } from '../utils/unit';
export default { export default {
name: 'HarvesterStorageUsed', name: 'HarvesterStorageUsed',
@@ -75,13 +76,13 @@ export default {
allocatedUnits() { allocatedUnits() {
const exponent = exponentNeeded(this.storageStats.total, 1024); const exponent = exponentNeeded(this.storageStats.total, 1024);
return `${ UNITS[exponent] }iB`; return `${ UNITS[exponent] }${ UNIT_SUFFIX }`;
}, },
usedUnits() { usedUnits() {
const exponent = exponentNeeded(this.storageStats.maximum, 1024); const exponent = exponentNeeded(this.storageStats.maximum, 1024);
return `${ UNITS[exponent] }iB`; return `${ UNITS[exponent] }${ UNIT_SUFFIX }`;
}, },
formatUsed() { formatUsed() {
+5
View File
@@ -6,6 +6,7 @@ import harvesterCommonStore from './store/harvester-common';
import harvesterStore from './store/harvester-store'; import harvesterStore from './store/harvester-store';
import customValidators from './validators'; import customValidators from './validators';
import { PRODUCT_NAME } from './config/harvester'; import { PRODUCT_NAME } from './config/harvester';
import { defineAsyncComponent } from 'vue';
// Init the package // Init the package
export default function (plugin: IPlugin) { export default function (plugin: IPlugin) {
@@ -28,4 +29,8 @@ export default function (plugin: IPlugin) {
plugin.validators = customValidators; plugin.validators = customValidators;
plugin.addRoutes(extensionRoutes); plugin.addRoutes(extensionRoutes);
plugin.register('component', 'NavHeaderRight', defineAsyncComponent(() =>
import('./components/HarvesterUpgradeHeader.vue')
));
} }
+50 -14
View File
@@ -38,7 +38,27 @@ asyncButton:
success: Restarted success: Restarted
waiting: Restarting&hellip; waiting: Restarting&hellip;
dialog:
confirmExecution:
title: Are you sure?
andOthers: |-
{count, plural,
=0 {}
=1 { and <b>one other </b>}
other { and <b>{count} other </b>}
}
protip: "Tip: Hold the {alternateLabel} key while clicking action to bypass this confirmation"
stop:
message: "Are you sure you want to continue stop the {type} {names}?"
pause:
message: "Are you sure you want to continue pause the {type} {names}?"
harvester: harvester:
branding:
logos:
tip: 'Upload a logo to replace the Harvester logo in the top-level navigation header. Image height should be 21 pixels with a max width of 200 pixels. Max file size is 20KB. Accepted formats: JPEG, PNG, SVG.'
favicon:
tip: 'Upload an icon to replace the Harvester favicon in the browser tab. Max file size is 20KB'
productLabel: 'Harvester' productLabel: 'Harvester'
modal: modal:
backup: backup:
@@ -79,6 +99,11 @@ harvester:
tip: Please enter a virtual machine name! tip: Please enter a virtual machine name!
success: 'Virtual machine { name } cloned successfully.' success: 'Virtual machine { name } cloned successfully.'
failed: 'Failed clone virtual machine!' failed: 'Failed clone virtual machine!'
downloadImage:
title: Download Image
banner: 'This action takes a while depending on the image size ({ size }). Please be patient.'
startMessage : 'The download process will auto start once the conversion is complete.'
download: Download
exportImage: exportImage:
title: Export to Image title: Export to Image
name: Name name: Name
@@ -579,15 +604,17 @@ harvester:
enableUsb: Enable USB Tablet enableUsb: Enable USB Tablet
advancedOptions: advancedOptions:
tpm: Enable TPM tpm: Enable TPM
tpmPersistentState: TPM Persistent State
cpuManager: cpuManager:
prefix: You must enable CPU Manager for at least one node in prefix: You must enable CPU Manager for at least one node in
middle: 'host page' middle: 'host page'
suffix: to enable CPU Pinning for VM suffix: to enable CPU Pinning for VM
efiEnabled: Booting in EFI mode
efiPersistentState: EFI Persistent State
secureBoot: Secure Boot
usbTip: Provides an absolute pointer device which often helps with getting a consistent mouse cursor position in VNC. usbTip: Provides an absolute pointer device which often helps with getting a consistent mouse cursor position in VNC.
sshTitle: Add Public SSH Key sshTitle: Add Public SSH Key
imageTip: An external URL to the .iso, .img, .qcow2 or .raw that the virtual machine should be created from. imageTip: An external URL to the .iso, .img, .qcow2 or .raw that the virtual machine should be created from.
efiEnabled: Booting in EFI mode
secureBoot: Secure Boot
volume: volume:
dragTip: Drag and drop volumes, or use the volume's arrows, to change the boot order. dragTip: Drag and drop volumes, or use the volume's arrows, to change the boot order.
volumeTip: The virtual machine only contains a CD-ROM volume. You may want to add additional disk volumes. volumeTip: The virtual machine only contains a CD-ROM volume. You may want to add additional disk volumes.
@@ -608,6 +635,7 @@ harvester:
setFirst: Set as root volume setFirst: Set as root volume
saveVolume: Update Volume saveVolume: Update Volume
encryption: Encryption encryption: Encryption
vmImageVolumeTip: Disk size ({diskSize}) should greater than selected image virtual size ({imageVirtualSize})
lockTooltip: lockTooltip:
all: All volumes are encrypted. all: All volumes are encrypted.
partial: Some volumes are encrypted. partial: Some volumes are encrypted.
@@ -742,11 +770,18 @@ harvester:
terminationGracePeriodSeconds: terminationGracePeriodSeconds:
label: Termination Grace Period label: Termination Grace Period
affinity: affinity:
addLabel: Add Workload Selector
topologyKey:
placeholder: 'topology.kubernetes.io/zone'
thisPodNamespace: This virtual machine's namespace thisPodNamespace: This virtual machine's namespace
matchExpressions: matchExpressions:
inNamespaces: "Workloads in these namespaces" inNamespaces: "Workloads in these namespaces"
namespaces: namespaces:
label: Namespaces label: Namespaces
instanceLabels:
banner: These labels are automatically synchronized to the virtual machine instance.
labels:
banner: These key values are added as labels to the virtual machine.
volume: volume:
label: Volumes label: Volumes
@@ -756,6 +791,7 @@ harvester:
datasource: Data Source datasource: Data Source
details: Details details: Details
size: Size size: Size
volumeMode: Volume Mode
source: Source source: Source
kind: Kind kind: Kind
sourceOptions: sourceOptions:
@@ -830,6 +866,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
@@ -894,6 +931,9 @@ harvester:
label: Virtual Machine Backups label: Virtual Machine Backups
createText: Restore Backup createText: Restore Backup
title: Restore Virtual Machine title: Restore Virtual Machine
refreshInterval:
label: Refresh Interval
tip: The interval for the backup target to sync data to harvester cluster. Set to 0 to disable refresh mechanism.
backupTargetTip: The endpoint used to access the backupstore. NFS and S3 are supported. backupTargetTip: The endpoint used to access the backupstore. NFS and S3 are supported.
message: message:
noSetting: noSetting:
@@ -1003,7 +1043,7 @@ harvester:
invalid: '"Exclude list" is invalid.' invalid: '"Exclude list" is invalid.'
addIp: Add Exclude IP addIp: Add Exclude IP
warning: 'WARNING: <br/> Any change to storage-network requires shutting down all virtual machines before applying this setting. <br/> Users have to ensure the cluster network is configured and VLAN Configuration will cover all nodes and ensure the network connectivity is working and expected in all nodes.' warning: 'WARNING: <br/> Any change to storage-network requires shutting down all virtual machines before applying this setting. <br/> Users have to ensure the cluster network is configured and VLAN Configuration will cover all nodes and ensure the network connectivity is working and expected in all nodes.'
tip: 'Specify an IP range in the IPv4 CIDR format. <code>Number of IPs Required = Number of Nodes * 4 + Number of Disks * 2 + Number of Images to Download/Upload </code>. For more information about storage network settings, see the <a href="{url}" target="_blank">documentation</a>.' tip: 'Specify an IP range in the IPv4 CIDR format. <code>Number of IPs Required = Number of Nodes * 2 + Number of Disks * 2 + Number of Images to Download/Upload </code>. For more information about storage network settings, see the <a href="{url}" target="_blank">documentation</a>.'
vmForceDeletionPolicy: vmForceDeletionPolicy:
period: Period period: Period
ratio : Ratio ratio : Ratio
@@ -1494,17 +1534,13 @@ harvester:
pollingInterval: pollingInterval:
label: Polling Interval label: Polling Interval
affinity: typeDescription:
thisPodNamespace: This virtual machine's namespace # Map of
matchExpressions: # type: Description to be shown on the top of list view describing the type.
inNamespaces: "Workloads in these namespaces" # Should fit on one line.
vmAffinityTitle: Virtual Machine Scheduling # If you link to anything external, it MUST have
namespaces: # target="_blank" rel="noopener noreferrer nofollow"
placeholder: e.g. default,system,base harvester: "Branding allows administrators to globally re-brand the UI by customizing the Harvester product name, logos and color scheme."
label: Namespaces
addLabel: Add Workload Selector
topologyKey:
placeholder: 'topology.kubernetes.io/zone'
advancedSettings: advancedSettings:
experimental: 'Experimental features allow users to test and evaluate early-access functionality prior to official supported releases' experimental: 'Experimental features allow users to test and evaluate early-access functionality prior to official supported releases'
@@ -8,9 +8,7 @@ import Banner from '@components/Banner/Banner.vue';
import MessageLink from '@shell/components/MessageLink'; import MessageLink from '@shell/components/MessageLink';
import SortableTable from '@shell/components/SortableTable'; import SortableTable from '@shell/components/SortableTable';
import { allHash, setPromiseResult } from '@shell/utils/promise'; import { allHash, setPromiseResult } from '@shell/utils/promise';
import { import { parseSi, formatSi, exponentNeeded, UNITS } from '@shell/utils/units';
parseSi, formatSi, exponentNeeded, UNITS, createMemoryValues
} from '@shell/utils/units';
import { REASON } from '@shell/config/table-headers'; import { REASON } from '@shell/config/table-headers';
import { import {
EVENT, METRIC, NODE, SERVICE, PVC, LONGHORN, POD, COUNT, NETWORK_ATTACHMENT EVENT, METRIC, NODE, SERVICE, PVC, LONGHORN, POD, COUNT, NETWORK_ATTACHMENT
@@ -27,22 +25,21 @@ import { isEmpty } from '@shell/utils/object';
import { HCI } from '../types'; import { HCI } from '../types';
import HarvesterUpgrade from '../components/HarvesterUpgrade'; import HarvesterUpgrade from '../components/HarvesterUpgrade';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester'; import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester';
import { UNIT_SUFFIX } from '../utils/unit';
dayjs.extend(utc); dayjs.extend(utc);
dayjs.extend(minMax); dayjs.extend(minMax);
const PARSE_RULES = { const PARSE_RULES = {
memory: {
format: { format: {
addSuffix: true, addSuffix: true,
firstSuffix: 'B', firstSuffix: UNIT_SUFFIX,
increment: 1024, increment: 1024,
maxExponent: 99, maxExponent: 99,
maxPrecision: 2, maxPrecision: 2,
minExponent: 0, minExponent: 0,
startingExponent: 0, startingExponent: 0,
suffix: 'iB', suffix: UNIT_SUFFIX,
}
} }
}; };
@@ -402,13 +399,13 @@ export default {
storageUsed() { storageUsed() {
const stats = this.storageStats; const stats = this.storageStats;
return this.createMemoryValues(stats.maximum, stats.used); return this.createDisplayValues(stats.maximum, stats.used);
}, },
storageAllocated() { storageAllocated() {
const stats = this.storageStats; const stats = this.storageStats;
return this.createMemoryValues(stats.total, stats.scheduled); return this.createDisplayValues(stats.total, stats.scheduled);
}, },
vmEvents() { vmEvents() {
@@ -454,7 +451,7 @@ export default {
return total + node.memoryReserved; return total + node.memoryReserved;
}, 0); }, 0);
return createMemoryValues(this.memoryTotal, useful); return this.createDisplayValues(this.memoryTotal, useful);
}, },
availableNodes() { availableNodes() {
@@ -494,7 +491,7 @@ export default {
}, },
ramUsed() { ramUsed() {
return createMemoryValues(this.memoryTotal, this.metricAggregations?.memory); return this.createDisplayValues(this.memoryTotal, this.metricAggregations?.memory);
}, },
hasMetricNodeSchema() { hasMetricNodeSchema() {
@@ -516,10 +513,12 @@ export default {
}, },
methods: { methods: {
createMemoryValues(total, useful) { createDisplayValues(total, useful) {
const parsedTotal = parseSi((total || '0').toString()); const parsedTotal = parseSi((total || '0').toString());
const parsedUseful = parseSi((useful || '0').toString()); const parsedUseful = parseSi((useful || '0').toString());
const format = this.createMemoryFormat(parsedTotal); const format = this.createFormat(parsedTotal);
const formattedTotal = formatSi(parsedTotal, format); const formattedTotal = formatSi(parsedTotal, format);
let formattedUseful = formatSi(parsedUseful, { let formattedUseful = formatSi(parsedUseful, {
...format, ...format,
@@ -538,24 +537,24 @@ export default {
useful: Number(parsedUseful), useful: Number(parsedUseful),
formattedTotal, formattedTotal,
formattedUseful, formattedUseful,
units: this.createMemoryUnits(parsedTotal), units: this.createUnits(parsedTotal),
}; };
}, },
createMemoryFormat(n) { createFormat(n) {
const exponent = exponentNeeded(n, PARSE_RULES.memory.format.increment); const exponent = exponentNeeded(n, PARSE_RULES.format.increment);
return { return {
...PARSE_RULES.memory.format, ...PARSE_RULES.format,
maxExponent: exponent, maxExponent: exponent,
minExponent: exponent, minExponent: exponent,
}; };
}, },
createMemoryUnits(n) { createUnits(n) {
const exponent = exponentNeeded(n, PARSE_RULES.memory.format.increment); const exponent = exponentNeeded(n, PARSE_RULES.format.increment);
return `${ UNITS[exponent] }${ PARSE_RULES.memory.format.suffix }`; return `${ UNITS[exponent] }${ PARSE_RULES.format.suffix }`;
}, },
async fetchClusterResources(type, opt = {}, store) { async fetchClusterResources(type, opt = {}, store) {
+2 -2
View File
@@ -101,14 +101,14 @@ export default {
const metricCol = [ const metricCol = [
{ {
name: 'cpu', name: 'cpu',
labelKey: 'node.detail.glance.consumptionGauge.cpu', labelKey: 'harvester.dashboard.hardwareResourceGauge.cpu',
value: 'id', value: 'id',
formatter: 'HarvesterCPUUsed', formatter: 'HarvesterCPUUsed',
formatterOpts: { showUsed: true }, formatterOpts: { showUsed: true },
}, },
{ {
name: 'memory', name: 'memory',
labelKey: 'node.detail.glance.consumptionGauge.memory', labelKey: 'harvester.dashboard.hardwareResourceGauge.memory',
value: 'id', value: 'id',
formatter: 'HarvesterMemoryUsed', formatter: 'HarvesterMemoryUsed',
formatterOpts: { showUsed: true }, formatterOpts: { showUsed: true },
@@ -101,7 +101,7 @@ export default {
v-bind="$attrs" v-bind="$attrs"
:headers="headers" :headers="headers"
:sub-rows="true" :sub-rows="true"
:groupable="false" :groupable="true"
:rows="rows" :rows="rows"
:group-title-by="groupTitleBy" :group-title-by="groupTitleBy"
:group-by="groupBy" :group-by="groupBy"
@@ -9,6 +9,7 @@ import HarvesterVolumeState from '../formatters/HarvesterVolumeState';
import { allSettled } from '../utils/promise'; import { allSettled } from '../utils/promise';
import { HCI, VOLUME_SNAPSHOT } from '../types'; import { HCI, VOLUME_SNAPSHOT } from '../types';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
const schema = { const schema = {
id: HCI.VOLUME, id: HCI.VOLUME,
@@ -58,7 +59,6 @@ export default {
if (!pvcSchema?.collectionMethods.find((x) => x.toLowerCase() === 'post')) { if (!pvcSchema?.collectionMethods.find((x) => x.toLowerCase() === 'post')) {
this.$store.dispatch('type-map/configureType', { match: HCI.VOLUME, isCreatable: false }); this.$store.dispatch('type-map/configureType', { match: HCI.VOLUME, isCreatable: false });
} }
this.rows = hash.pvcs; this.rows = hash.pvcs;
}, },
@@ -70,7 +70,10 @@ export default {
schema() { schema() {
return schema; return schema;
}, },
filterRows() {
// we only show the non golden image PVCs in the list
return this.rows.filter((pvc) => pvc?.metadata?.annotations?.[HCI_ANNOTATIONS.GOLDEN_IMAGE] !== 'true');
},
headers() { headers() {
return [ return [
STATE, STATE,
@@ -92,7 +95,8 @@ export default {
{ {
name: 'storageClass', name: 'storageClass',
labelKey: 'tableHeaders.storageClass', labelKey: 'tableHeaders.storageClass',
value: 'spec.storageClassName' value: 'spec.storageClassName',
sort: 'spec.storageClassName'
}, },
{ {
name: 'AttachedVM', name: 'AttachedVM',
@@ -146,7 +150,7 @@ export default {
:groupable="true" :groupable="true"
default-sort-by="age" default-sort-by="age"
:namespaced="true" :namespaced="true"
:rows="rows" :rows="filterRows"
:schema="schema" :schema="schema"
key-field="_key" key-field="_key"
> >
+9 -1
View File
@@ -137,7 +137,15 @@ export default {
}, },
isTpmEnabled(spec) { isTpmEnabled(spec) {
return !!spec?.template?.spec?.domain?.devices?.tpm ; return !!spec?.template?.spec?.domain?.devices?.tpm;
},
isTPMPersistentStateEnabled(spec) {
return !!spec?.template?.spec?.domain?.devices?.tpm?.persistent;
},
isEFIPersistentStateEnabled(spec) {
return !!spec?.template?.spec?.domain?.firmware?.bootloader?.efi?.persistent;
}, },
isSecureBoot(spec) { isSecureBoot(spec) {
+67 -38
View File
@@ -25,6 +25,8 @@ import { HCI_SETTING } from '../../config/settings';
import { HCI } from '../../types'; import { HCI } from '../../types';
import { parseVolumeClaimTemplates } from '../../utils/vm'; import { parseVolumeClaimTemplates } from '../../utils/vm';
import impl, { QGA_JSON, USB_TABLET } from './impl'; import impl, { QGA_JSON, USB_TABLET } from './impl';
import { GIBIBYTE } from '../../utils/unit';
import { VOLUME_MODE } from '@pkg/harvester/config/types';
const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine'; const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';
@@ -164,6 +166,8 @@ export default {
accessCredentials: [], accessCredentials: [],
efiEnabled: false, efiEnabled: false,
tpmEnabled: false, tpmEnabled: false,
tpmPersistentStateEnabled: false,
efiPersistentStateEnabled: false,
secureBoot: false, secureBoot: false,
userDataTemplateId: '', userDataTemplateId: '',
saveUserDataAsClearText: false, saveUserDataAsClearText: false,
@@ -217,7 +221,7 @@ export default {
const selectedVMNetworks = networkNames.map((name) => vmNetworks.find((n) => n.id === name)).filter((n) => n?.id); const selectedVMNetworks = networkNames.map((name) => vmNetworks.find((n) => n.id === name)).filter((n) => n?.id);
const clusterNetworks = uniq(selectedVMNetworks.map((n) => n.clusterNetworkResource?.id)); const clusterNetworks = uniq(selectedVMNetworks.map((n) => n.clusterNetworkResource?.id));
return nodes.filter((N) => !N.isUnSchedulable).map((node) => { return nodes.filter((N) => !N.isUnSchedulable && N.isEtcd !== 'true').map((node) => {
const requireLabelKeys = []; const requireLabelKeys = [];
let isNetworkSchedule = true; let isNetworkSchedule = true;
@@ -241,12 +245,6 @@ export default {
}); });
}, },
defaultStorageClass() {
const defaultStorage = this.$store.getters[`${ this.inStore }/all`](STORAGE_CLASS).find( (O) => O.isDefault);
return defaultStorage;
},
storageClassSetting() { storageClassSetting() {
try { try {
const storageClassValue = this.$store.getters[`${ this.inStore }/all`](HCI.SETTING).find( (O) => O.id === HCI_SETTING.DEFAULT_STORAGE_CLASS)?.value; const storageClassValue = this.$store.getters[`${ this.inStore }/all`](HCI.SETTING).find( (O) => O.id === HCI_SETTING.DEFAULT_STORAGE_CLASS)?.value;
@@ -258,7 +256,7 @@ export default {
}, },
customVolumeMode() { customVolumeMode() {
return this.storageClassSetting.volumeMode || 'Block'; return this.storageClassSetting.volumeMode || VOLUME_MODE.BLOCK;
}, },
customAccessMode() { customAccessMode() {
@@ -282,14 +280,14 @@ export default {
affinityLabels() { affinityLabels() {
return { return {
namespaceInputLabel: this.t('harvesterManager.affinity.namespaces.label'), namespaceInputLabel: this.t('harvester.virtualMachine.affinity.namespaces.label'),
namespaceSelectionLabels: [ namespaceSelectionLabels: [
this.t('harvesterManager.affinity.thisPodNamespace'), this.t('harvester.virtualMachine.affinity.thisPodNamespace'),
this.t('workload.scheduling.affinity.allNamespaces'), this.t('workload.scheduling.affinity.allNamespaces'),
this.t('harvesterManager.affinity.matchExpressions.inNamespaces') this.t('harvester.virtualMachine.affinity.matchExpressions.inNamespaces')
], ],
addLabel: this.t('harvesterManager.affinity.addLabel'), addLabel: this.t('harvester.virtualMachine.affinity.addLabel'),
topologyKeyPlaceholder: this.t('harvesterManager.affinity.topologyKey.placeholder') topologyKeyPlaceholder: this.t('harvester.virtualMachine.affinity.topologyKey.placeholder')
}; };
}, },
}, },
@@ -367,6 +365,8 @@ export default {
const installAgent = this.hasInstallAgent(userData, osType, true); const installAgent = this.hasInstallAgent(userData, osType, true);
const efiEnabled = this.isEfiEnabled(spec); const efiEnabled = this.isEfiEnabled(spec);
const tpmEnabled = this.isTpmEnabled(spec); const tpmEnabled = this.isTpmEnabled(spec);
const tpmPersistentStateEnabled = this.isTPMPersistentStateEnabled(spec);
const efiPersistentStateEnabled = this.isEFIPersistentStateEnabled(spec);
const secureBoot = this.isSecureBoot(spec); const secureBoot = this.isSecureBoot(spec);
const cpuPinning = this.isCpuPinning(spec); const cpuPinning = this.isCpuPinning(spec);
@@ -398,7 +398,9 @@ export default {
this['installUSBTablet'] = installUSBTablet; this['installUSBTablet'] = installUSBTablet;
this['efiEnabled'] = efiEnabled; this['efiEnabled'] = efiEnabled;
this['efiPersistentStateEnabled'] = efiPersistentStateEnabled;
this['tpmEnabled'] = tpmEnabled; this['tpmEnabled'] = tpmEnabled;
this['tpmPersistentStateEnabled'] = tpmPersistentStateEnabled;
this['secureBoot'] = secureBoot; this['secureBoot'] = secureBoot;
this['cpuPinning'] = cpuPinning; this['cpuPinning'] = cpuPinning;
@@ -442,7 +444,7 @@ export default {
if (!isIsoImage) { if (!isIsoImage) {
imageSizeGiB = Math.max(imageSizeGiB, 10); imageSizeGiB = Math.max(imageSizeGiB, 10);
} }
size = `${ imageSizeGiB }Gi`; size = `${ imageSizeGiB }${ GIBIBYTE }`;
} }
out.push({ out.push({
@@ -456,7 +458,7 @@ export default {
type, type,
storageClassName: '', storageClassName: '',
image: this.imageId, image: this.imageId,
volumeMode: 'Block', volumeMode: VOLUME_MODE.BLOCK,
isEncrypted, isEncrypted,
volumeBackups, volumeBackups,
}); });
@@ -515,7 +517,7 @@ export default {
accessMode = pvcResource?.spec?.accessModes?.[0] || 'ReadWriteMany'; accessMode = pvcResource?.spec?.accessModes?.[0] || 'ReadWriteMany';
size = pvcResource?.spec?.resources?.requests?.storage || '10Gi'; size = pvcResource?.spec?.resources?.requests?.storage || '10Gi';
storageClassName = pvcResource?.spec?.storageClassName; storageClassName = pvcResource?.spec?.storageClassName;
volumeMode = pvcResource?.spec?.volumeMode || 'Block'; volumeMode = pvcResource?.spec?.volumeMode || VOLUME_MODE.BLOCK;
volumeName = pvcResource?.metadata?.name || ''; volumeName = pvcResource?.metadata?.name || '';
} }
@@ -552,7 +554,7 @@ export default {
volumeName, volumeName,
container, container,
accessMode, accessMode,
size: `${ formatSize }Gi`, size: `${ formatSize }${ GIBIBYTE }`,
volumeMode: volumeMode || this.customVolumeMode, volumeMode: volumeMode || this.customVolumeMode,
image, image,
type, type,
@@ -667,7 +669,7 @@ export default {
} }
}); });
if (!this.secretName || this.needNewSecret) { if (!this.secretName) {
this.secretName = this.generateSecretName(this.secretNamePrefix); this.secretName = this.generateSecretName(this.secretNamePrefix);
} }
@@ -869,7 +871,7 @@ export default {
} }
} }
if (out.length === 0 && !!this.spec.template.spec.accessCredentials) { if (out.length === 0 && !!this.spec.template.spec.accessCredentials === false) {
delete this.spec.template.spec.accessCredentials; delete this.spec.template.spec.accessCredentials;
} else { } else {
this.spec.template.spec.accessCredentials = out; this.spec.template.spec.accessCredentials = out;
@@ -894,8 +896,8 @@ export default {
}, },
/** /**
* Generate user data yaml which is decide by the "Install guest agent", * Generate user data yaml which is decided by the
* "OS type", "SSH Keys" and user input. * "Install guest agent", "OS type", "SSH keys" and user input.
* @param config * @param config
*/ */
getUserData(config) { getUserData(config) {
@@ -967,7 +969,7 @@ export default {
parseVolumeClaimTemplate(R, dataVolumeName) { parseVolumeClaimTemplate(R, dataVolumeName) {
if (!String(R.size).includes('Gi') && R.size) { if (!String(R.size).includes('Gi') && R.size) {
R.size = `${ R.size }Gi`; R.size = `${ R.size }${ GIBIBYTE }`;
} }
const out = { const out = {
@@ -1212,7 +1214,6 @@ export default {
let secret = this.getSecret(vm.spec); let secret = this.getSecret(vm.spec);
// const userData = this.getUserData({ osType: this.osType, installAgent: this.installAgent });
if (!secret && this.isEdit && this.secretRef) { if (!secret && this.isEdit && this.secretRef) {
// When editing the vm, if the userData and networkData are deleted, we also need to clean up the secret values // When editing the vm, if the userData and networkData are deleted, we also need to clean up the secret values
secret = this.secretRef; secret = this.secretRef;
@@ -1383,13 +1384,21 @@ export default {
} }
}, },
setBootMethod(boot = { efi: false, secureBoot: false }) { setBootMethod(boot = {
if (boot.efi && boot.secureBoot) { efi: false, secureBoot: false, efiPersistentStateEnabled: false
set(this.spec.template.spec.domain, 'features.smm.enabled', true); }) {
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', true); if (boot.efi) {
} else if (boot.efi && !boot.secureBoot) { set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', boot.secureBoot);
// set(this.spec.template.spec.domain, 'features.smm.enabled', false); } else {
delete this.spec.template.spec.domain['firmware'];
delete this.spec.template.spec.domain.features['smm'];
return;
}
if (boot.secureBoot) {
set(this.spec.template.spec.domain, 'features.smm.enabled', true);
} else {
try { try {
delete this.spec.template.spec.domain.features.smm['enabled']; delete this.spec.template.spec.domain.features.smm['enabled'];
const noKeys = Object.keys(this.spec.template.spec.domain.features.smm).length === 0; const noKeys = Object.keys(this.spec.template.spec.domain.features.smm).length === 0;
@@ -1398,10 +1407,12 @@ export default {
delete this.spec.template.spec.domain.features['smm']; delete this.spec.template.spec.domain.features['smm'];
} }
} catch (e) {} } catch (e) {}
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', false); }
if (boot.efiPersistentStateEnabled) {
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.persistent', true);
} else { } else {
delete this.spec.template.spec.domain['firmware']; delete this.spec.template.spec.domain.firmware.bootloader.efi['persistent'];
delete this.spec.template.spec.domain.features['smm'];
} }
}, },
@@ -1413,9 +1424,9 @@ export default {
} }
}, },
setTPM(tpmEnabled) { setTPM({ tpmEnabled = false, tpmPersistentStateEnabled = false } = {}) {
if (tpmEnabled) { if (tpmEnabled) {
set(this.spec.template.spec.domain.devices, 'tpm', {}); set(this.spec.template.spec.domain.devices, 'tpm', tpmPersistentStateEnabled ? { persistent: true } : {});
} else { } else {
delete this.spec.template.spec.domain.devices['tpm']; delete this.spec.template.spec.domain.devices['tpm'];
} }
@@ -1529,11 +1540,21 @@ export default {
}, },
efiEnabled(val) { efiEnabled(val) {
this.setBootMethod({ efi: val, secureBoot: this.secureBoot }); this.setBootMethod({
efi: val, secureBoot: this.secureBoot, efiPersistentStateEnabled: this.efiPersistentStateEnabled
});
}, },
secureBoot(val) { secureBoot(val) {
this.setBootMethod({ efi: this.efiEnabled, secureBoot: val }); this.setBootMethod({
efi: this.efiEnabled, secureBoot: val, efiPersistentStateEnabled: this.efiPersistentStateEnabled
});
},
efiPersistentStateEnabled(val) {
this.setBootMethod({
efi: this.efiEnabled, secureBoot: this.secureBoot, efiPersistentStateEnabled: val
});
}, },
cpuPinning(value) { cpuPinning(value) {
@@ -1541,7 +1562,11 @@ export default {
}, },
tpmEnabled(val) { tpmEnabled(val) {
this.setTPM(val); this.setTPM({ tpmEnabled: val, tpmPersistentStateEnabled: this.tpmPersistentStateEnabled });
},
tpmPersistentStateEnabled(val) {
this.setTPM({ tpmEnabled: this.tpmEnabled, tpmPersistentStateEnabled: val });
}, },
installAgent: { installAgent: {
@@ -1590,9 +1615,13 @@ export default {
}, },
sshKey(neu, old) { sshKey(neu, old) {
// refresh yaml editor to get the latest userScript
this.userScript = this.getUserData({ installAgent: this.installAgent, osType: this.osType });
this.refreshYamlEditor();
const _diff = difference(old, neu); const _diff = difference(old, neu);
if (_diff.length && this.isEdit) { if (_diff.length > 0 && this.isCreate) {
this.deleteSSHFromUserData(_diff); this.deleteSSHFromUserData(_diff);
} }
} }
@@ -0,0 +1,11 @@
import SteveModel from '@shell/plugins/steve/steve-class';
/**
* Class representing PCI Device Claim resource.
* @extends SteveModal
*/
export default class PCIDeviceClaim extends SteveModel {
cleanForSave(data, _forNew) {
return data;
}
}
@@ -0,0 +1,11 @@
import SteveModel from '@shell/plugins/steve/steve-class';
/**
* Class representing USB Device Claim resource.
* @extends SteveModal
*/
export default class USBDeviceClaim extends SteveModel {
cleanForSave(data, _forNew) {
return data;
}
}
+4
View File
@@ -66,4 +66,8 @@ export default class HarvesterResource extends SteveModel {
return this.hasLink('self') && this.$rootGetters['prefs/get'](DEV); return this.hasLink('self') && this.$rootGetters['prefs/get'](DEV);
} }
} }
cleanForSave(data, _forNew) {
return data;
}
} }
+1 -1
View File
@@ -470,7 +470,7 @@ export default class HciNode extends HarvesterResource {
get canDelete() { get canDelete() {
const nodes = this.$rootGetters['harvester/all'](NODE) || []; const nodes = this.$rootGetters['harvester/all'](NODE) || [];
return nodes.length > 1; return nodes.length > 1 && super.canDelete;
} }
get vlanStatuses() { get vlanStatuses() {
@@ -46,22 +46,37 @@ export default class HciPv extends HarvesterResource {
} }
} }
if (!this.isLonghorn || !this.isLonghornV2) { const exportImageAction = {
out = [
{
action: 'exportImage', action: 'exportImage',
enabled: this.hasAction('export') && !this.isEncrypted, enabled: this.hasAction('export') && !this.isEncrypted,
icon: 'icon icon-copy', icon: 'icon icon-copy',
label: this.t('harvester.action.exportImage') label: this.t('harvester.action.exportImage')
}, };
{ const takeSnapshotAction = {
action: 'snapshot', action: 'snapshot',
enabled: this.hasAction('snapshot'), enabled: this.hasAction('snapshot'),
icon: 'icon icon-backup', icon: 'icon icon-backup',
label: this.t('harvester.action.snapshot'), label: this.t('harvester.action.snapshot'),
}, };
if (this.thirdPartyStorageFeatureEnabled) { // v1.5.0
out = [
exportImageAction,
takeSnapshotAction,
...out ...out
]; ];
// TODO: remove this block if Longhorn V2 engine supports restore volume snapshot
if (this.isLonghornV2) {
out = out.filter((action) => action.action !== takeSnapshotAction.action);
}
} else { // v1.4 / v1.3
if (!this.isLonghorn || !this.isLonghornV2) {
out = [
exportImageAction,
takeSnapshotAction,
...out
];
}
} }
return [ return [
@@ -238,7 +253,7 @@ export default class HciPv extends HarvesterResource {
} }
get isEncrypted() { get isEncrypted() {
return this.relatedPV?.spec.csi.volumeAttributes.encrypted === 'true'; return this.relatedPV?.spec?.csi?.volumeAttributes?.encrypted === 'true';
} }
get longhornVolume() { get longhornVolume() {
@@ -321,15 +336,27 @@ export default class HciPv extends HarvesterResource {
return this.volumeProvider === LONGHORN_DRIVER; return this.volumeProvider === LONGHORN_DRIVER;
} }
get isLonghornV1() {
return this.isLonghorn && !this.isLonghornV2;
}
get isLonghornV2() { get isLonghornV2() {
return this.dataEngine === DATA_ENGINE_V2; return this.dataEngine === DATA_ENGINE_V2;
} }
get thirdPartyStorageFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
}
get resourceExternalLink() { get resourceExternalLink() {
const host = window.location.host; const host = window.location.host;
const { params } = this.currentRoute(); const { params } = this.currentRoute();
const volumeName = this.spec?.volumeName; const volumeName = this.spec?.volumeName;
if (!this.isLonghorn) {
return null;
}
if (!volumeName) { if (!volumeName) {
return null; return null;
} }
@@ -3,4 +3,4 @@ import SteveSchema from '@shell/models/steve-schema';
/** /**
* This is the steve schema that's used for the harvester store * This is the steve schema that's used for the harvester store
*/ */
export default class HarvesterStoreSchema extends SteveSchema { } export default class HarvesterStoreSchema extends SteveSchema {}
@@ -58,6 +58,18 @@ export default class HciStorageClass extends StorageClass {
return key ? this.$rootGetters['i18n/t'](key) : this.provisioner; return key ? this.$rootGetters['i18n/t'](key) : this.provisioner;
} }
get isEncrypted() {
return this.parameters?.encrypted === 'true';
}
get isLonghorn() {
return this.provisioner === LONGHORN_DRIVER;
}
get isLonghornV1() {
return this.provisioner === LONGHORN_DRIVER && this.longhornVersion === DATA_ENGINE_V1;
}
get isLonghornV2() { get isLonghornV2() {
return this.provisioner === LONGHORN_DRIVER && this.longhornVersion === DATA_ENGINE_V2; return this.provisioner === LONGHORN_DRIVER && this.longhornVersion === DATA_ENGINE_V2;
} }
@@ -69,4 +81,8 @@ export default class HciStorageClass extends StorageClass {
get volumeEncryptionFeatureEnabled() { get volumeEncryptionFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption'); return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption');
} }
get thirdPartyStorageFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
}
} }
@@ -64,4 +64,10 @@ export default class HciBlockDevice extends HarvesterResource {
// spec.fileSystem.provisioned is deprecated // spec.fileSystem.provisioned is deprecated
return this.spec?.fileSystem?.provisioned || this.spec?.provision; return this.spec?.fileSystem?.provisioned || this.spec?.provision;
} }
// Overwrite cleanForSave() in shell/plugins/steve/steve-class.js as it deleted status object in harvesterhci.io.blockdevice CRD
// but /v1/harvester/harvesterhci.io.blockdevices/longhorn-system/{id} API requires status object
cleanForSave(data) {
return data;
}
} }
@@ -1,6 +1,4 @@
import HarvesterResource from './harvester'; import HarvesterResource from './harvester';
import { get } from '@shell/utils/object';
import { findBy } from '@shell/utils/array';
import { colorForState, stateDisplay, STATES } from '@shell/plugins/dashboard-store/resource-class'; import { colorForState, stateDisplay, STATES } from '@shell/plugins/dashboard-store/resource-class';
import { _CREATE } from '@shell/config/query-params'; import { _CREATE } from '@shell/config/query-params';
import { ucFirst, escapeHtml } from '@shell/utils/string'; import { ucFirst, escapeHtml } from '@shell/utils/string';
@@ -66,15 +64,12 @@ export default class ScheduleVmBackup extends HarvesterResource {
} }
} }
get state() { get stateObj() {
const conditions = get(this, 'status.conditions'); return this?.metadata?.state || {};
const isSuspended = findBy(conditions, 'type', 'BackupSuspend')?.status === 'True';
if (isSuspended) {
return STATES.suspended.label;
} }
return this.metadata.state.name; get state() {
return this.status?.suspended === true ? STATES.suspended.label : STATES.active.label;
} }
get stateDescription() { get stateDescription() {
@@ -61,6 +61,10 @@ export default class HciUpgrade extends HarvesterResource {
return this?.status?.imageID; return this?.status?.imageID;
} }
cleanForSave(data, _forNew) {
return data;
}
get upgradeMessage() { get upgradeMessage() {
const upgradeMessage = []; const upgradeMessage = [];
const nodeStatuses = this?.status?.nodeStatuses || {}; const nodeStatuses = this?.status?.nodeStatuses || {};
@@ -132,7 +132,7 @@ export default class HciVmBackup extends HarvesterResource {
} }
get sourceSchedule() { get sourceSchedule() {
return this.metadata?.annotations[HCI_ANNOTATIONS.SVM_BACKUP_ID]; return this.metadata?.annotations?.[HCI_ANNOTATIONS.SVM_BACKUP_ID];
} }
get attachVM() { get attachVM() {
@@ -12,6 +12,7 @@ import { HCI } from '../types';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester'; import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester';
import HarvesterResource from './harvester'; import HarvesterResource from './harvester';
import { CSI_SECRETS } from '@pkg/harvester/config/harvester-map'; import { CSI_SECRETS } from '@pkg/harvester/config/harvester-map';
import { UNIT_SUFFIX } from '../utils/unit';
const { const {
CSI_PROVISIONER_SECRET_NAME, CSI_PROVISIONER_SECRET_NAME,
@@ -72,7 +73,7 @@ export default class HciVmImage extends HarvesterResource {
disabled: !this.isReady, disabled: !this.isReady,
}, },
{ {
action: 'download', action: 'imageDownload',
enabled: this.links?.download, enabled: this.links?.download,
icon: 'icon icon-download', icon: 'icon icon-download',
label: this.t('asyncButton.download.action'), label: this.t('asyncButton.download.action'),
@@ -199,6 +200,10 @@ export default class HciVmImage extends HarvesterResource {
return `${ this.metadata.namespace }/${ this.spec.displayName }`; return `${ this.metadata.namespace }/${ this.spec.displayName }`;
} }
get imageStorageClass() {
return this?.metadata?.annotations?.[HCI_ANNOTATIONS.STORAGE_CLASS] || '';
}
get imageMessage() { get imageMessage() {
if (this.uploadError) { if (this.uploadError) {
return ucFirst(this.uploadError); return ucFirst(this.uploadError);
@@ -239,8 +244,8 @@ export default class HciVmImage extends HarvesterResource {
return formatSi(size, { return formatSi(size, {
increment: 1024, increment: 1024,
maxPrecision: 2, maxPrecision: 2,
suffix: 'B', suffix: UNIT_SUFFIX,
firstSuffix: 'B', firstSuffix: UNIT_SUFFIX,
}); });
} }
@@ -254,8 +259,8 @@ export default class HciVmImage extends HarvesterResource {
return formatSi(virtualSize, { return formatSi(virtualSize, {
increment: 1024, increment: 1024,
maxPrecision: 2, maxPrecision: 2,
suffix: 'B', suffix: UNIT_SUFFIX,
firstSuffix: 'B', firstSuffix: UNIT_SUFFIX,
}); });
} }
@@ -385,7 +390,23 @@ export default class HciVmImage extends HarvesterResource {
return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption'); return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption');
} }
download() { get thirdPartyStorageFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
}
imageDownload(resources = this) {
// spec.backend is introduced in v1.5.0. If it's not set, it's an old image can be downloaded via link
if (this.spec?.backend === 'cdi') {
this.$dispatch('promptModal', {
resources,
component: 'HarvesterImageDownloader'
});
} else {
this.downloadViaLink();
}
}
downloadViaLink() {
window.location.href = this.links.download; window.location.href = this.links.download;
} }
} }
@@ -2,6 +2,7 @@ import { MODE, _CREATE } from '@shell/config/query-params';
import { HCI } from '../types'; import { HCI } from '../types';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester'; import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester';
import HarvesterResource from './harvester'; import HarvesterResource from './harvester';
import { clone } from '@shell/utils/object';
export default class HciVmTemplate extends HarvesterResource { export default class HciVmTemplate extends HarvesterResource {
get availableActions() { get availableActions() {
@@ -71,4 +72,12 @@ export default class HciVmTemplate extends HarvesterResource {
get defaultVersion() { get defaultVersion() {
return this.status?.defaultVersion; return this.status?.defaultVersion;
} }
get doneOverride() {
const detailLocation = clone(this.listLocation);
detailLocation.params.resource = HCI.VM_VERSION;
return detailLocation;
}
} }
@@ -210,6 +210,10 @@ export default class HciVmTemplateVersion extends HarvesterResource {
await templateResource.save(); await templateResource.save();
} }
get cpuPinningFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('cpuPinning');
}
get defaultVersion() { get defaultVersion() {
const templates = this.$rootGetters['harvester/all'](HCI.VM_TEMPLATE); const templates = this.$rootGetters['harvester/all'](HCI.VM_TEMPLATE);
const template = templates.find((T) => this.templateId === T.id); const template = templates.find((T) => this.templateId === T.id);
@@ -272,4 +276,12 @@ export default class HciVmTemplateVersion extends HarvesterResource {
this.spec.vm.spec.template.metadata['labels'] = { ...wasIgnored, ...val }; this.spec.vm.spec.template.metadata['labels'] = { ...wasIgnored, ...val };
} }
get tpmPersistentStateFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('tpmPersistentState');
}
get efiPersistentStateFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('efiPersistentState');
}
} }
@@ -1,5 +1,8 @@
import SteveModel from '@shell/plugins/steve/steve-class'; import SteveModel from '@shell/plugins/steve/steve-class';
import { HCI } from '@shell/config/labels-annotations'; import { HCI } from '@shell/config/labels-annotations';
import { NETWORK_TYPE } from '../config/types';
const { UNTAGGED } = NETWORK_TYPE;
export default class NetworkAttachmentDef extends SteveModel { export default class NetworkAttachmentDef extends SteveModel {
applyDefaults() { applyDefaults() {
@@ -42,7 +45,7 @@ export default class NetworkAttachmentDef extends SteveModel {
} }
get vlanId() { get vlanId() {
return this.vlanType === 'UntaggedNetwork' ? 'N/A' : this.parseConfig.vlan; return this.vlanType === UNTAGGED ? 'N/A' : this.parseConfig.vlan;
} }
get customValidationRules() { get customValidationRules() {
@@ -65,7 +68,7 @@ export default class NetworkAttachmentDef extends SteveModel {
const route = annotations[HCI.NETWORK_ROUTE]; const route = annotations[HCI.NETWORK_ROUTE];
let config = {}; let config = {};
if (this.vlanType === 'UntaggedNetwork') { if (this.vlanType === UNTAGGED) {
return 'N/A'; return 'N/A';
} }
@@ -103,10 +103,12 @@ export default class VirtVm extends HarvesterResource {
return [ return [
{ {
action: 'stopVM', action: 'stopVM',
altAction: 'altStopVM',
enabled: !!this.actions?.stop, enabled: !!this.actions?.stop,
icon: 'icon icon-close', icon: 'icon icon-close',
label: this.t('harvester.action.stop'), label: this.t('harvester.action.stop'),
bulkable: true bulkable: true,
bulkAction: 'stopVM',
}, },
{ {
action: 'forceStop', action: 'forceStop',
@@ -117,6 +119,7 @@ export default class VirtVm extends HarvesterResource {
}, },
{ {
action: 'pauseVM', action: 'pauseVM',
altAction: 'altPauseVM',
enabled: !!this.actions?.pause, enabled: !!this.actions?.pause,
icon: 'icon icon-pause', icon: 'icon icon-pause',
label: this.t('harvester.action.pause') label: this.t('harvester.action.pause')
@@ -155,7 +158,7 @@ export default class VirtVm extends HarvesterResource {
}, },
{ {
action: 'takeVMSnapshot', action: 'takeVMSnapshot',
enabled: !!this.actions?.backup && !this.longhornV2Volumes.length, enabled: (!!this.actions?.snapshot || !!this.action?.backup) && !this.longhornV2Volumes.length,
icon: 'icon icon-snapshot', icon: 'icon icon-snapshot',
label: this.t('harvester.action.vmSnapshot') label: this.t('harvester.action.vmSnapshot')
}, },
@@ -402,7 +405,16 @@ export default class VirtVm extends HarvesterResource {
return node?.id; return node?.id;
} }
pauseVM() { pauseVM(resources = this) {
this.$dispatch('promptModal', {
resources,
action: 'pause',
warningMessageKey: 'dialog.confirmExecution.pause.message',
component: 'ConfirmExecutionDialog'
});
}
altPauseVM() {
this.doActionGrowl('pause', {}); this.doActionGrowl('pause', {});
} }
@@ -417,7 +429,16 @@ export default class VirtVm extends HarvesterResource {
this.doActionGrowl('unpause', {}); this.doActionGrowl('unpause', {});
} }
stopVM() { stopVM(resources = this) {
this.$dispatch('promptModal', {
resources,
action: 'stop',
warningMessageKey: 'dialog.confirmExecution.stop.message',
component: 'ConfirmExecutionDialog'
});
}
altStopVM() {
this.doActionGrowl('stop', {}); this.doActionGrowl('stop', {});
} }
@@ -619,6 +640,10 @@ export default class VirtVm extends HarvesterResource {
} }
get encryptedVolumeType() { get encryptedVolumeType() {
if (!this.volumes || this.volumes.length === 0) {
return 'none';
}
if (this.volumes.every((vol) => vol.isEncrypted)) { if (this.volumes.every((vol) => vol.isEncrypted)) {
return 'all'; return 'all';
} else if (this.volumes.some((vol) => vol.isEncrypted)) { } else if (this.volumes.some((vol) => vol.isEncrypted)) {
@@ -675,8 +700,25 @@ export default class VirtVm extends HarvesterResource {
return null; return null;
} }
get isBeingStopped() { get isPending() {
if (this && !this.isVMExpectedRunning && this.isVMCreated && this.vmi?.status?.phase !== VMIPhase.Succeeded) { if (this &&
!this.isVMExpectedRunning &&
this.isVMCreated &&
this.vmi?.status?.phase === VMIPhase.Pending
) {
return { status: VMIPhase.Pending };
}
return null;
}
get isStopping() {
if (this &&
!this.isVMExpectedRunning &&
this.isVMCreated &&
this.vmi?.status?.phase !== VMIPhase.Succeeded &&
this.vmi?.status?.phase !== VMIPhase.Pending
) {
return { status: STOPPING }; return { status: STOPPING };
} }
@@ -711,7 +753,7 @@ export default class VirtVm extends HarvesterResource {
} }
get isUnschedulable() { get isUnschedulable() {
if (this.isBeingStopped || this.isStarting) { if (this.isStopping || this.isStarting) {
const condition = this.status?.conditions?.find((c) => c.reason === UNSCHEDULABLE); const condition = this.status?.conditions?.find((c) => c.reason === UNSCHEDULABLE);
if (!!condition) { if (!!condition) {
@@ -827,7 +869,8 @@ export default class VirtVm extends HarvesterResource {
this.isUnschedulable?.status || this.isUnschedulable?.status ||
this.isPaused?.status || this.isPaused?.status ||
this.isVMError?.status || this.isVMError?.status ||
this.isBeingStopped?.status || this.isPending?.status ||
this.isStopping?.status ||
this.isOff?.status || this.isOff?.status ||
this.isError?.status || this.isError?.status ||
this.isRunning?.status || this.isRunning?.status ||
@@ -1120,10 +1163,6 @@ export default class VirtVm extends HarvesterResource {
return qemu?.status === 'True'; return qemu?.status === 'True';
} }
get warnDeletionMessage() {
return this.t('harvester.virtualMachine.promptRemove.tips');
}
get instanceLabels() { get instanceLabels() {
const all = this.spec?.template?.metadata?.labels || {}; const all = this.spec?.template?.metadata?.labels || {};
@@ -1154,6 +1193,18 @@ export default class VirtVm extends HarvesterResource {
return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption'); return this.$rootGetters['harvester-common/getFeatureEnabled']('volumeEncryption');
} }
get tpmPersistentStateFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('tpmPersistentState');
}
get efiPersistentStateFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('efiPersistentState');
}
get thirdPartyStorageFeatureEnabled() {
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
}
setInstanceLabels(val) { setInstanceLabels(val) {
if ( !this.spec?.template?.metadata?.labels ) { if ( !this.spec?.template?.metadata?.labels ) {
set(this, 'spec.template.metadata.labels', {}); set(this, 'spec.template.metadata.labels', {});
+2 -2
View File
@@ -1,13 +1,13 @@
{ {
"name": "harvester", "name": "harvester",
"description": "Rancher UI Extension for Harvester", "description": "Rancher UI Extension for Harvester",
"version": "1.0.2", "version": "1.5.0-rc4",
"private": false, "private": false,
"rancher": { "rancher": {
"annotations": { "annotations": {
"catalog.cattle.io/display-name": "Harvester", "catalog.cattle.io/display-name": "Harvester",
"catalog.cattle.io/kube-version": ">= 1.16.0-0", "catalog.cattle.io/kube-version": ">= 1.16.0-0",
"catalog.cattle.io/rancher-version": ">= 2.10.1-0", "catalog.cattle.io/rancher-version": ">= 2.11.0-0",
"catalog.cattle.io/ui-extensions-version": ">= 3.0.0 < 4.0.0" "catalog.cattle.io/ui-extensions-version": ">= 3.0.0 < 4.0.0"
} }
}, },
@@ -164,7 +164,7 @@ export default {
<h1 class="mb-20"> <h1 class="mb-20">
{{ t('branding.label') }} {{ t('branding.label') }}
</h1> </h1>
<TypeDescription resource="branding" /> <TypeDescription resource="harvester" />
<div> <div>
<div class="row mb-20"> <div class="row mb-20">
<div class="col span-6"> <div class="col span-6">
@@ -180,7 +180,7 @@ export default {
{{ t('branding.logos.label') }} {{ t('branding.logos.label') }}
</h3> </h3>
<label class="text-label"> <label class="text-label">
{{ t('branding.logos.tip', {}, true) }} {{ t('harvester.branding.logos.tip', {}, true) }}
</label> </label>
<div class="row mt-10 mb-20"> <div class="row mt-10 mb-20">
<Checkbox <Checkbox
@@ -244,7 +244,7 @@ export default {
{{ t('branding.favicon.label') }} {{ t('branding.favicon.label') }}
</h3> </h3>
<label class="text-label"> <label class="text-label">
{{ t('branding.favicon.tip', {}, true) }} {{ t('harvester.branding.favicon.tip', {}, true) }}
</label> </label>
<div class="row mt-10 mb-20"> <div class="row mt-10 mb-20">
<Checkbox <Checkbox

Some files were not shown because too many files have changed in this diff Show More