Skip to content

Commit 463ca8c

Browse files
committed
modified v1alpha1 internalreleaseimage status to use the same structure adopted for the MCN status field
1 parent 0ea34c9 commit 463ca8c

File tree

29 files changed

+1856
-548
lines changed

29 files changed

+1856
-548
lines changed

hack/update-payload-crds.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ crd_globs="\
2424
config/v1/zz_generated.crd-manifests/0000_10_openshift-controller-manager_01_builds*.crd.yaml
2525
operator/v1/zz_generated.crd-manifests/0000_50_openshift-controller-manager_02_openshiftcontrollermanagers*.crd.yaml
2626
machineconfiguration/v1/zz_generated.crd-manifests/*.crd.yaml
27+
machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_internalreleaseimages-*.crd.yaml
2728
operator/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfigurations*.crd.yaml
2829
config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitoring*.crd.yaml
2930
operator/v1/zz_generated.crd-manifests/*_storage_01_storages*.crd.yaml

machineconfiguration/v1/tests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterOperations.yaml renamed to machineconfiguration/v1/tests/machineconfignodes.machineconfiguration.openshift.io/NoRegistryClusterInstall.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: "[TechPreview] InternalReleaseImage"
33
crdName: machineconfignodes.machineconfiguration.openshift.io
44
featureGates:
55
- MachineConfigNodes
6-
- NoRegistryClusterOperations
6+
- NoRegistryClusterInstall
77
tests:
88
onUpdate:
99
- name: Should be able to update a MachineConfigNode with a minimal internalReleaseImage status field.

machineconfiguration/v1/types_machineconfignode.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ type MachineConfigNodeStatus struct {
161161
// internalReleaseImage describes the status of the release payloads stored in the node.
162162
// When specified, an internalReleaseImage custom resource exists on the cluster, and the specified images will be made available on the control plane nodes.
163163
// This field will reflect the actual on-disk state of those release images.
164-
// +openshift:enable:FeatureGate=NoRegistryClusterOperations
164+
// +openshift:enable:FeatureGate=NoRegistryClusterInstall
165165
// +optional
166166
InternalReleaseImage MachineConfigNodeStatusInternalReleaseImage `json:"internalReleaseImage,omitzero,omitempty"`
167167
}
@@ -170,47 +170,58 @@ type MachineConfigNodeStatus struct {
170170
// config node.
171171
type MachineConfigNodeStatusInternalReleaseImage struct {
172172
// releases is a list of the release bundles currently owned and managed by the
173-
// cluster, indicating that their images can be safely pulled by any cluster entity
174-
// requiring them.
175-
// This field can contain between 1 and 5 entries.
173+
// cluster.
174+
// A release bundle content could be safely pulled only when its Conditions field
175+
// contains at least an Available entry set to "True" and Degraded to "False".
176+
// Entries must be unique, keyed on the name field.
177+
// releases must contain at least one entry and must not exceed 32 entries.
176178
// +listType=map
177179
// +listMapKey=name
178180
// +kubebuilder:validation:MinItems=1
179-
// +kubebuilder:validation:MaxItems=5
181+
// +kubebuilder:validation:MaxItems=32
180182
// +required
181183
Releases []MachineConfigNodeStatusInternalReleaseImageRef `json:"releases,omitempty"`
182184
}
183185

184186
// MachineConfigNodeStatusInternalReleaseImageRef is used to provide a more detailed reference for
185187
// a release bundle.
186-
// +openshift:enable:FeatureGate=NoRegistryClusterOperations
187188
type MachineConfigNodeStatusInternalReleaseImageRef struct {
188-
// conditions represent the observations of an internal release image current state. See InternalReleaseImageConditionType for the possible
189-
// type values.
189+
// conditions represent the observations of an internal release image current state. Valid types are:
190+
// Mounted, Installing, Available, Removing and Degraded.
191+
//
192+
// If Mounted is true, that means that a valid ISO has been mounted on the current node.
193+
// If Installing is true, that means that a new release bundle is currently being copied on the current node, and not yet completed.
194+
// If Available is true, it means that the release has been previously installed on the current node, and it can be used.
195+
// If Removing is true, it means that a release deletion is in progress on the current node, and not yet completed.
196+
// If Degraded is true, that means something has gone wrong in the current node.
197+
//
190198
// +listType=map
191199
// +listMapKey=type
192200
// +kubebuilder:validation:MinItems=1
193201
// +kubebuilder:validation:MaxItems=5
194202
// +optional
195203
Conditions []metav1.Condition `json:"conditions,omitempty"`
196204
// name indicates the desired release bundle identifier. This field is required and must be between 1 and 64 characters long.
205+
// The expected name format is ocp-release-bundle-<version>-<arch|stream>.
197206
// +kubebuilder:validation:MinLength=1
198207
// +kubebuilder:validation:MaxLength=64
208+
// +kubebuilder:validation:XValidation:rule=`self.matches('^ocp-release-bundle-[0-9]+\\.[0-9]+\\.[0-9]+-[A-Za-z0-9_-]+$')`,message="must be ocp-release-bundle-<version>-<arch|stream> and <= 64 chars"
199209
// +required
200210
Name string `json:"name,omitempty"`
201211
// image is an OCP release image referenced by digest.
202212
// The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
203213
// where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
204214
// The length of the whole spec must be between 1 to 447 characters.
215+
// The field is optional, and it will be provided after a release will be successfully installed.
205216
// +kubebuilder:validation:MinLength=1
206217
// +kubebuilder:validation:MaxLength=447
207218
// +kubebuilder:validation:XValidation:rule=`(self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$'))`,message="the OCI Image reference must end with a valid '@sha256:<digest>' suffix, where '<digest>' is 64 characters long"
208219
// +kubebuilder:validation:XValidation:rule=`(self.split('@')[0].matches('^([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$'))`,message="the OCI Image name should follow the host[:port][/namespace]/name format, resembling a valid URL without the scheme"
209-
// +required
220+
// +optional
210221
Image string `json:"image,omitempty"`
211222
}
212223

213-
// InternalReleaseImageConditionType is each possible state for each possible MachineConfigNodeStatusInternalReleaseImageRef
224+
// InternalReleaseImageConditionType is each possible state for each possible InternalReleaseImageBundleStatus
214225
// conditions type.
215226
// +enum
216227
type InternalReleaseImageConditionType string

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-Hypershift-CustomNoUpgrade.crd.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,18 +361,26 @@ spec:
361361
releases:
362362
description: |-
363363
releases is a list of the release bundles currently owned and managed by the
364-
cluster, indicating that their images can be safely pulled by any cluster entity
365-
requiring them.
366-
This field can contain between 1 and 5 entries.
364+
cluster.
365+
A release bundle content could be safely pulled only when its Conditions field
366+
contains at least an Available entry set to "True" and Degraded to "False".
367+
Entries must be unique, keyed on the name field.
368+
releases must contain at least one entry and must not exceed 32 entries.
367369
items:
368370
description: |-
369371
MachineConfigNodeStatusInternalReleaseImageRef is used to provide a more detailed reference for
370372
a release bundle.
371373
properties:
372374
conditions:
373375
description: |-
374-
conditions represent the observations of an internal release image current state. See InternalReleaseImageConditionType for the possible
375-
type values.
376+
conditions represent the observations of an internal release image current state. Valid types are:
377+
Mounted, Installing, Available, Removing and Degraded.
378+
379+
If Mounted is true, that means that a valid ISO has been mounted on the current node.
380+
If Installing is true, that means that a new release bundle is currently being copied on the current node, and not yet completed.
381+
If Available is true, it means that the release has been previously installed on the current node, and it can be used.
382+
If Removing is true, it means that a release deletion is in progress on the current node, and not yet completed.
383+
If Degraded is true, that means something has gone wrong in the current node.
376384
items:
377385
description: Condition contains details for one aspect
378386
of the current state of this API Resource.
@@ -441,6 +449,7 @@ spec:
441449
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
442450
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
443451
The length of the whole spec must be between 1 to 447 characters.
452+
The field is optional, and it will be provided after a release will be successfully installed.
444453
maxLength: 447
445454
minLength: 1
446455
type: string
@@ -453,17 +462,20 @@ spec:
453462
format, resembling a valid URL without the scheme
454463
rule: (self.split('@')[0].matches('^([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$'))
455464
name:
456-
description: name indicates the desired release bundle identifier.
457-
This field is required and must be between 1 and 64 characters
458-
long.
465+
description: |-
466+
name indicates the desired release bundle identifier. This field is required and must be between 1 and 64 characters long.
467+
The expected name format is ocp-release-bundle-<version>-<arch|stream>.
459468
maxLength: 64
460469
minLength: 1
461470
type: string
471+
x-kubernetes-validations:
472+
- message: must be ocp-release-bundle-<version>-<arch|stream>
473+
and <= 64 chars
474+
rule: self.matches('^ocp-release-bundle-[0-9]+\\.[0-9]+\\.[0-9]+-[A-Za-z0-9_-]+$')
462475
required:
463-
- image
464476
- name
465477
type: object
466-
maxItems: 5
478+
maxItems: 32
467479
minItems: 1
468480
type: array
469481
x-kubernetes-list-map-keys:

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-CustomNoUpgrade.crd.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,18 +361,26 @@ spec:
361361
releases:
362362
description: |-
363363
releases is a list of the release bundles currently owned and managed by the
364-
cluster, indicating that their images can be safely pulled by any cluster entity
365-
requiring them.
366-
This field can contain between 1 and 5 entries.
364+
cluster.
365+
A release bundle content could be safely pulled only when its Conditions field
366+
contains at least an Available entry set to "True" and Degraded to "False".
367+
Entries must be unique, keyed on the name field.
368+
releases must contain at least one entry and must not exceed 32 entries.
367369
items:
368370
description: |-
369371
MachineConfigNodeStatusInternalReleaseImageRef is used to provide a more detailed reference for
370372
a release bundle.
371373
properties:
372374
conditions:
373375
description: |-
374-
conditions represent the observations of an internal release image current state. See InternalReleaseImageConditionType for the possible
375-
type values.
376+
conditions represent the observations of an internal release image current state. Valid types are:
377+
Mounted, Installing, Available, Removing and Degraded.
378+
379+
If Mounted is true, that means that a valid ISO has been mounted on the current node.
380+
If Installing is true, that means that a new release bundle is currently being copied on the current node, and not yet completed.
381+
If Available is true, it means that the release has been previously installed on the current node, and it can be used.
382+
If Removing is true, it means that a release deletion is in progress on the current node, and not yet completed.
383+
If Degraded is true, that means something has gone wrong in the current node.
376384
items:
377385
description: Condition contains details for one aspect
378386
of the current state of this API Resource.
@@ -441,6 +449,7 @@ spec:
441449
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
442450
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
443451
The length of the whole spec must be between 1 to 447 characters.
452+
The field is optional, and it will be provided after a release will be successfully installed.
444453
maxLength: 447
445454
minLength: 1
446455
type: string
@@ -453,17 +462,20 @@ spec:
453462
format, resembling a valid URL without the scheme
454463
rule: (self.split('@')[0].matches('^([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$'))
455464
name:
456-
description: name indicates the desired release bundle identifier.
457-
This field is required and must be between 1 and 64 characters
458-
long.
465+
description: |-
466+
name indicates the desired release bundle identifier. This field is required and must be between 1 and 64 characters long.
467+
The expected name format is ocp-release-bundle-<version>-<arch|stream>.
459468
maxLength: 64
460469
minLength: 1
461470
type: string
471+
x-kubernetes-validations:
472+
- message: must be ocp-release-bundle-<version>-<arch|stream>
473+
and <= 64 chars
474+
rule: self.matches('^ocp-release-bundle-[0-9]+\\.[0-9]+\\.[0-9]+-[A-Za-z0-9_-]+$')
462475
required:
463-
- image
464476
- name
465477
type: object
466-
maxItems: 5
478+
maxItems: 32
467479
minItems: 1
468480
type: array
469481
x-kubernetes-list-map-keys:

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_machineconfignodes-SelfManagedHA-DevPreviewNoUpgrade.crd.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,18 +361,26 @@ spec:
361361
releases:
362362
description: |-
363363
releases is a list of the release bundles currently owned and managed by the
364-
cluster, indicating that their images can be safely pulled by any cluster entity
365-
requiring them.
366-
This field can contain between 1 and 5 entries.
364+
cluster.
365+
A release bundle content could be safely pulled only when its Conditions field
366+
contains at least an Available entry set to "True" and Degraded to "False".
367+
Entries must be unique, keyed on the name field.
368+
releases must contain at least one entry and must not exceed 32 entries.
367369
items:
368370
description: |-
369371
MachineConfigNodeStatusInternalReleaseImageRef is used to provide a more detailed reference for
370372
a release bundle.
371373
properties:
372374
conditions:
373375
description: |-
374-
conditions represent the observations of an internal release image current state. See InternalReleaseImageConditionType for the possible
375-
type values.
376+
conditions represent the observations of an internal release image current state. Valid types are:
377+
Mounted, Installing, Available, Removing and Degraded.
378+
379+
If Mounted is true, that means that a valid ISO has been mounted on the current node.
380+
If Installing is true, that means that a new release bundle is currently being copied on the current node, and not yet completed.
381+
If Available is true, it means that the release has been previously installed on the current node, and it can be used.
382+
If Removing is true, it means that a release deletion is in progress on the current node, and not yet completed.
383+
If Degraded is true, that means something has gone wrong in the current node.
376384
items:
377385
description: Condition contains details for one aspect
378386
of the current state of this API Resource.
@@ -441,6 +449,7 @@ spec:
441449
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
442450
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
443451
The length of the whole spec must be between 1 to 447 characters.
452+
The field is optional, and it will be provided after a release will be successfully installed.
444453
maxLength: 447
445454
minLength: 1
446455
type: string
@@ -453,17 +462,20 @@ spec:
453462
format, resembling a valid URL without the scheme
454463
rule: (self.split('@')[0].matches('^([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9-]+(:[0-9]{2,5})?/([a-zA-Z0-9-_]{0,61}/)?[a-zA-Z0-9-_.]*?$'))
455464
name:
456-
description: name indicates the desired release bundle identifier.
457-
This field is required and must be between 1 and 64 characters
458-
long.
465+
description: |-
466+
name indicates the desired release bundle identifier. This field is required and must be between 1 and 64 characters long.
467+
The expected name format is ocp-release-bundle-<version>-<arch|stream>.
459468
maxLength: 64
460469
minLength: 1
461470
type: string
471+
x-kubernetes-validations:
472+
- message: must be ocp-release-bundle-<version>-<arch|stream>
473+
and <= 64 chars
474+
rule: self.matches('^ocp-release-bundle-[0-9]+\\.[0-9]+\\.[0-9]+-[A-Za-z0-9_-]+$')
462475
required:
463-
- image
464476
- name
465477
type: object
466-
maxItems: 5
478+
maxItems: 32
467479
minItems: 1
468480
type: array
469481
x-kubernetes-list-map-keys:

0 commit comments

Comments
 (0)