From 592f916346c9987c2b613a34196c3ad78dc44cae Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Mon, 8 Apr 2024 20:05:29 +0300 Subject: [PATCH] feat: don't allow downgrades of the machines when adding to a cluster Make `MachineClass` selector skip them. Disable them in the UI. Do not allow adding them as the resources, validate on the backend level. Fixes: https://github.com/siderolabs/omni/issues/46 Signed-off-by: Artem Chernyshev --- frontend/package.json | 2 +- frontend/src/views/cluster/Config/Patches.vue | 5 +- .../Clusters/Management/ClusterCreate.vue | 10 +- .../Management/ClusterMachineItem.vue | 109 +++++++++++------- .../omni/controllers/omni/machine_set_node.go | 39 ++++++- .../controllers/omni/machine_set_node_test.go | 9 +- .../backend/runtime/omni/state_validation.go | 53 ++++++++- 7 files changed, 179 insertions(+), 48 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 0a0a35cd..ab283358 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -66,8 +66,8 @@ "postcss": "^8.4.14", "tailwindcss": "^3.1.4", "ts-jest": "^27.1.5", - "ts-loader": "^9.3.1", "typescript": "^4.7.4", + "ts-loader": "^9.3.1", "vue-cli-plugin-tailwind": "^3.0.0" } } diff --git a/frontend/src/views/cluster/Config/Patches.vue b/frontend/src/views/cluster/Config/Patches.vue index d3de5e3a..02985894 100644 --- a/frontend/src/views/cluster/Config/Patches.vue +++ b/frontend/src/views/cluster/Config/Patches.vue @@ -109,10 +109,7 @@ type Props = { currentCluster?: ResourceTyped, }; -const props = defineProps(); - - console.log("PATCHES currentCluster", props.currentCluster); - +defineProps(); const updateSelectors = () => { patchListSelectors.value = [`!${LabelSystemPatch}`]; diff --git a/frontend/src/views/omni/Clusters/Management/ClusterCreate.vue b/frontend/src/views/omni/Clusters/Management/ClusterCreate.vue index 6e7052fe..18e7c0b2 100644 --- a/frontend/src/views/omni/Clusters/Management/ClusterCreate.vue +++ b/frontend/src/views/omni/Clusters/Management/ClusterCreate.vue @@ -98,6 +98,7 @@ included in the LICENSE file.