Skip to content

Commit 9eca225

Browse files
committed
machineconfiguration/v1alpha1: add InternalReleaseImage
1 parent 1517fca commit 9eca225

11 files changed

+1626
-0
lines changed

machineconfiguration/v1alpha1/register.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
2828
&MachineConfigNodeList{},
2929
&PinnedImageSet{},
3030
&PinnedImageSetList{},
31+
&InternalReleaseImage{},
3132
)
3233
metav1.AddToGroupVersion(scheme, GroupVersion)
3334
return nil
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
6+
machineosconfig "github.com/openshift/api/machineconfiguration/v1"
7+
)
8+
9+
// +genclient
10+
// +genclient:nonNamespaced
11+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
12+
// +kubebuilder:object:root=true
13+
// +kubebuilder:resource:path=internalreleaseimages,scope=Cluster
14+
// +kubebuilder:subresource:status
15+
// +openshift:file-pattern=cvoRunLevel=0000_80,operatorName=machine-config,operatorOrdering=01
16+
// +openshift:enable:FeatureGate=NoRegistryClusterOperations
17+
// +kubebuilder:metadata:labels=openshift.io/operator-managed=
18+
19+
// InternalReleaseImage is used to keep track and manage a set
20+
// of release bundles (OCP and OLM operators images) that are stored
21+
// into the control planes nodes.
22+
//
23+
// Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.
24+
// +openshift:compatibility-gen:level=4
25+
type InternalReleaseImage struct {
26+
metav1.TypeMeta `json:",inline"`
27+
metav1.ObjectMeta `json:"metadata,omitempty"`
28+
29+
// spec describes the configuration of this internal release image.
30+
// +required
31+
Spec InternalReleaseImageSpec `json:"spec"`
32+
33+
// status describes the last observed state of this internal release image.
34+
// +optional
35+
Status InternalReleaseImageStatus `json:"status"`
36+
}
37+
38+
// InternalReleaseImageStatus describes the current state of a InternalReleaseImage.
39+
type InternalReleaseImageStatus struct {
40+
// availableReleases is a list of release bundle identifiers currently detected
41+
// from the attached ISO.
42+
// +listType=map
43+
// +listMapKey=name
44+
// +optional
45+
AvailableReleases []InternalReleaseImageRef `json:"availableReleases"`
46+
47+
// releases is a list of the currently managed release bundles.
48+
// +listType=map
49+
// +listMapKey=name
50+
// +required
51+
Releases []InternalReleaseImageRef `json:"releases"`
52+
53+
// conditions represent the observations of an internal release image current state.
54+
// +listType=map
55+
// +listMapKey=type
56+
// +optional
57+
Conditions []metav1.Condition `json:"conditions,omitempty"`
58+
}
59+
60+
// InternalReleaseImageSpec defines the desired state of a InternalReleaseImage.
61+
type InternalReleaseImageSpec struct {
62+
// releases is a list of release bundle identifiers that the user wants to
63+
// add/remove to/from the control plane nodes.
64+
// +required
65+
// +kubebuilder:validation:MinItems=1
66+
// +kubebuilder:validation:MaxItems=20
67+
// +listType=map
68+
// +listMapKey=name
69+
Releases []InternalReleaseImageRef `json:"releases"`
70+
}
71+
72+
type InternalReleaseImageRef struct {
73+
// name indicates the desired release bundle identifier.
74+
// +required
75+
// +kubebuilder:validation:MinLength=1
76+
// +kubebuilder:validation:MaxLength=64
77+
Name string `json:"name"`
78+
79+
// image is an OCP release imaged referenced by digest.
80+
// The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
81+
// where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
82+
// The length of the whole spec must be between 1 to 447 characters.
83+
// +optional
84+
Image machineosconfig.ImageDigestFormat `json:"image"`
85+
}
86+
87+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
88+
89+
// InternalReleaseImageList is a list of InternalReleaseImage resources
90+
//
91+
// Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.
92+
// +openshift:compatibility-gen:level=4
93+
type InternalReleaseImageList struct {
94+
metav1.TypeMeta `json:",inline"`
95+
96+
// metadata is the standard list's metadata.
97+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
98+
metav1.ListMeta `json:"metadata"`
99+
100+
Items []InternalReleaseImage `json:"items"`
101+
}
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
api.openshift.io/merged-by-featuregates: "true"
6+
include.release.openshift.io/ibm-cloud-managed: "true"
7+
include.release.openshift.io/self-managed-high-availability: "true"
8+
release.openshift.io/feature-set: CustomNoUpgrade
9+
labels:
10+
openshift.io/operator-managed: ""
11+
name: internalreleaseimages.machineconfiguration.openshift.io
12+
spec:
13+
group: machineconfiguration.openshift.io
14+
names:
15+
kind: InternalReleaseImage
16+
listKind: InternalReleaseImageList
17+
plural: internalreleaseimages
18+
singular: internalreleaseimage
19+
scope: Cluster
20+
versions:
21+
- name: v1alpha1
22+
schema:
23+
openAPIV3Schema:
24+
description: |-
25+
InternalReleaseImage is used to keep track and manage a set
26+
of release bundles (OCP and OLM operators images) that are stored
27+
into the control planes nodes.
28+
29+
Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.
30+
properties:
31+
apiVersion:
32+
description: |-
33+
APIVersion defines the versioned schema of this representation of an object.
34+
Servers should convert recognized schemas to the latest internal value, and
35+
may reject unrecognized values.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
37+
type: string
38+
kind:
39+
description: |-
40+
Kind is a string value representing the REST resource this object represents.
41+
Servers may infer this from the endpoint the client submits requests to.
42+
Cannot be updated.
43+
In CamelCase.
44+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
45+
type: string
46+
metadata:
47+
type: object
48+
spec:
49+
description: spec describes the configuration of this internal release
50+
image.
51+
properties:
52+
releases:
53+
description: |-
54+
releases is a list of release bundle identifiers that the user wants to
55+
add/remove to/from the control plane nodes.
56+
items:
57+
properties:
58+
image:
59+
description: |-
60+
image is an OCP release imaged referenced by digest.
61+
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
62+
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
63+
The length of the whole spec must be between 1 to 447 characters.
64+
maxLength: 447
65+
minLength: 1
66+
type: string
67+
x-kubernetes-validations:
68+
- message: the OCI Image reference must end with a valid '@sha256:<digest>'
69+
suffix, where '<digest>' is 64 characters long
70+
rule: (self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$'))
71+
- message: the OCI Image name should follow the host[:port][/namespace]/name
72+
format, resembling a valid URL without the scheme
73+
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-_.]*?$'))
74+
name:
75+
description: name indicates the desired release bundle identifier.
76+
maxLength: 64
77+
minLength: 1
78+
type: string
79+
required:
80+
- name
81+
type: object
82+
maxItems: 20
83+
minItems: 1
84+
type: array
85+
x-kubernetes-list-map-keys:
86+
- name
87+
x-kubernetes-list-type: map
88+
required:
89+
- releases
90+
type: object
91+
status:
92+
description: status describes the last observed state of this internal
93+
release image.
94+
properties:
95+
availableReleases:
96+
description: |-
97+
availableReleases is a list of release bundle identifiers currently detected
98+
from the attached ISO.
99+
items:
100+
properties:
101+
image:
102+
description: |-
103+
image is an OCP release imaged referenced by digest.
104+
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
105+
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
106+
The length of the whole spec must be between 1 to 447 characters.
107+
maxLength: 447
108+
minLength: 1
109+
type: string
110+
x-kubernetes-validations:
111+
- message: the OCI Image reference must end with a valid '@sha256:<digest>'
112+
suffix, where '<digest>' is 64 characters long
113+
rule: (self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$'))
114+
- message: the OCI Image name should follow the host[:port][/namespace]/name
115+
format, resembling a valid URL without the scheme
116+
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-_.]*?$'))
117+
name:
118+
description: name indicates the desired release bundle identifier.
119+
maxLength: 64
120+
minLength: 1
121+
type: string
122+
required:
123+
- name
124+
type: object
125+
type: array
126+
x-kubernetes-list-map-keys:
127+
- name
128+
x-kubernetes-list-type: map
129+
conditions:
130+
description: conditions represent the observations of an internal
131+
release image current state.
132+
items:
133+
description: Condition contains details for one aspect of the current
134+
state of this API Resource.
135+
properties:
136+
lastTransitionTime:
137+
description: |-
138+
lastTransitionTime is the last time the condition transitioned from one status to another.
139+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
140+
format: date-time
141+
type: string
142+
message:
143+
description: |-
144+
message is a human readable message indicating details about the transition.
145+
This may be an empty string.
146+
maxLength: 32768
147+
type: string
148+
observedGeneration:
149+
description: |-
150+
observedGeneration represents the .metadata.generation that the condition was set based upon.
151+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
152+
with respect to the current state of the instance.
153+
format: int64
154+
minimum: 0
155+
type: integer
156+
reason:
157+
description: |-
158+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
159+
Producers of specific condition types may define expected values and meanings for this field,
160+
and whether the values are considered a guaranteed API.
161+
The value should be a CamelCase string.
162+
This field may not be empty.
163+
maxLength: 1024
164+
minLength: 1
165+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
166+
type: string
167+
status:
168+
description: status of the condition, one of True, False, Unknown.
169+
enum:
170+
- "True"
171+
- "False"
172+
- Unknown
173+
type: string
174+
type:
175+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
176+
maxLength: 316
177+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
178+
type: string
179+
required:
180+
- lastTransitionTime
181+
- message
182+
- reason
183+
- status
184+
- type
185+
type: object
186+
type: array
187+
x-kubernetes-list-map-keys:
188+
- type
189+
x-kubernetes-list-type: map
190+
releases:
191+
description: releases is a list of the currently managed release bundles.
192+
items:
193+
properties:
194+
image:
195+
description: |-
196+
image is an OCP release imaged referenced by digest.
197+
The format of the image pull spec is: host[:port][/namespace]/name@sha256:<digest>,
198+
where the digest must be 64 characters long, and consist only of lowercase hexadecimal characters, a-f and 0-9.
199+
The length of the whole spec must be between 1 to 447 characters.
200+
maxLength: 447
201+
minLength: 1
202+
type: string
203+
x-kubernetes-validations:
204+
- message: the OCI Image reference must end with a valid '@sha256:<digest>'
205+
suffix, where '<digest>' is 64 characters long
206+
rule: (self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$'))
207+
- message: the OCI Image name should follow the host[:port][/namespace]/name
208+
format, resembling a valid URL without the scheme
209+
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-_.]*?$'))
210+
name:
211+
description: name indicates the desired release bundle identifier.
212+
maxLength: 64
213+
minLength: 1
214+
type: string
215+
required:
216+
- name
217+
type: object
218+
type: array
219+
x-kubernetes-list-map-keys:
220+
- name
221+
x-kubernetes-list-type: map
222+
required:
223+
- releases
224+
type: object
225+
required:
226+
- spec
227+
type: object
228+
served: true
229+
storage: true
230+
subresources:
231+
status: {}

0 commit comments

Comments
 (0)