✨ vmop-3743: Add VirtualMachineConfigOptions controller and webhook#1672
Open
faisalabujabal wants to merge 2 commits into
Open
✨ vmop-3743: Add VirtualMachineConfigOptions controller and webhook#1672faisalabujabal wants to merge 2 commits into
faisalabujabal wants to merge 2 commits into
Conversation
Implement Story S6 (vmop-3743) from the class-policy-resize spec
(001-class-policy-resize). This PR delivers a vertical slice:
validation webhook, controller, environment-browser helper, unit
tests, and a pending E2E skeleton.
Changes:
- controllers/virtualmachineconfigoptions: new Reconciler that
resolves the owning ConfigTarget, calls QueryConfigOptionEx via
the provider, maps the result into status, and fans out
VirtualMachineGuestOptions child objects; includes finalizer
management, Ready condition, and observedGeneration tracking
- webhooks/virtualmachineconfigoptions/validation: immutable
spec.hardwareVersion and ^vmx-\d+ format enforcement
- pkg/providers/vsphere/environment_browser.go: govmomi wrapper
for QueryConfigOptionEx using the cluster EnvironmentBrowser
- pkg/providers/{vm_provider_interface,fake,vsphere/vmprovider}:
extend interface with QueryConfigOptionEx and wire the vSphere
implementation
- controllers/controllers.go, webhooks/webhooks.go: register new
controller and webhook under VirtualMachineConfigPolicy gate
- config/rbac/role.yaml: regenerated from +kubebuilder:rbac markers
- test/e2e/vmservice/configpolicy: pending E2E skeleton (full
pipeline not yet deployed)
- test/builder/fake.go: register vimv1 types in test scheme
The VirtualMachineConfigOptions validation webhook and its registration in webhooks/webhooks.go are covered by PR vmop-3762 (vmop-3762-vm-config-options-webhook). Remove the duplicate files to keep this PR scoped to the controller only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do, and why is it needed?
Implements Story S6 (vmop-3743) from the 001-class-policy-resize spec: the
VirtualMachineConfigOptionscontroller and its admission webhook. This is a self-contained vertical slice (product code + unit tests + pending E2E skeleton) for the ConfigTarget → VirtualMachineConfigOptions pipeline stage.Controller (
controllers/virtualmachineconfigoptions/):VirtualMachineConfigOptionsobjectsConfigTargetvia owner references to obtain the cluster MoIDQueryConfigOptionExon the vSphere provider to retrieve hardware version capabilities from the cluster'sEnvironmentBrowserstatus(description, guest OS identifiers, default index, hardware options, etc.)VirtualMachineGuestOptionschild object per guest OS descriptor, upserting the per-hardware-version status entrystatus.observedGenerationand sets aReadycondition; requeues withRequeueAfter: 10swhen no ConfigTarget owner is found yetValidation webhook (
webhooks/virtualmachineconfigoptions/validation/):spec.hardwareVersionmatches^vmx-\d+$on createspec.hardwareVersionimmutable on updatevSphere provider plumbing (
pkg/providers/vsphere/environment_browser.go):EnvironmentBrowser.QueryConfigOptionusing aClusterComputeResourceproperty fetch to resolve the browser referenceRBAC:
+kubebuilder:rbacmarkers in the controller;config/rbac/role.yamlregenerated viamake generate-manifests.Test coverage: 5 controller unit tests (72.7% coverage), 10 webhook unit tests (73.7% coverage). E2E tests are marked
Pendingintest/e2e/vmservice/configpolicy/— full pipeline (Zone → ConfigTarget → VirtualMachineConfigOptions) is not yet running on a real cluster.Which issue(s) is/are addressed by this PR?
Fixes #
Are there any special notes for your reviewer:
Pending— they require the ConfigTarget controller (S4/vmop-3740) to be merged first so the pipeline has objects to drive the test.test/builder/fake.gochange registersvimv1types (ConfigTarget,VirtualMachineConfigOptions,VirtualMachineGuestOptions) into the unit-test scheme, which is needed for the controller's fake-client unit tests.make generate-manifestsfails locally because thehack/toolsmodule requires Go 1.26.4 but the runner has 1.26.2; the existingcontroller-genfrom~/go/binwas used instead (same versionv0.19.0).Please add a release note if necessary: