-
Notifications
You must be signed in to change notification settings - Fork 844
MCO-2332: MCO-2333: Introduce CAPI resource types to boot image update API #2990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
djoshy
wants to merge
3
commits into
openshift:master
Choose a base branch
from
djoshy:add-capi-aws-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
212 changes: 212 additions & 0 deletions
212
operator/v1/tests/machineconfigurations.operator.openshift.io/ManagedBootImagesAWSCAPI.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,212 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
| name: "MachineConfiguration" | ||
| crdName: machineconfigurations.operator.openshift.io | ||
| featureGates: | ||
| - ManagedBootImagesAWSCAPI | ||
| tests: | ||
| onCreate: | ||
| - name: Should be able to create a minimal MachineConfiguration | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: {} # No spec is required for a MachineConfiguration | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| logLevel: Normal | ||
| operatorLogLevel: Normal | ||
| - name: Should be able to create a ManagedBootImages configuration knob that opts in all CAPI MachineSets | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| logLevel: Normal | ||
| operatorLogLevel: Normal | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - name: Should be able to create a ManagedBootImages configuration knob that opts in CAPI MachineSets in partial mode | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: Partial | ||
| partial: | ||
| machineResourceSelector: | ||
| matchLabels: {} | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| logLevel: Normal | ||
| operatorLogLevel: Normal | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: Partial | ||
| partial: | ||
| machineResourceSelector: | ||
| matchLabels: {} | ||
| - name: Should be able to create a ManagedBootImages configuration knob that opts in all CAPI MachineDeployments | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| logLevel: Normal | ||
| operatorLogLevel: Normal | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - name: Should be able to create a ManagedBootImages configuration knob that opts in CAPI MachineDeployments in partial mode | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: Partial | ||
| partial: | ||
| machineResourceSelector: | ||
| matchLabels: {} | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| logLevel: Normal | ||
| operatorLogLevel: Normal | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: Partial | ||
| partial: | ||
| machineResourceSelector: | ||
| matchLabels: {} | ||
| - name: Should be able to mix MAPI MachineSets and CAPI MachineSets in machineManagers | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: machine.openshift.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| logLevel: Normal | ||
| operatorLogLevel: Normal | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: machine.openshift.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - name: Should be able to mix CAPI MachineSets and CAPI MachineDeployments in machineManagers | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| logLevel: Normal | ||
| operatorLogLevel: Normal | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - name: Should not permit machinedeployments with machine.openshift.io API group | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinedeployments | ||
| apiGroup: machine.openshift.io | ||
| selection: | ||
| mode: All | ||
| expectedError: "the machinedeployments resource is only supported in the cluster.x-k8s.io API group" | ||
| - name: Only one unique pair of resource/apiGroup is allowed in machineManagers | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: None | ||
| expectedError: "spec.managedBootImages.machineManagers[1]: Duplicate value: map[string]interface {}{\"apiGroup\":\"cluster.x-k8s.io\", \"resource\":\"machinesets\"}" |
98 changes: 98 additions & 0 deletions
98
...econfigurations.operator.openshift.io/ManagedBootImagesCPMS+ManagedBootImagesAWSCAPI.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
| name: "MachineConfiguration" | ||
| crdName: machineconfigurations.operator.openshift.io | ||
| featureGates: | ||
| - ManagedBootImagesCPMS | ||
| - ManagedBootImagesAWSCAPI | ||
| tests: | ||
| onCreate: | ||
| - name: Should be able to use all resource types when both feature gates are enabled | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: machine.openshift.io | ||
| selection: | ||
| mode: All | ||
| - resource: controlplanemachinesets | ||
| apiGroup: machine.openshift.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| logLevel: Normal | ||
| operatorLogLevel: Normal | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinesets | ||
| apiGroup: machine.openshift.io | ||
| selection: | ||
| mode: All | ||
| - resource: controlplanemachinesets | ||
| apiGroup: machine.openshift.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - name: Should not permit ControlPlaneMachineSets in Partial mode even when ManagedBootImagesAWSCAPI is also enabled | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: controlplanemachinesets | ||
| apiGroup: machine.openshift.io | ||
| selection: | ||
| mode: Partial | ||
| partial: | ||
| machineResourceSelector: | ||
| matchLabels: {} | ||
| expectedError: "Only All or None selection mode is permitted for ControlPlaneMachineSets" | ||
| - name: Should not permit controlplanemachinesets with cluster.x-k8s.io API group | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: controlplanemachinesets | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| expectedError: "the controlplanemachinesets resource is only supported in the machine.openshift.io API group" | ||
| - name: Only one unique pair of resource/apiGroup is allowed across all resource types | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: MachineConfiguration | ||
| spec: | ||
| managedBootImages: | ||
| machineManagers: | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: All | ||
| - resource: machinedeployments | ||
| apiGroup: cluster.x-k8s.io | ||
| selection: | ||
| mode: None | ||
| expectedError: "spec.managedBootImages.machineManagers[1]: Duplicate value: map[string]interface {}{\"apiGroup\":\"cluster.x-k8s.io\", \"resource\":\"machinedeployments\"}" |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Use
enableIn(...)for the new feature gates.FeatureGateManagedBootImagesAWSCAPI,FeatureGateIngressControllerLBSecurityGroupsAWS, andFeatureGateGomaxprocsInjectionuse.enable(...). Replace these calls with the required.enableIn(...)builder form. The upstream OpenShift API guidance uses this form for new feature-gate registrations. (github.com)As per coding guidelines, new FeatureGates in
features/features.gomust usenewFeatureGate(...).reportProblemsToJiraComponent(...).contactPerson(...).productScope(...).enableIn(...).mustRegister().Also applies to: 989-989, 1052-1052
🤖 Prompt for AI Agents
Source: Coding guidelines