Skip to content

Commit 21badc0

Browse files
Fix review comments
- Add singleton documentation - Remove omitempty,omitzero from spec - Remove omitempty,omitzero from status - Add conditions list size documentation - Change MaxItems from 20 to 5 - Add struct godoc - Fix grammar: 'will be' changed to 'has been'
1 parent 582270b commit 21badc0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

machineconfiguration/v1/types_internalreleaseimage.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
// InternalReleaseImage is used to keep track and manage a set
2020
// of release bundles (OCP and OLM operators images) that are stored
2121
// into the control planes nodes.
22+
// This is a singleton resource with 'cluster' as the only valid name.
2223
//
2324
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
2425
// +openshift:compatibility-gen:level=1
@@ -32,11 +33,11 @@ type InternalReleaseImage struct {
3233

3334
// spec describes the configuration of this internal release image.
3435
// +required
35-
Spec InternalReleaseImageSpec `json:"spec,omitempty,omitzero"`
36+
Spec InternalReleaseImageSpec `json:"spec"`
3637

3738
// status describes the last observed state of this internal release image.
3839
// +optional
39-
Status InternalReleaseImageStatus `json:"status,omitempty,omitzero"`
40+
Status InternalReleaseImageStatus `json:"status"`
4041
}
4142

4243
// InternalReleaseImageSpec defines the desired state of a InternalReleaseImage.
@@ -70,10 +71,11 @@ type InternalReleaseImageStatus struct {
7071
// conditions represent the observations of the InternalReleaseImage controller current state.
7172
// Valid types are: Degraded.
7273
// If Degraded is true, that means something has gone wrong in the controller.
74+
// The conditions list must contain at most 5 entries.
7375
// +listType=map
7476
// +listMapKey=type
7577
// +kubebuilder:validation:MinItems=1
76-
// +kubebuilder:validation:MaxItems=20
78+
// +kubebuilder:validation:MaxItems=5
7779
// +optional
7880
Conditions []metav1.Condition `json:"conditions,omitempty"`
7981
// releases is a list of the release bundles currently owned and managed by the
@@ -99,6 +101,7 @@ const (
99101
InternalReleaseImageStatusConditionTypeDegraded InternalReleaseImageStatusConditionType = "Degraded"
100102
)
101103

104+
// InternalReleaseImageBundleStatus describes the observed state of a single release bundle managed by the cluster.
102105
type InternalReleaseImageBundleStatus struct {
103106
// conditions represent the observations of an internal release image current state. Valid types are:
104107
// Mounted, Installing, Available, Removing and Degraded.
@@ -129,7 +132,7 @@ type InternalReleaseImageBundleStatus struct {
129132
// The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
130133
// where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
131134
// The length of the whole spec must be between 1 to 447 characters.
132-
// The field is optional, and it will be provided after a release will be successfully installed.
135+
// The field is optional, and it will be provided after a release has been successfully installed.
133136
// +kubebuilder:validation:MinLength=1
134137
// +kubebuilder:validation:MaxLength=447
135138
// +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"

0 commit comments

Comments
 (0)