Skip to content

MCO-1590: Add explicit opt-out & status field for boot image update configuration #2223

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

Merged
merged 2 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -30042,7 +30042,7 @@
"type": "string"
},
"managedBootImages": {
"description": "managedBootImages allows configuration for the management of boot images for machine resources within the cluster. This configuration allows users to select resources that should be updated to the latest boot images during cluster upgrades, ensuring that new machines always boot with the current cluster version's boot image. When omitted, no boot images will be updated.",
"description": "managedBootImages allows configuration for the management of boot images for machine resources within the cluster. This configuration allows users to select resources that should be updated to the latest boot images during cluster upgrades, ensuring that new machines always boot with the current cluster version's boot image. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default for each machine manager mode is All for GCP and AWS platforms, and None for all other platforms.",
"default": {},
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ManagedBootImages"
},
Expand Down Expand Up @@ -30092,6 +30092,11 @@
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"managedBootImagesStatus": {
"description": "managedBootImagesStatus reflects what the latest cluster-validated boot image configuration is and will be used by Machine Config Controller while performing boot image updates.",
"default": {},
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ManagedBootImages"
},
"nodeDisruptionPolicyStatus": {
"description": "nodeDisruptionPolicyStatus status reflects what the latest cluster-validated policies are, and will be used by the Machine Config Daemon during future node updates.",
"default": {},
Expand Down Expand Up @@ -30137,7 +30142,7 @@
],
"properties": {
"mode": {
"description": "mode determines how machine managers will be selected for updates. Valid values are All and Partial. All means that every resource matched by the machine manager will be updated. Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.",
"description": "mode determines how machine managers will be selected for updates. Valid values are All and Partial. All means that every resource matched by the machine manager will be updated. Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated. None means that every resource matched by the machine manager will not be updated.",
"type": "string",
"default": ""
},
Expand Down
19 changes: 16 additions & 3 deletions operator/v1/types_machineconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ type MachineConfigurationSpec struct {
// managedBootImages allows configuration for the management of boot images for machine
// resources within the cluster. This configuration allows users to select resources that should
// be updated to the latest boot images during cluster upgrades, ensuring that new machines
// always boot with the current cluster version's boot image. When omitted, no boot images
// will be updated.
// always boot with the current cluster version's boot image. When omitted, this means no opinion
// and the platform is left to choose a reasonable default, which is subject to change over time.
// The default for each machine manager mode is All for GCP and AWS platforms, and None for all
// other platforms.
// +openshift:enable:FeatureGate=ManagedBootImages
// +optional
ManagedBootImages ManagedBootImages `json:"managedBootImages"`
Expand Down Expand Up @@ -96,6 +98,12 @@ type MachineConfigurationStatus struct {
// +openshift:enable:FeatureGate=NodeDisruptionPolicy
// +optional
NodeDisruptionPolicyStatus NodeDisruptionPolicyStatus `json:"nodeDisruptionPolicyStatus"`

// managedBootImagesStatus reflects what the latest cluster-validated boot image configuration is
// and will be used by Machine Config Controller while performing boot image updates.
// +openshift:enable:FeatureGate=ManagedBootImages
// +optional
ManagedBootImagesStatus ManagedBootImages `json:"managedBootImagesStatus"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand All @@ -122,6 +130,7 @@ type ManagedBootImages struct {
// +listType=map
// +listMapKey=resource
// +listMapKey=apiGroup
// +kubebuilder:validation:MaxItems=5
MachineManagers []MachineManager `json:"machineManagers"`
}

Expand Down Expand Up @@ -152,6 +161,7 @@ type MachineManagerSelector struct {
// Valid values are All and Partial.
// All means that every resource matched by the machine manager will be updated.
// Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.
// None means that every resource matched by the machine manager will not be updated.
// +unionDiscriminator
// +required
Mode MachineManagerSelectorMode `json:"mode"`
Expand All @@ -170,7 +180,7 @@ type PartialSelector struct {
}

// MachineManagerSelectorMode is a string enum used in the MachineManagerSelector union discriminator.
// +kubebuilder:validation:Enum:="All";"Partial"
// +kubebuilder:validation:Enum:="All";"Partial";"None"
type MachineManagerSelectorMode string

const (
Expand All @@ -180,6 +190,9 @@ const (
// Partial represents a configuration mode that will register resources specified by the parent MachineManager only
// if they match with the label selector.
Partial MachineManagerSelectorMode = "Partial"

// None represents a configuration mode that excludes all resources specified by the parent MachineManager from boot image updates.
None MachineManagerSelectorMode = "None"
)

// MachineManagerManagedResourceType is a string enum used in the MachineManager type to describe the resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ spec:
managedBootImages allows configuration for the management of boot images for machine
resources within the cluster. This configuration allows users to select resources that should
be updated to the latest boot images during cluster upgrades, ensuring that new machines
always boot with the current cluster version's boot image. When omitted, no boot images
will be updated.
always boot with the current cluster version's boot image. When omitted, this means no opinion
and the platform is left to choose a reasonable default, which is subject to change over time.
The default for each machine manager mode is All for GCP and AWS platforms, and None for all
other platforms.
properties:
machineManagers:
description: |-
Expand Down Expand Up @@ -116,9 +118,11 @@ spec:
Valid values are All and Partial.
All means that every resource matched by the machine manager will be updated.
Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.
None means that every resource matched by the machine manager will not be updated.
enum:
- All
- Partial
- None
type: string
partial:
description: |-
Expand Down Expand Up @@ -190,6 +194,7 @@ spec:
- resource
- selection
type: object
maxItems: 5
type: array
x-kubernetes-list-map-keys:
- resource
Expand Down Expand Up @@ -703,6 +708,130 @@ spec:
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
managedBootImagesStatus:
description: |-
managedBootImagesStatus reflects what the latest cluster-validated boot image configuration is
and will be used by Machine Config Controller while performing boot image updates.
properties:
machineManagers:
description: |-
machineManagers can be used to register machine management resources for boot image updates. The Machine Config Operator
will watch for changes to this list. Only one entry is permitted per type of machine management resource.
items:
description: |-
MachineManager describes a target machine resource that is registered for boot image updates. It stores identifying information
such as the resource type and the API Group of the resource. It also provides granular control via the selection field.
properties:
apiGroup:
description: |-
apiGroup is name of the APIGroup that the machine management resource belongs to.
The only current valid value is machine.openshift.io.
machine.openshift.io means that the machine manager will only register resources that belong to OpenShift machine API group.
enum:
- machine.openshift.io
type: string
resource:
description: |-
resource is the machine management resource's type.
The only current valid value is machinesets.
machinesets means that the machine manager will only register resources of the kind MachineSet.
enum:
- machinesets
type: string
selection:
description: selection allows granular control of the machine
management resources that will be registered for boot
image updates.
properties:
mode:
description: |-
mode determines how machine managers will be selected for updates.
Valid values are All and Partial.
All means that every resource matched by the machine manager will be updated.
Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.
None means that every resource matched by the machine manager will not be updated.
enum:
- All
- Partial
- None
type: string
partial:
description: |-
partial provides label selector(s) that can be used to match machine management resources.
Only permitted when mode is set to "Partial".
properties:
machineResourceSelector:
description: machineResourceSelector is a label
selector that can be used to select machine resources
like MachineSets.
properties:
matchExpressions:
description: matchExpressions is a list of label
selector requirements. The requirements are
ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that
the selector applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
required:
- machineResourceSelector
type: object
required:
- mode
type: object
x-kubernetes-validations:
- message: Partial is required when type is partial, and
forbidden otherwise
rule: 'has(self.mode) && self.mode == ''Partial'' ? has(self.partial)
: !has(self.partial)'
required:
- apiGroup
- resource
- selection
type: object
maxItems: 5
type: array
x-kubernetes-list-map-keys:
- resource
- apiGroup
x-kubernetes-list-type: map
type: object
nodeDisruptionPolicyStatus:
description: |-
nodeDisruptionPolicyStatus status reflects what the latest cluster-validated policies are,
Expand Down
1 change: 1 addition & 0 deletions operator/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading