Skip to content

Commit 63bf18d

Browse files
committed
machineconfiguration/v1alpha1: add InternalReleaseImage
1 parent 44baf88 commit 63bf18d

File tree

34 files changed

+7427
-8
lines changed

34 files changed

+7427
-8
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "[TechPreview] InternalReleaseImage"
3+
crdName: machineconfignodes.machineconfiguration.openshift.io
4+
featureGates:
5+
- MachineConfigNodes
6+
- NoRegistryClusterOperations
7+
tests:
8+
onUpdate:
9+
- name: Should be able to update a MachineConfigNode with a minimal internalReleaseImage status field.
10+
initial: |
11+
apiVersion: machineconfiguration.openshift.io/v1
12+
kind: MachineConfigNode
13+
metadata:
14+
name: foobar
15+
spec:
16+
node:
17+
name: foobar
18+
pool:
19+
name: master
20+
configVersion:
21+
desired: rendered-master-abc
22+
updated: |
23+
apiVersion: machineconfiguration.openshift.io/v1
24+
kind: MachineConfigNode
25+
metadata:
26+
name: foobar
27+
spec:
28+
node:
29+
name: foobar
30+
pool:
31+
name: master
32+
configVersion:
33+
desired: rendered-master-abc
34+
status:
35+
internalReleaseImage:
36+
installedReleases:
37+
- name: ocp-release-bundle-4.18.0-x86_64
38+
image: example.com/example/openshift-release-dev@sha256:d98795f7932441b30bb8bcfbbf05912875383fad1f2b3be08a22ec148d68607f
39+
expected: |
40+
apiVersion: machineconfiguration.openshift.io/v1
41+
kind: MachineConfigNode
42+
metadata:
43+
name: foobar
44+
spec:
45+
node:
46+
name: foobar
47+
pool:
48+
name: master
49+
configVersion:
50+
desired: rendered-master-abc
51+
status:
52+
internalReleaseImage:
53+
installedReleases:
54+
- name: ocp-release-bundle-4.18.0-x86_64
55+
image: example.com/example/openshift-release-dev@sha256:d98795f7932441b30bb8bcfbbf05912875383fad1f2b3be08a22ec148d68607f

machineconfiguration/v1/types_machineconfignode.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,80 @@ type MachineConfigNodeStatus struct {
158158
// +kubebuilder:validation:MaxItems=32
159159
// +optional
160160
IrreconcilableChanges []IrreconcilableChangeDiff `json:"irreconcilableChanges,omitempty"`
161+
// internalReleaseImage describes the status of the release payloads stored in the node.
162+
// When specified, an internalReleaseImage custom resource exists on the cluster, and the specified images will be made available on the control plane nodes.
163+
// This field will reflect the actual on-disk state of those release images.
164+
// +openshift:enable:FeatureGate=NoRegistryClusterOperations
165+
// +optional
166+
InternalReleaseImage *MachineConfigNodeStatusInternalReleaseImage `json:"internalReleaseImage,omitempty"`
167+
}
168+
169+
// MachineConfigNodeStatusInternalReleaseImage holds information about the current and discovered release bundles for the observed machine
170+
// config node.
171+
type MachineConfigNodeStatusInternalReleaseImage struct {
172+
// conditions represent the observations of an internal release image current state.
173+
// +listType=map
174+
// +listMapKey=type
175+
// +kubebuilder:validation:MinItems=1
176+
// +kubebuilder:validation:MaxItems=256
177+
// +optional
178+
Conditions []metav1.Condition `json:"conditions,omitempty"`
179+
180+
// availableReleases is a list of release bundle identifiers currently detected
181+
// from the ISO attached to one of the control plane nodes. Any reported identifier can
182+
// be used to amend the `spec.Releases` field to add a new release bundle to the cluster.
183+
// An empty value indicates that no ISOs are currently being detected on any control plane
184+
// node.
185+
// Must not exceed 5 entries.
186+
// +listType=map
187+
// +listMapKey=name
188+
// +kubebuilder:validation:MaxItems=5
189+
// +optional
190+
AvailableReleases []MachineConfigNodeStatusInternalReleaseImageRef `json:"availableReleases,omitempty"`
191+
192+
// installedReleases is a list of the release bundles currently owned and managed by the
193+
// cluster, indicating that their images can be safely pulled by any cluster entity
194+
// requiring them.
195+
// This field can contain between 1 and 5 entries.
196+
// +listType=map
197+
// +listMapKey=name
198+
// +kubebuilder:validation:MinItems=1
199+
// +kubebuilder:validation:MaxItems=5
200+
// +optional
201+
InstalledReleases []MachineConfigNodeStatusInternalReleaseImageDetailedRef `json:"installedReleases,omitempty"`
202+
}
203+
204+
// MachineConfigNodeStatusInternalReleaseImageRef is used to provide a simple reference for a release
205+
// bundle. Currently it contains only the name field.
206+
// +openshift:enable:FeatureGate=NoRegistryClusterOperations
207+
type MachineConfigNodeStatusInternalReleaseImageRef struct {
208+
// name indicates the desired release bundle identifier. This field is required and must be between 1 and 64 characters long.
209+
// +required
210+
// +kubebuilder:validation:MinLength=1
211+
// +kubebuilder:validation:MaxLength=64
212+
Name string `json:"name,omitempty"`
213+
}
214+
215+
// MachineConfigNodeStatusInternalReleaseImageDetailedRef is used to provide a more detailed reference for
216+
// a release bundle.
217+
// +openshift:enable:FeatureGate=NoRegistryClusterOperations
218+
type MachineConfigNodeStatusInternalReleaseImageDetailedRef struct {
219+
// name indicates the desired release bundle identifier. This field is required and must be between 1 and 64 characters long.
220+
// +kubebuilder:validation:MinLength=1
221+
// +kubebuilder:validation:MaxLength=64
222+
// +required
223+
Name string `json:"name,omitempty"`
224+
225+
// image is an OCP release image referenced by digest.
226+
// The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
227+
// where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
228+
// The length of the whole spec must be between 1 to 447 characters.
229+
// +kubebuilder:validation:MinLength=1
230+
// +kubebuilder:validation:MaxLength=447
231+
// +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"
232+
// +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"
233+
// +required
234+
Image string `json:"image,omitempty"`
161235
}
162236

163237
// IrreconcilableChangeDiff holds an individual diff between the initial install-time MachineConfig

0 commit comments

Comments
 (0)