Skip to content

Commit ff03233

Browse files
committed
fix: remove machine set allocation source option
This option is redundant. It was inteded for MCP, but the MCP implementation will not be using it, so we should stop dragging it along anymore. This change was extracted from siderolabs#723 Signed-off-by: Artem Chernyshev <[email protected]>
1 parent e7ece82 commit ff03233

File tree

15 files changed

+270
-456
lines changed

15 files changed

+270
-456
lines changed

client/api/omni/specs/omni.pb.go

Lines changed: 236 additions & 299 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/api/omni/specs/omni.proto

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -710,22 +710,13 @@ message MachineSetSpec {
710710
Unlimited = 1;
711711
}
712712

713-
enum Source {
714-
// MachineClass allocates the machines from a machine class.
715-
MachineClass = 0;
716-
// MachineRequestSet allocates the machines from a machine request set.
717-
MachineRequestSet = 1;
718-
}
719-
720713
// Name defines the machine class/machine request set id to select the machines from.
721714
string name = 1;
722715
// MachineCount defines fixed amount of the machines to allocated from the machine class/request set.
723716
uint32 machine_count = 2;
724717
// AllocationType defines special constants for the amount of machines to be allocated.
725718
Type allocation_type = 3;
726-
// Source defines the source where to get the machines from.
727-
// It can be either a machine class or a machine request set.
728-
Source source = 4;
719+
reserved 4;
729720
}
730721

731722
// BootstrapSpec defines the bootstrap spec for the control plane machine set.

client/api/omni/specs/omni_vtproto.pb.go

Lines changed: 0 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/pkg/template/internal/models/machineset.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ func (machineset *MachineSet) translate(ctx TranslateContext, nameSuffix, roleLa
218218
Name: machineset.MachineClass.Name,
219219
MachineCount: machineset.MachineClass.Size.Value,
220220
AllocationType: machineset.MachineClass.Size.AllocationType,
221-
Source: specs.MachineSetSpec_MachineAllocation_MachineClass,
222221
}
223222
} else {
224223
for _, machineID := range machineset.Machines {

client/pkg/template/operations/export.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,6 @@ func transformMachineSetToModel(machineSet *omni.MachineSet, nodes []*omni.Machi
246246
AllocationType: allocationConfig.GetAllocationType(),
247247
},
248248
}
249-
250-
// TODO: for MCP we'll have a special flag defined, should support machine request set allocation mode export after we implement it
251-
if allocationConfig.Source != specs.MachineSetSpec_MachineAllocation_MachineClass {
252-
return models.MachineSet{}, fmt.Errorf("unsupported machine allocation source in the machine set %s", machineSet.Metadata().ID())
253-
}
254249
} else {
255250
machineIDs = xslices.Map(nodes, func(node *omni.MachineSetNode) models.MachineID {
256251
return models.MachineID(node.Metadata().ID())

client/pkg/template/operations/testdata/export/cluster-resources.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ spec:
115115
name: mc1
116116
machinecount: 0
117117
allocationtype: 1
118-
source: 0
119118
bootstrapspec: null
120119
---
121120

@@ -143,7 +142,6 @@ spec:
143142
name: mc2
144143
machinecount: 1
145144
allocationtype: 0
146-
source: 0
147145
bootstrapspec: null
148146
---
149147

client/pkg/template/testdata/cluster3-resources.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ spec:
278278
name: test
279279
machinecount: 1
280280
allocationtype: 0
281-
source: 0
282281
---
283282
metadata:
284283
namespace: default
@@ -303,4 +302,3 @@ spec:
303302
name: test
304303
machinecount: 0
305304
allocationtype: 1
306-
source: 0

frontend/src/api/omni/specs/omni.pb.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ export enum MachineSetSpecMachineAllocationType {
104104
Unlimited = 1,
105105
}
106106

107-
export enum MachineSetSpecMachineAllocationSource {
108-
MachineClass = 0,
109-
MachineRequestSet = 1,
110-
}
111-
112107
export enum TalosUpgradeStatusSpecPhase {
113108
Unknown = 0,
114109
Upgrading = 1,
@@ -525,7 +520,6 @@ export type MachineSetSpecMachineAllocation = {
525520
name?: string
526521
machine_count?: number
527522
allocation_type?: MachineSetSpecMachineAllocationType
528-
source?: MachineSetSpecMachineAllocationSource
529523
}
530524

531525
export type MachineSetSpecBootstrapSpec = {

frontend/src/states/cluster-management/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
MachineSetNodeSpec,
1515
MachineSetSpec,
1616
MachineSetSpecBootstrapSpec,
17-
MachineSetSpecMachineAllocationSource,
1817
MachineSetSpecMachineAllocationType,
1918
MachineSetSpecUpdateStrategy,
2019
MachineSetSpecUpdateStrategyConfig
@@ -92,7 +91,6 @@ export interface MachineSet {
9291
machineAllocation?: {
9392
name: string
9493
size: number | "unlimited"
95-
source: MachineSetSpecMachineAllocationSource
9694
}
9795
machines: Record<string, MachineSetNode>
9896
patches: Record<string, ConfigPatch>
@@ -398,7 +396,6 @@ export class State {
398396
if (machineSet.machineAllocation) {
399397
ms.spec.machine_allocation = {
400398
name: machineSet.machineAllocation.name,
401-
source: machineSet.machineAllocation.source,
402399
}
403400

404401
switch (machineSet.machineAllocation.size) {
@@ -562,7 +559,7 @@ export class State {
562559

563560
if (ms.machineAllocation) {
564561
if (ms.machineAllocation.size === "unlimited") {
565-
return `All From ${ms.machineAllocation.source === MachineSetSpecMachineAllocationSource.MachineClass ? 'Class' : 'Request Set'} "${ms.machineAllocation.name}"`;
562+
return `All From Class "${ms.machineAllocation.name}"`;
566563
}
567564

568565
count += ms.machineAllocation.size as number;
@@ -701,7 +698,6 @@ export const populateExisting = async (clusterName: string) => {
701698
machineSet.machineAllocation = {
702699
name: allocationCfg.name!,
703700
size: allocationCfg.allocation_type === MachineSetSpecMachineAllocationType.Unlimited ? "unlimited" : allocationCfg.machine_count ?? 0,
704-
source: allocationCfg.source ?? MachineSetSpecMachineAllocationSource.MachineClass,
705701
}
706702
}
707703

frontend/src/views/omni/Clusters/Management/MachineSetConfig.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import IconButton from "@/components/common/Button/IconButton.vue";
6464
import pluralize from "pluralize";
6565
import { LabelWorkerRole, PatchBaseWeightMachineSet } from "@/api/resources";
6666
import MachineSetConfigEdit from "../../Modals/MachineSetConfigEdit.vue";
67-
import { MachineSetSpecMachineAllocationSource, MachineClassSpec } from "@/api/omni/specs/omni.pb";
67+
import { MachineClassSpec } from "@/api/omni/specs/omni.pb";
6868
6969
const emit = defineEmits(["update:modelValue"]);
7070
@@ -140,7 +140,6 @@ watch([sourceName, machineCount, useMachineClasses, patches, allMachines], () =>
140140
const mc = useMachineClasses.value && sourceName.value !== undefined ? {
141141
name: sourceName.value,
142142
size: allMachines.value ? 'unlimited' : machineCount.value,
143-
source: MachineSetSpecMachineAllocationSource.MachineClass,
144143
} : undefined;
145144
146145
const machineSet: MachineSet = {

0 commit comments

Comments
 (0)