Skip to content

Commit 8a7efbf

Browse files
Merge pull request #2223 from djoshy/add-opt-out
MCO-1590: Add explicit opt-out & status field for boot image update configuration
2 parents 14a17c7 + 378e9d7 commit 8a7efbf

File tree

8 files changed

+430
-16
lines changed

8 files changed

+430
-16
lines changed

openapi/generated_openapi/zz_generated.openapi.go

+10-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/openapi.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -30161,7 +30161,7 @@
3016130161
"type": "string"
3016230162
},
3016330163
"managedBootImages": {
30164-
"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.",
30164+
"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.",
3016530165
"default": {},
3016630166
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ManagedBootImages"
3016730167
},
@@ -30211,6 +30211,11 @@
3021130211
"x-kubernetes-patch-merge-key": "type",
3021230212
"x-kubernetes-patch-strategy": "merge"
3021330213
},
30214+
"managedBootImagesStatus": {
30215+
"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.",
30216+
"default": {},
30217+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ManagedBootImages"
30218+
},
3021430219
"nodeDisruptionPolicyStatus": {
3021530220
"description": "nodeDisruptionPolicyStatus status reflects what the latest cluster-validated policies are, and will be used by the Machine Config Daemon during future node updates.",
3021630221
"default": {},
@@ -30256,7 +30261,7 @@
3025630261
],
3025730262
"properties": {
3025830263
"mode": {
30259-
"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.",
30264+
"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.",
3026030265
"type": "string",
3026130266
"default": ""
3026230267
},

operator/v1/types_machineconfiguration.go

+16-3
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ type MachineConfigurationSpec struct {
4141
// managedBootImages allows configuration for the management of boot images for machine
4242
// resources within the cluster. This configuration allows users to select resources that should
4343
// be updated to the latest boot images during cluster upgrades, ensuring that new machines
44-
// always boot with the current cluster version's boot image. When omitted, no boot images
45-
// will be updated.
44+
// always boot with the current cluster version's boot image. When omitted, this means no opinion
45+
// and the platform is left to choose a reasonable default, which is subject to change over time.
46+
// The default for each machine manager mode is All for GCP and AWS platforms, and None for all
47+
// other platforms.
4648
// +openshift:enable:FeatureGate=ManagedBootImages
4749
// +optional
4850
ManagedBootImages ManagedBootImages `json:"managedBootImages"`
@@ -96,6 +98,12 @@ type MachineConfigurationStatus struct {
9698
// +openshift:enable:FeatureGate=NodeDisruptionPolicy
9799
// +optional
98100
NodeDisruptionPolicyStatus NodeDisruptionPolicyStatus `json:"nodeDisruptionPolicyStatus"`
101+
102+
// managedBootImagesStatus reflects what the latest cluster-validated boot image configuration is
103+
// and will be used by Machine Config Controller while performing boot image updates.
104+
// +openshift:enable:FeatureGate=ManagedBootImages
105+
// +optional
106+
ManagedBootImagesStatus ManagedBootImages `json:"managedBootImagesStatus"`
99107
}
100108

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

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

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

176186
const (
@@ -180,6 +190,9 @@ const (
180190
// Partial represents a configuration mode that will register resources specified by the parent MachineManager only
181191
// if they match with the label selector.
182192
Partial MachineManagerSelectorMode = "Partial"
193+
194+
// None represents a configuration mode that excludes all resources specified by the parent MachineManager from boot image updates.
195+
None MachineManagerSelectorMode = "None"
183196
)
184197

185198
// MachineManagerManagedResourceType is a string enum used in the MachineManager type to describe the resource

operator/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigurations.crd.yaml

+131-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ spec:
7777
managedBootImages allows configuration for the management of boot images for machine
7878
resources within the cluster. This configuration allows users to select resources that should
7979
be updated to the latest boot images during cluster upgrades, ensuring that new machines
80-
always boot with the current cluster version's boot image. When omitted, no boot images
81-
will be updated.
80+
always boot with the current cluster version's boot image. When omitted, this means no opinion
81+
and the platform is left to choose a reasonable default, which is subject to change over time.
82+
The default for each machine manager mode is All for GCP and AWS platforms, and None for all
83+
other platforms.
8284
properties:
8385
machineManagers:
8486
description: |-
@@ -116,9 +118,11 @@ spec:
116118
Valid values are All and Partial.
117119
All means that every resource matched by the machine manager will be updated.
118120
Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.
121+
None means that every resource matched by the machine manager will not be updated.
119122
enum:
120123
- All
121124
- Partial
125+
- None
122126
type: string
123127
partial:
124128
description: |-
@@ -190,6 +194,7 @@ spec:
190194
- resource
191195
- selection
192196
type: object
197+
maxItems: 5
193198
type: array
194199
x-kubernetes-list-map-keys:
195200
- resource
@@ -703,6 +708,130 @@ spec:
703708
x-kubernetes-list-map-keys:
704709
- type
705710
x-kubernetes-list-type: map
711+
managedBootImagesStatus:
712+
description: |-
713+
managedBootImagesStatus reflects what the latest cluster-validated boot image configuration is
714+
and will be used by Machine Config Controller while performing boot image updates.
715+
properties:
716+
machineManagers:
717+
description: |-
718+
machineManagers can be used to register machine management resources for boot image updates. The Machine Config Operator
719+
will watch for changes to this list. Only one entry is permitted per type of machine management resource.
720+
items:
721+
description: |-
722+
MachineManager describes a target machine resource that is registered for boot image updates. It stores identifying information
723+
such as the resource type and the API Group of the resource. It also provides granular control via the selection field.
724+
properties:
725+
apiGroup:
726+
description: |-
727+
apiGroup is name of the APIGroup that the machine management resource belongs to.
728+
The only current valid value is machine.openshift.io.
729+
machine.openshift.io means that the machine manager will only register resources that belong to OpenShift machine API group.
730+
enum:
731+
- machine.openshift.io
732+
type: string
733+
resource:
734+
description: |-
735+
resource is the machine management resource's type.
736+
The only current valid value is machinesets.
737+
machinesets means that the machine manager will only register resources of the kind MachineSet.
738+
enum:
739+
- machinesets
740+
type: string
741+
selection:
742+
description: selection allows granular control of the machine
743+
management resources that will be registered for boot
744+
image updates.
745+
properties:
746+
mode:
747+
description: |-
748+
mode determines how machine managers will be selected for updates.
749+
Valid values are All and Partial.
750+
All means that every resource matched by the machine manager will be updated.
751+
Partial requires specified selector(s) and allows customisation of which resources matched by the machine manager will be updated.
752+
None means that every resource matched by the machine manager will not be updated.
753+
enum:
754+
- All
755+
- Partial
756+
- None
757+
type: string
758+
partial:
759+
description: |-
760+
partial provides label selector(s) that can be used to match machine management resources.
761+
Only permitted when mode is set to "Partial".
762+
properties:
763+
machineResourceSelector:
764+
description: machineResourceSelector is a label
765+
selector that can be used to select machine resources
766+
like MachineSets.
767+
properties:
768+
matchExpressions:
769+
description: matchExpressions is a list of label
770+
selector requirements. The requirements are
771+
ANDed.
772+
items:
773+
description: |-
774+
A label selector requirement is a selector that contains values, a key, and an operator that
775+
relates the key and values.
776+
properties:
777+
key:
778+
description: key is the label key that
779+
the selector applies to.
780+
type: string
781+
operator:
782+
description: |-
783+
operator represents a key's relationship to a set of values.
784+
Valid operators are In, NotIn, Exists and DoesNotExist.
785+
type: string
786+
values:
787+
description: |-
788+
values is an array of string values. If the operator is In or NotIn,
789+
the values array must be non-empty. If the operator is Exists or DoesNotExist,
790+
the values array must be empty. This array is replaced during a strategic
791+
merge patch.
792+
items:
793+
type: string
794+
type: array
795+
x-kubernetes-list-type: atomic
796+
required:
797+
- key
798+
- operator
799+
type: object
800+
type: array
801+
x-kubernetes-list-type: atomic
802+
matchLabels:
803+
additionalProperties:
804+
type: string
805+
description: |-
806+
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
807+
map is equivalent to an element of matchExpressions, whose key field is "key", the
808+
operator is "In", and the values array contains only "value". The requirements are ANDed.
809+
type: object
810+
type: object
811+
x-kubernetes-map-type: atomic
812+
required:
813+
- machineResourceSelector
814+
type: object
815+
required:
816+
- mode
817+
type: object
818+
x-kubernetes-validations:
819+
- message: Partial is required when type is partial, and
820+
forbidden otherwise
821+
rule: 'has(self.mode) && self.mode == ''Partial'' ? has(self.partial)
822+
: !has(self.partial)'
823+
required:
824+
- apiGroup
825+
- resource
826+
- selection
827+
type: object
828+
maxItems: 5
829+
type: array
830+
x-kubernetes-list-map-keys:
831+
- resource
832+
- apiGroup
833+
x-kubernetes-list-type: map
834+
type: object
706835
nodeDisruptionPolicyStatus:
707836
description: |-
708837
nodeDisruptionPolicyStatus status reflects what the latest cluster-validated policies are,

operator/v1/zz_generated.deepcopy.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)