From 4db1a8c31703f2dd6ddab61209c4a8f535f4e770 Mon Sep 17 00:00:00 2001 From: Sam Batschelet Date: Wed, 3 Apr 2024 20:41:04 -0400 Subject: [PATCH] machineconfiguration/v1alpha1: add PinnedImageSet to MCN Signed-off-by: Sam Batschelet --- machineconfiguration/v1/types.go | 1 + ...achineconfigpools-CustomNoUpgrade.crd.yaml | 1 + ...econfigpools-TechPreviewNoUpgrade.crd.yaml | 1 + .../PinnedImages.yaml | 1 + .../MachineConfigNodes.yaml | 167 ++++++++++++++++++ .../v1alpha1/types_machineconfignode.go | 59 +++++++ ...achineconfignodes-CustomNoUpgrade.crd.yaml | 85 +++++++++ ...econfignodes-TechPreviewNoUpgrade.crd.yaml | 85 +++++++++ .../v1alpha1/zz_generated.deepcopy.go | 51 +++++- .../MachineConfigNodes.yaml | 85 +++++++++ .../zz_generated.swagger_doc_generated.go | 30 +++- .../generated_openapi/zz_generated.openapi.go | 128 +++++++++++++- openapi/openapi.json | 73 ++++++++ 13 files changed, 760 insertions(+), 7 deletions(-) diff --git a/machineconfiguration/v1/types.go b/machineconfiguration/v1/types.go index 5b1b196df6d..c04fbdfd4de 100644 --- a/machineconfiguration/v1/types.go +++ b/machineconfiguration/v1/types.go @@ -443,6 +443,7 @@ type MachineConfigPoolSpec struct { // +optional // +listType=map // +listMapKey=name + // +kubebuilder:validation:MaxItems=100 PinnedImageSets []PinnedImageSetRef `json:"pinnedImageSets,omitempty"` } diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigpools-CustomNoUpgrade.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigpools-CustomNoUpgrade.crd.yaml index f699010b427..7e4d18cb51d 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigpools-CustomNoUpgrade.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigpools-CustomNoUpgrade.crd.yaml @@ -335,6 +335,7 @@ spec: required: - name type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - name diff --git a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigpools-TechPreviewNoUpgrade.crd.yaml b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigpools-TechPreviewNoUpgrade.crd.yaml index eed209f697e..d87cb5a06d9 100644 --- a/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigpools-TechPreviewNoUpgrade.crd.yaml +++ b/machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigpools-TechPreviewNoUpgrade.crd.yaml @@ -335,6 +335,7 @@ spec: required: - name type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - name diff --git a/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineconfigpools.machineconfiguration.openshift.io/PinnedImages.yaml b/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineconfigpools.machineconfiguration.openshift.io/PinnedImages.yaml index 955a4550934..bed989ae9d3 100644 --- a/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineconfigpools.machineconfiguration.openshift.io/PinnedImages.yaml +++ b/machineconfiguration/v1/zz_generated.featuregated-crd-manifests/machineconfigpools.machineconfiguration.openshift.io/PinnedImages.yaml @@ -335,6 +335,7 @@ spec: required: - name type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - name diff --git a/machineconfiguration/v1alpha1/tests/machineconfignodes.machineconfiguration.openshift.io/MachineConfigNodes.yaml b/machineconfiguration/v1alpha1/tests/machineconfignodes.machineconfiguration.openshift.io/MachineConfigNodes.yaml index 5302b65f13e..58677367aa6 100644 --- a/machineconfiguration/v1alpha1/tests/machineconfignodes.machineconfiguration.openshift.io/MachineConfigNodes.yaml +++ b/machineconfiguration/v1alpha1/tests/machineconfignodes.machineconfiguration.openshift.io/MachineConfigNodes.yaml @@ -79,3 +79,170 @@ tests: node: name: foobar expectedError: "spec.configVersion: Required value, : Invalid value: \"null\"" + - name: Should be able to create a MachineConfigNode with a PinnedImageSet + initial: | + apiVersion: machineconfiguration.openshift.io/v1alpha1 + kind: MachineConfigNode + metadata: + name: foobar + spec: + node: + name: foobar + pool: + name: worker + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + expected: | + apiVersion: machineconfiguration.openshift.io/v1alpha1 + kind: MachineConfigNode + metadata: + name: foobar + spec: + node: + name: foobar + pool: + name: worker + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + onUpdate: + - name: PinnedImageSet desired generation must be greater than or equal to the current generation + initial: | + apiVersion: machineconfiguration.openshift.io/v1alpha1 + kind: MachineConfigNode + metadata: + name: foobar + spec: + node: + name: foobar + pool: + name: worker + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + status: + observedGeneration: 1 + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + currentGeneration: 1 + desiredGeneration: 1 + updated: | + apiVersion: machineconfiguration.openshift.io/v1alpha1 + kind: MachineConfigNode + metadata: + name: foobar + spec: + node: + name: foobar + pool: + name: worker + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + status: + observedGeneration: 1 + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + currentGeneration: 2 + desiredGeneration: 1 + expectedStatusError: "Invalid value: \"object\": desired generation must be greater than or equal to the current generation" + - name: PinnedImageSet desired generation must be greater than last failed generation + initial: | + apiVersion: machineconfiguration.openshift.io/v1alpha1 + kind: MachineConfigNode + metadata: + name: foobar + spec: + node: + name: foobar + pool: + name: worker + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + status: + observedGeneration: 4 + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + currentGeneration: 2 + desiredGeneration: 2 + lastFailedGeneration: 1 + updated: | + apiVersion: machineconfiguration.openshift.io/v1alpha1 + kind: MachineConfigNode + metadata: + name: foobar + spec: + node: + name: foobar + pool: + name: worker + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + status: + observedGeneration: 5 + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + currentGeneration: 3 + desiredGeneration: 3 + lastFailedGeneration: 4 + expectedStatusError: "Invalid value: \"object\": desired generation must be greater than last failed generation" + - name: PinnedImageSet desired generation must be set if last failed generation is set + initial: | + apiVersion: machineconfiguration.openshift.io/v1alpha1 + kind: MachineConfigNode + metadata: + name: foobar + spec: + node: + name: foobar + pool: + name: worker + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + status: + observedGeneration: 4 + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + updated: | + apiVersion: machineconfiguration.openshift.io/v1alpha1 + kind: MachineConfigNode + metadata: + name: foobar + spec: + node: + name: foobar + pool: + name: worker + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + status: + observedGeneration: 5 + configVersion: + desired: rendered-worker-abc + pinnedImageSets: + - name: test-pinned-image-set + lastFailedGeneration: 2 + expectedStatusError: "Invalid value: \"object\": desired generation must be defined if last failed generation is defined" \ No newline at end of file diff --git a/machineconfiguration/v1alpha1/types_machineconfignode.go b/machineconfiguration/v1alpha1/types_machineconfignode.go index b2d3cbab9ab..b84910ad40b 100644 --- a/machineconfiguration/v1alpha1/types_machineconfignode.go +++ b/machineconfiguration/v1alpha1/types_machineconfignode.go @@ -87,6 +87,13 @@ type MachineConfigNodeSpec struct { // the new machine config against the current machine config. // +kubebuilder:validation:Required ConfigVersion MachineConfigNodeSpecMachineConfigVersion `json:"configVersion"` + + // pinnedImageSets holds the desired pinned image sets that this node should pin and pull. + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MaxItems=100 + // +optional + PinnedImageSets []MachineConfigNodeSpecPinnedImageSet `json:"pinnedImageSets,omitempty"` } // MachineConfigNodeStatus holds the reported information on a particular machine config node. @@ -107,6 +114,43 @@ type MachineConfigNodeStatus struct { // This desired machine config has been compared to the current machine config and has been validated by the machine config operator as one that is valid and that exists. // +kubebuilder:validation:Required ConfigVersion MachineConfigNodeStatusMachineConfigVersion `json:"configVersion"` + // pinnedImageSets describes the current and desired pinned image sets for this node. + // The current version is the generation of the pinned image set that has most recently been successfully pulled and pinned on this node. + // The desired version is the generation of the pinned image set that is targeted to be pulled and pinned on this node. + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MaxItems=100 + // +optional + PinnedImageSets []MachineConfigNodeStatusPinnedImageSet `json:"pinnedImageSets,omitempty"` +} + +// +kubebuilder:validation:XValidation:rule="has(self.desiredGeneration) && has(self.currentGeneration) ? self.desiredGeneration >= self.currentGeneration : true",message="desired generation must be greater than or equal to the current generation" +// +kubebuilder:validation:XValidation:rule="has(self.lastFailedGeneration) && has(self.desiredGeneration) ? self.desiredGeneration >= self.lastFailedGeneration : true",message="desired generation must be greater than last failed generation" +// +kubebuilder:validation:XValidation:rule="has(self.lastFailedGeneration) ? has(self.desiredGeneration): true",message="desired generation must be defined if last failed generation is defined" +type MachineConfigNodeStatusPinnedImageSet struct { + // name is the name of the pinned image set. + // Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + // It may consist of only alphanumeric characters, hyphens (-) and periods (.) + // and must be at most 253 characters in length. + // +kubebuilder:validation:MaxLength:=253 + // +kubebuilder:validation:Pattern=`^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$` + // +kubebuilder:validation:Required + Name string `json:"name"` + // currentGeneration is the generation of the pinned image set that has most recently been successfully pulled and pinned on this node. + // +optional + CurrentGeneration int32 `json:"currentGeneration,omitempty"` + // desiredGeneration version is the generation of the pinned image set that is targeted to be pulled and pinned on this node. + // +kubebuilder:validation:Minimum=0 + // +optional + DesiredGeneration int32 `json:"desiredGeneration,omitempty"` + // lastFailedGeneration is the generation of the most recent pinned image set that failed to be pulled and pinned on this node. + // +kubebuilder:validation:Minimum=0 + // +optional + LastFailedGeneration int32 `json:"lastFailedGeneration,omitempty"` + // lastFailedGenerationErrors is a list of errors why the lastFailed generation failed to be pulled and pinned. + // +kubebuilder:validation:MaxItems=10 + // +optional + LastFailedGenerationErrors []string `json:"lastFailedGenerationErrors,omitempty"` } // MachineConfigNodeStatusMachineConfigVersion holds the current and desired config versions as last updated in the MCN status. @@ -155,6 +199,17 @@ type MachineConfigNodeSpecMachineConfigVersion struct { Desired string `json:"desired"` } +type MachineConfigNodeSpecPinnedImageSet struct { + // name is the name of the pinned image set. + // Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + // It may consist of only alphanumeric characters, hyphens (-) and periods (.) + // and must be at most 253 characters in length. + // +kubebuilder:validation:MaxLength:=253 + // +kubebuilder:validation:Pattern=`^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$` + // +kubebuilder:validation:Required + Name string `json:"name"` +} + // StateProgress is each possible state for each possible MachineConfigNodeType // UpgradeProgression Kind will only use the "MachinConfigPoolUpdate..." types for example // Please note: These conditions are subject to change. Both additions and deletions may be made. @@ -187,4 +242,8 @@ const ( MachineConfigNodeUpdateRebooted StateProgress = "RebootedNode" // MachineConfigNodeUpdateReloaded describes the part of the post action phase where the node reloads its CRIO service MachineConfigNodeUpdateReloaded StateProgress = "ReloadedCRIO" + // MachineConfigNodePinnedImageSetsProgressing describes a machine currently progressing to the desired pinned image sets + MachineConfigNodePinnedImageSetsProgressing StateProgress = "PinnedImageSetsProgressing" + // MachineConfigNodePinnedImageSetsDegraded describes a machine that has failed to progress to the desired pinned image sets + MachineConfigNodePinnedImageSetsDegraded StateProgress = "PinnedImageSetsDegraded" ) diff --git a/machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-CustomNoUpgrade.crd.yaml b/machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-CustomNoUpgrade.crd.yaml index 995f8db3969..0ce75093a51 100644 --- a/machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-CustomNoUpgrade.crd.yaml +++ b/machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-CustomNoUpgrade.crd.yaml @@ -128,6 +128,27 @@ spec: required: - name type: object + pinnedImageSets: + description: pinnedImageSets holds the desired pinned image sets that + this node should pin and pull. + items: + properties: + name: + description: name is the name of the pinned image set. Must + be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + It may consist of only alphanumeric characters, hyphens (-) + and periods (.) and must be at most 253 characters in length. + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ + type: string + required: + - name + type: object + maxItems: 100 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map pool: description: pool contains a reference to the machine config pool that this machine config node's referenced node belongs to. @@ -266,6 +287,70 @@ spec: config node spec. format: int64 type: integer + pinnedImageSets: + description: pinnedImageSets describes the current and desired pinned + image sets for this node. The current version is the generation + of the pinned image set that has most recently been successfully + pulled and pinned on this node. The desired version is the generation + of the pinned image set that is targeted to be pulled and pinned + on this node. + items: + properties: + currentGeneration: + description: currentGeneration is the generation of the pinned + image set that has most recently been successfully pulled + and pinned on this node. + format: int32 + type: integer + desiredGeneration: + description: desiredGeneration version is the generation of + the pinned image set that is targeted to be pulled and pinned + on this node. + format: int32 + minimum: 0 + type: integer + lastFailedGeneration: + description: lastFailedGeneration is the generation of the most + recent pinned image set that failed to be pulled and pinned + on this node. + format: int32 + minimum: 0 + type: integer + lastFailedGenerationErrors: + description: lastFailedGenerationErrors is a list of errors + why the lastFailed generation failed to be pulled and pinned. + items: + type: string + maxItems: 10 + type: array + name: + description: name is the name of the pinned image set. Must + be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + It may consist of only alphanumeric characters, hyphens (-) + and periods (.) and must be at most 253 characters in length. + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ + type: string + required: + - name + type: object + x-kubernetes-validations: + - message: desired generation must be greater than or equal to the + current generation + rule: 'has(self.desiredGeneration) && has(self.currentGeneration) + ? self.desiredGeneration >= self.currentGeneration : true' + - message: desired generation must be greater than last failed generation + rule: 'has(self.lastFailedGeneration) && has(self.desiredGeneration) + ? self.desiredGeneration >= self.lastFailedGeneration : true' + - message: desired generation must be defined if last failed generation + is defined + rule: 'has(self.lastFailedGeneration) ? has(self.desiredGeneration): + true' + maxItems: 100 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map required: - configVersion type: object diff --git a/machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-TechPreviewNoUpgrade.crd.yaml b/machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-TechPreviewNoUpgrade.crd.yaml index 0191eb81aa3..ce3302f2a5d 100644 --- a/machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-TechPreviewNoUpgrade.crd.yaml +++ b/machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-TechPreviewNoUpgrade.crd.yaml @@ -128,6 +128,27 @@ spec: required: - name type: object + pinnedImageSets: + description: pinnedImageSets holds the desired pinned image sets that + this node should pin and pull. + items: + properties: + name: + description: name is the name of the pinned image set. Must + be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + It may consist of only alphanumeric characters, hyphens (-) + and periods (.) and must be at most 253 characters in length. + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ + type: string + required: + - name + type: object + maxItems: 100 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map pool: description: pool contains a reference to the machine config pool that this machine config node's referenced node belongs to. @@ -266,6 +287,70 @@ spec: config node spec. format: int64 type: integer + pinnedImageSets: + description: pinnedImageSets describes the current and desired pinned + image sets for this node. The current version is the generation + of the pinned image set that has most recently been successfully + pulled and pinned on this node. The desired version is the generation + of the pinned image set that is targeted to be pulled and pinned + on this node. + items: + properties: + currentGeneration: + description: currentGeneration is the generation of the pinned + image set that has most recently been successfully pulled + and pinned on this node. + format: int32 + type: integer + desiredGeneration: + description: desiredGeneration version is the generation of + the pinned image set that is targeted to be pulled and pinned + on this node. + format: int32 + minimum: 0 + type: integer + lastFailedGeneration: + description: lastFailedGeneration is the generation of the most + recent pinned image set that failed to be pulled and pinned + on this node. + format: int32 + minimum: 0 + type: integer + lastFailedGenerationErrors: + description: lastFailedGenerationErrors is a list of errors + why the lastFailed generation failed to be pulled and pinned. + items: + type: string + maxItems: 10 + type: array + name: + description: name is the name of the pinned image set. Must + be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + It may consist of only alphanumeric characters, hyphens (-) + and periods (.) and must be at most 253 characters in length. + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ + type: string + required: + - name + type: object + x-kubernetes-validations: + - message: desired generation must be greater than or equal to the + current generation + rule: 'has(self.desiredGeneration) && has(self.currentGeneration) + ? self.desiredGeneration >= self.currentGeneration : true' + - message: desired generation must be greater than last failed generation + rule: 'has(self.lastFailedGeneration) && has(self.desiredGeneration) + ? self.desiredGeneration >= self.lastFailedGeneration : true' + - message: desired generation must be defined if last failed generation + is defined + rule: 'has(self.lastFailedGeneration) ? has(self.desiredGeneration): + true' + maxItems: 100 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map required: - configVersion type: object diff --git a/machineconfiguration/v1alpha1/zz_generated.deepcopy.go b/machineconfiguration/v1alpha1/zz_generated.deepcopy.go index 183e0f30d9c..7798c926e3a 100644 --- a/machineconfiguration/v1alpha1/zz_generated.deepcopy.go +++ b/machineconfiguration/v1alpha1/zz_generated.deepcopy.go @@ -31,7 +31,7 @@ func (in *MachineConfigNode) DeepCopyInto(out *MachineConfigNode) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } @@ -93,6 +93,11 @@ func (in *MachineConfigNodeSpec) DeepCopyInto(out *MachineConfigNodeSpec) { out.Node = in.Node out.Pool = in.Pool out.ConfigVersion = in.ConfigVersion + if in.PinnedImageSets != nil { + in, out := &in.PinnedImageSets, &out.PinnedImageSets + *out = make([]MachineConfigNodeSpecPinnedImageSet, len(*in)) + copy(*out, *in) + } return } @@ -122,6 +127,22 @@ func (in *MachineConfigNodeSpecMachineConfigVersion) DeepCopy() *MachineConfigNo return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineConfigNodeSpecPinnedImageSet) DeepCopyInto(out *MachineConfigNodeSpecPinnedImageSet) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineConfigNodeSpecPinnedImageSet. +func (in *MachineConfigNodeSpecPinnedImageSet) DeepCopy() *MachineConfigNodeSpecPinnedImageSet { + if in == nil { + return nil + } + out := new(MachineConfigNodeSpecPinnedImageSet) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineConfigNodeStatus) DeepCopyInto(out *MachineConfigNodeStatus) { *out = *in @@ -133,6 +154,13 @@ func (in *MachineConfigNodeStatus) DeepCopyInto(out *MachineConfigNodeStatus) { } } out.ConfigVersion = in.ConfigVersion + if in.PinnedImageSets != nil { + in, out := &in.PinnedImageSets, &out.PinnedImageSets + *out = make([]MachineConfigNodeStatusPinnedImageSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -162,6 +190,27 @@ func (in *MachineConfigNodeStatusMachineConfigVersion) DeepCopy() *MachineConfig return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineConfigNodeStatusPinnedImageSet) DeepCopyInto(out *MachineConfigNodeStatusPinnedImageSet) { + *out = *in + if in.LastFailedGenerationErrors != nil { + in, out := &in.LastFailedGenerationErrors, &out.LastFailedGenerationErrors + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineConfigNodeStatusPinnedImageSet. +func (in *MachineConfigNodeStatusPinnedImageSet) DeepCopy() *MachineConfigNodeStatusPinnedImageSet { + if in == nil { + return nil + } + out := new(MachineConfigNodeStatusPinnedImageSet) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PinnedImageRef) DeepCopyInto(out *PinnedImageRef) { *out = *in diff --git a/machineconfiguration/v1alpha1/zz_generated.featuregated-crd-manifests/machineconfignodes.machineconfiguration.openshift.io/MachineConfigNodes.yaml b/machineconfiguration/v1alpha1/zz_generated.featuregated-crd-manifests/machineconfignodes.machineconfiguration.openshift.io/MachineConfigNodes.yaml index f1e7082abd2..fb259a9600f 100644 --- a/machineconfiguration/v1alpha1/zz_generated.featuregated-crd-manifests/machineconfignodes.machineconfiguration.openshift.io/MachineConfigNodes.yaml +++ b/machineconfiguration/v1alpha1/zz_generated.featuregated-crd-manifests/machineconfignodes.machineconfiguration.openshift.io/MachineConfigNodes.yaml @@ -128,6 +128,27 @@ spec: required: - name type: object + pinnedImageSets: + description: pinnedImageSets holds the desired pinned image sets that + this node should pin and pull. + items: + properties: + name: + description: name is the name of the pinned image set. Must + be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + It may consist of only alphanumeric characters, hyphens (-) + and periods (.) and must be at most 253 characters in length. + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ + type: string + required: + - name + type: object + maxItems: 100 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map pool: description: pool contains a reference to the machine config pool that this machine config node's referenced node belongs to. @@ -266,6 +287,70 @@ spec: config node spec. format: int64 type: integer + pinnedImageSets: + description: pinnedImageSets describes the current and desired pinned + image sets for this node. The current version is the generation + of the pinned image set that has most recently been successfully + pulled and pinned on this node. The desired version is the generation + of the pinned image set that is targeted to be pulled and pinned + on this node. + items: + properties: + currentGeneration: + description: currentGeneration is the generation of the pinned + image set that has most recently been successfully pulled + and pinned on this node. + format: int32 + type: integer + desiredGeneration: + description: desiredGeneration version is the generation of + the pinned image set that is targeted to be pulled and pinned + on this node. + format: int32 + minimum: 0 + type: integer + lastFailedGeneration: + description: lastFailedGeneration is the generation of the most + recent pinned image set that failed to be pulled and pinned + on this node. + format: int32 + minimum: 0 + type: integer + lastFailedGenerationErrors: + description: lastFailedGenerationErrors is a list of errors + why the lastFailed generation failed to be pulled and pinned. + items: + type: string + maxItems: 10 + type: array + name: + description: name is the name of the pinned image set. Must + be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) + It may consist of only alphanumeric characters, hyphens (-) + and periods (.) and must be at most 253 characters in length. + maxLength: 253 + pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$ + type: string + required: + - name + type: object + x-kubernetes-validations: + - message: desired generation must be greater than or equal to the + current generation + rule: 'has(self.desiredGeneration) && has(self.currentGeneration) + ? self.desiredGeneration >= self.currentGeneration : true' + - message: desired generation must be greater than last failed generation + rule: 'has(self.lastFailedGeneration) && has(self.desiredGeneration) + ? self.desiredGeneration >= self.lastFailedGeneration : true' + - message: desired generation must be defined if last failed generation + is defined + rule: 'has(self.lastFailedGeneration) ? has(self.desiredGeneration): + true' + maxItems: 100 + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map required: - configVersion type: object diff --git a/machineconfiguration/v1alpha1/zz_generated.swagger_doc_generated.go b/machineconfiguration/v1alpha1/zz_generated.swagger_doc_generated.go index e7e8c165cc4..46f67854dbf 100644 --- a/machineconfiguration/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/machineconfiguration/v1alpha1/zz_generated.swagger_doc_generated.go @@ -39,10 +39,11 @@ func (MachineConfigNodeList) SwaggerDoc() map[string]string { } var map_MachineConfigNodeSpec = map[string]string{ - "": "MachineConfigNodeSpec describes the MachineConfigNode we are managing.", - "node": "node contains a reference to the node for this machine config node.", - "pool": "pool contains a reference to the machine config pool that this machine config node's referenced node belongs to.", - "configVersion": "configVersion holds the desired config version for the node targeted by this machine config node resource. The desired version represents the machine config the node will attempt to update to. This gets set before the machine config operator validates the new machine config against the current machine config.", + "": "MachineConfigNodeSpec describes the MachineConfigNode we are managing.", + "node": "node contains a reference to the node for this machine config node.", + "pool": "pool contains a reference to the machine config pool that this machine config node's referenced node belongs to.", + "configVersion": "configVersion holds the desired config version for the node targeted by this machine config node resource. The desired version represents the machine config the node will attempt to update to. This gets set before the machine config operator validates the new machine config against the current machine config.", + "pinnedImageSets": "pinnedImageSets holds the desired pinned image sets that this node should pin and pull.", } func (MachineConfigNodeSpec) SwaggerDoc() map[string]string { @@ -58,11 +59,20 @@ func (MachineConfigNodeSpecMachineConfigVersion) SwaggerDoc() map[string]string return map_MachineConfigNodeSpecMachineConfigVersion } +var map_MachineConfigNodeSpecPinnedImageSet = map[string]string{ + "name": "name is the name of the pinned image set. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.", +} + +func (MachineConfigNodeSpecPinnedImageSet) SwaggerDoc() map[string]string { + return map_MachineConfigNodeSpecPinnedImageSet +} + var map_MachineConfigNodeStatus = map[string]string{ "": "MachineConfigNodeStatus holds the reported information on a particular machine config node.", "conditions": "conditions represent the observations of a machine config node's current state.", "observedGeneration": "observedGeneration represents the generation observed by the controller. This field is updated when the controller observes a change to the desiredConfig in the configVersion of the machine config node spec.", "configVersion": "configVersion describes the current and desired machine config for this node. The current version represents the current machine config for the node and is updated after a successful update. The desired version represents the machine config the node will attempt to update to. This desired machine config has been compared to the current machine config and has been validated by the machine config operator as one that is valid and that exists.", + "pinnedImageSets": "pinnedImageSets describes the current and desired pinned image sets for this node. The current version is the generation of the pinned image set that has most recently been successfully pulled and pinned on this node. The desired version is the generation of the pinned image set that is targeted to be pulled and pinned on this node.", } func (MachineConfigNodeStatus) SwaggerDoc() map[string]string { @@ -79,6 +89,18 @@ func (MachineConfigNodeStatusMachineConfigVersion) SwaggerDoc() map[string]strin return map_MachineConfigNodeStatusMachineConfigVersion } +var map_MachineConfigNodeStatusPinnedImageSet = map[string]string{ + "name": "name is the name of the pinned image set. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.", + "currentGeneration": "currentGeneration is the generation of the pinned image set that has most recently been successfully pulled and pinned on this node.", + "desiredGeneration": "desiredGeneration version is the generation of the pinned image set that is targeted to be pulled and pinned on this node.", + "lastFailedGeneration": "lastFailedGeneration is the generation of the most recent pinned image set that failed to be pulled and pinned on this node.", + "lastFailedGenerationErrors": "lastFailedGenerationErrors is a list of errors why the lastFailed generation failed to be pulled and pinned.", +} + +func (MachineConfigNodeStatusPinnedImageSet) SwaggerDoc() map[string]string { + return map_MachineConfigNodeStatusPinnedImageSet +} + var map_PinnedImageRef = map[string]string{ "name": "name is an OCI Image referenced by digest.\n\nThe format of the image ref is: host[:port][/namespace]/name@sha256:", } diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index b681913ce6b..aa69674725f 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -753,8 +753,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeList": schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeList(ref), "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeSpec": schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeSpec(ref), "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeSpecMachineConfigVersion": schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeSpecMachineConfigVersion(ref), + "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeSpecPinnedImageSet": schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeSpecPinnedImageSet(ref), "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeStatus": schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeStatus(ref), "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeStatusMachineConfigVersion": schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeStatusMachineConfigVersion(ref), + "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeStatusPinnedImageSet": schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeStatusPinnedImageSet(ref), "github.com/openshift/api/machineconfiguration/v1alpha1.PinnedImageRef": schema_openshift_api_machineconfiguration_v1alpha1_PinnedImageRef(ref), "github.com/openshift/api/machineconfiguration/v1alpha1.PinnedImageSet": schema_openshift_api_machineconfiguration_v1alpha1_PinnedImageSet(ref), "github.com/openshift/api/machineconfiguration/v1alpha1.PinnedImageSetList": schema_openshift_api_machineconfiguration_v1alpha1_PinnedImageSetList(ref), @@ -38459,12 +38461,34 @@ func schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeSpec(re Ref: ref("github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeSpecMachineConfigVersion"), }, }, + "pinnedImageSets": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "pinnedImageSets holds the desired pinned image sets that this node should pin and pull.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeSpecPinnedImageSet"), + }, + }, + }, + }, + }, }, Required: []string{"node", "pool", "configVersion"}, }, }, Dependencies: []string{ - "github.com/openshift/api/machineconfiguration/v1alpha1.MCOObjectReference", "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeSpecMachineConfigVersion"}, + "github.com/openshift/api/machineconfiguration/v1alpha1.MCOObjectReference", "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeSpecMachineConfigVersion", "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeSpecPinnedImageSet"}, } } @@ -38490,6 +38514,27 @@ func schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeSpecMac } } +func schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeSpecPinnedImageSet(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the name of the pinned image set. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + func schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -38535,12 +38580,34 @@ func schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeStatus( Ref: ref("github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeStatusMachineConfigVersion"), }, }, + "pinnedImageSets": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "name", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "pinnedImageSets describes the current and desired pinned image sets for this node. The current version is the generation of the pinned image set that has most recently been successfully pulled and pinned on this node. The desired version is the generation of the pinned image set that is targeted to be pulled and pinned on this node.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeStatusPinnedImageSet"), + }, + }, + }, + }, + }, }, Required: []string{"configVersion"}, }, }, Dependencies: []string{ - "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeStatusMachineConfigVersion", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, + "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeStatusMachineConfigVersion", "github.com/openshift/api/machineconfiguration/v1alpha1.MachineConfigNodeStatusPinnedImageSet", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, } } @@ -38574,6 +38641,63 @@ func schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeStatusM } } +func schema_openshift_api_machineconfiguration_v1alpha1_MachineConfigNodeStatusPinnedImageSet(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is the name of the pinned image set. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "currentGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "currentGeneration is the generation of the pinned image set that has most recently been successfully pulled and pinned on this node.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "desiredGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "desiredGeneration version is the generation of the pinned image set that is targeted to be pulled and pinned on this node.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "lastFailedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "lastFailedGeneration is the generation of the most recent pinned image set that failed to be pulled and pinned on this node.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "lastFailedGenerationErrors": { + SchemaProps: spec.SchemaProps{ + Description: "lastFailedGenerationErrors is a list of errors why the lastFailed generation failed to be pulled and pinned.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + func schema_openshift_api_machineconfiguration_v1alpha1_PinnedImageRef(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/openapi/openapi.json b/openapi/openapi.json index 81cb9aeb16c..0458044c06f 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -22297,6 +22297,18 @@ "default": {}, "$ref": "#/definitions/com.github.openshift.api.machineconfiguration.v1alpha1.MCOObjectReference" }, + "pinnedImageSets": { + "description": "pinnedImageSets holds the desired pinned image sets that this node should pin and pull.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.machineconfiguration.v1alpha1.MachineConfigNodeSpecPinnedImageSet" + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" + }, "pool": { "description": "pool contains a reference to the machine config pool that this machine config node's referenced node belongs to.", "default": {}, @@ -22318,6 +22330,19 @@ } } }, + "com.github.openshift.api.machineconfiguration.v1alpha1.MachineConfigNodeSpecPinnedImageSet": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "name is the name of the pinned image set. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.", + "type": "string", + "default": "" + } + } + }, "com.github.openshift.api.machineconfiguration.v1alpha1.MachineConfigNodeStatus": { "description": "MachineConfigNodeStatus holds the reported information on a particular machine config node.", "type": "object", @@ -22348,6 +22373,18 @@ "description": "observedGeneration represents the generation observed by the controller. This field is updated when the controller observes a change to the desiredConfig in the configVersion of the machine config node spec.", "type": "integer", "format": "int64" + }, + "pinnedImageSets": { + "description": "pinnedImageSets describes the current and desired pinned image sets for this node. The current version is the generation of the pinned image set that has most recently been successfully pulled and pinned on this node. The desired version is the generation of the pinned image set that is targeted to be pulled and pinned on this node.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.machineconfiguration.v1alpha1.MachineConfigNodeStatusPinnedImageSet" + }, + "x-kubernetes-list-map-keys": [ + "name" + ], + "x-kubernetes-list-type": "map" } } }, @@ -22370,6 +22407,42 @@ } } }, + "com.github.openshift.api.machineconfiguration.v1alpha1.MachineConfigNodeStatusPinnedImageSet": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "currentGeneration": { + "description": "currentGeneration is the generation of the pinned image set that has most recently been successfully pulled and pinned on this node.", + "type": "integer", + "format": "int32" + }, + "desiredGeneration": { + "description": "desiredGeneration version is the generation of the pinned image set that is targeted to be pulled and pinned on this node.", + "type": "integer", + "format": "int32" + }, + "lastFailedGeneration": { + "description": "lastFailedGeneration is the generation of the most recent pinned image set that failed to be pulled and pinned on this node.", + "type": "integer", + "format": "int32" + }, + "lastFailedGenerationErrors": { + "description": "lastFailedGenerationErrors is a list of errors why the lastFailed generation failed to be pulled and pinned.", + "type": "array", + "items": { + "type": "string", + "default": "" + } + }, + "name": { + "description": "name is the name of the pinned image set. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.", + "type": "string", + "default": "" + } + } + }, "com.github.openshift.api.machineconfiguration.v1alpha1.PinnedImageRef": { "type": "object", "required": [