Skip to content

Commit

Permalink
vmi-create-admitter: Remove CPUManagerPolicyBetaOptions check
Browse files Browse the repository at this point in the history
Currently the VMI is blocked if the
`kubevirt.io/CPUManagerPolicyBetaOptions` annotation set on the VMI and
the
CPUManagerPolicyBetaOptions feature-gate is not enabled.
Removing this logic from the webhook in order to align with the design
proposal [0]
The meaning of this change is that if the annotation is set on the VMI
manually - then the CPUManagerPolicyBetaOptions:full-pcpu-only behavior
will take place in spite of the feature gate being disabled.

[0] kubevirt/community#247

Signed-off-by: Ram Lavi <ralavi@redhat.com>
  • Loading branch information
RamLavi committed Dec 17, 2023
1 parent 7c30888 commit abc8a8b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1717,15 +1717,6 @@ func ValidateVirtualMachineInstanceMetadata(field *k8sfield.Path, metadata *meta
}
}

if _, exists := annotations[v1.CPUManagerPolicyBetaOptionsAnnotation]; exists && !config.CPUManagerPolicyBetaOptionsEnabled() {
causes = append(causes, metav1.StatusCause{
Type: metav1.CauseTypeFieldValueInvalid,
Message: fmt.Sprintf("CPUManagerPolicyBetaOptions feature gate is not enabled in kubevirt-config, invalid entry %s",
field.Child("annotations").Child(v1.CPUManagerPolicyBetaOptionsAnnotation).String()),
Field: field.Child("annotations").String(),
})
}

return causes
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,6 @@ var _ = Describe("Validating VMICreate Admitter", func() {
map[string]string{hooks.HookSidecarListAnnotationName: "[{'image': 'fake-image'}]"},
fmt.Sprintf("invalid entry metadata.annotations.%s", hooks.HookSidecarListAnnotationName),
),
Entry("without CPUManagerPolicyBetaOptions feature gate enabled",
map[string]string{v1.CPUManagerPolicyBetaOptionsAnnotation: string(v1.CPUManagerPolicyBetaOptionFullpCPUsOnly)},
fmt.Sprintf("invalid entry metadata.annotations.%s", v1.CPUManagerPolicyBetaOptionsAnnotation),
),
)

DescribeTable("should accept annotations which require feature gate enabled", func(annotations map[string]string, featureGate string) {
Expand All @@ -503,10 +499,6 @@ var _ = Describe("Validating VMICreate Admitter", func() {
map[string]string{hooks.HookSidecarListAnnotationName: "[{'image': 'fake-image'}]"},
virtconfig.SidecarGate,
),
Entry("with CPUManagerPolicyBetaOptions feature gate enabled",
map[string]string{v1.CPUManagerPolicyBetaOptionsAnnotation: string(v1.CPUManagerPolicyBetaOptionFullpCPUsOnly)},
virtconfig.CPUManagerPolicyBetaOptionsGate,
),
)
})

Expand Down

0 comments on commit abc8a8b

Please sign in to comment.