Skip to content

Commit

Permalink
neonvm: drop generated default value in CRD (#1313)
Browse files Browse the repository at this point in the history
We use kubebuilder:default annotation for scaling mode fields, which
effiectively means we never allow it to be non set and that bypasses the
logic with --default-cpu-scaling-mode controller argument
  • Loading branch information
mikhail-sakhnov authored Mar 11, 2025
1 parent e024b88 commit ad51dab
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions neonvm-controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
- "--concurrency-limit=128"
- "--skip-update-validation-for="
- "--disable-runner-cgroup"
- "--default-cpu-scaling-mode=QmpScaling"
# See #775 and its links.
# * cache.writeback=on - don't set O_DSYNC (don't flush every write)
# * cache.direct=on - use O_DIRECT (don't abuse host's page cache!)
Expand Down
3 changes: 1 addition & 2 deletions neonvm/apis/neonvm/v1/virtualmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ type VirtualMachineSpec struct {
TargetRevision *RevisionWithTime `json:"targetRevision,omitempty"`

// Controls how CPU scaling is performed, either hotplug new CPUs with QMP, or enable them in sysfs.
// +kubebuilder:default:=QmpScaling
// +optional
CpuScalingMode *CpuScalingMode `json:"cpuScalingMode,omitempty"`

Expand Down Expand Up @@ -243,7 +242,7 @@ func (p *CpuScalingMode) FlagFunc(value string) error {
string(CpuScalingModeSysfs),
}

if !slices.Contains(possibleValues, value) {
if !slices.Contains(possibleValues, value) || value == "" {
return fmt.Errorf("Unknown CpuScalingMode %q, must be one of %v", value, possibleValues)
}

Expand Down
1 change: 0 additions & 1 deletion neonvm/config/crd/bases/vm.neon.tech_virtualmachines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,6 @@ spec:
type: object
type: object
cpuScalingMode:
default: QmpScaling
description: Controls how CPU scaling is performed, either hotplug
new CPUs with QMP, or enable them in sysfs.
enum:
Expand Down

0 comments on commit ad51dab

Please sign in to comment.