Skip to content

Commit 52339fa

Browse files
committed
pis to v1
1 parent bf3f3e9 commit 52339fa

8 files changed

+967
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package v1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
// +genclient
8+
// +genclient:nonNamespaced
9+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
10+
// +kubebuilder:object:root=true
11+
// +kubebuilder:resource:path=pinnedimagesets,scope=Cluster
12+
// +kubebuilder:subresource:status
13+
// +openshift:api-approved.openshift.io=https://github.com/openshift/api/pull/<change to PR>
14+
// +openshift:file-pattern=cvoRunLevel=0000_80,operatorName=machine-config,operatorOrdering=01
15+
// +openshift:enable:FeatureGate=PinnedImages
16+
// +kubebuilder:metadata:labels=openshift.io/operator-managed=
17+
18+
// PinnedImageSet describes a set of images that should be pinned by CRI-O and
19+
// pulled to the nodes which are members of the declared MachineConfigPools.
20+
//
21+
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
22+
// +openshift:compatibility-gen:level=1
23+
type PinnedImageSet struct {
24+
metav1.TypeMeta `json:",inline"`
25+
26+
// metadata is the standard object metadata.
27+
// +optional
28+
metav1.ObjectMeta `json:"metadata,omitempty"`
29+
30+
// spec describes the configuration of this pinned image set.
31+
// +required
32+
Spec PinnedImageSetSpec `json:"spec"`
33+
34+
// status describes the last observed state of this pinned image set.
35+
// +optional
36+
Status PinnedImageSetStatus `json:"status,omitempty"`
37+
}
38+
39+
// PinnedImageSetStatus describes the current state of a PinnedImageSet.
40+
type PinnedImageSetStatus struct {
41+
// conditions represent the observations of a pinned image set's current state.
42+
// +patchMergeKey=type
43+
// +patchStrategy=merge
44+
// +listType=map
45+
// +listMapKey=type
46+
// +optional
47+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
48+
}
49+
50+
// PinnedImageSetSpec defines the desired state of a PinnedImageSet.
51+
type PinnedImageSetSpec struct {
52+
// pinnedImages is a list of OCI Image referenced by digest that should be
53+
// pinned and pre-loaded by the nodes of a MachineConfigPool.
54+
// Translates into a new file inside the /etc/crio/crio.conf.d directory
55+
// with content similar to this:
56+
//
57+
// pinned_images = [
58+
// "quay.io/openshift-release-dev/ocp-release@sha256:...",
59+
// "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
60+
// "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
61+
// ...
62+
// ]
63+
//
64+
// These image references should all be by digest, tags aren't allowed.
65+
// +required
66+
// +kubebuilder:validation:MinItems=1
67+
// +kubebuilder:validation:MaxItems=500
68+
// +listType=map
69+
// +listMapKey=name
70+
PinnedImages []PinnedImageRef `json:"pinnedImages"`
71+
}
72+
73+
type PinnedImageRef struct {
74+
// name is an OCI Image referenced by digest.
75+
//
76+
// The format of the image ref is:
77+
// host[:port][/namespace]/name@sha256:<digest>
78+
// +required
79+
// +kubebuilder:validation:MinLength=1
80+
// +kubebuilder:validation:MaxLength=447
81+
// +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"
82+
// +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"
83+
Name string `json:"name"`
84+
}
85+
86+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
87+
88+
// PinnedImageSetList is a list of PinnedImageSet resources
89+
//
90+
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
91+
// +openshift:compatibility-gen:level=1
92+
type PinnedImageSetList struct {
93+
metav1.TypeMeta `json:",inline"`
94+
95+
// metadata is the standard list metadata.
96+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
97+
// +optional
98+
metav1.ListMeta `json:"metadata,omitempty"`
99+
100+
// items contains a collection of PinnedImageSet resources.
101+
// +optional
102+
Items []PinnedImageSet `json:"items"`
103+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
api-approved.openshift.io: https://github.com/openshift/api/pull/<change to PR>
6+
api.openshift.io/merged-by-featuregates: "true"
7+
include.release.openshift.io/ibm-cloud-managed: "true"
8+
include.release.openshift.io/self-managed-high-availability: "true"
9+
release.openshift.io/feature-set: CustomNoUpgrade
10+
labels:
11+
openshift.io/operator-managed: ""
12+
name: pinnedimagesets.machineconfiguration.openshift.io
13+
spec:
14+
group: machineconfiguration.openshift.io
15+
names:
16+
kind: PinnedImageSet
17+
listKind: PinnedImageSetList
18+
plural: pinnedimagesets
19+
singular: pinnedimageset
20+
scope: Cluster
21+
versions:
22+
- name: v1
23+
schema:
24+
openAPIV3Schema:
25+
description: |-
26+
PinnedImageSet describes a set of images that should be pinned by CRI-O and
27+
pulled to the nodes which are members of the declared MachineConfigPools.
28+
29+
Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
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 pinned image set.
50+
properties:
51+
pinnedImages:
52+
description: |-
53+
pinnedImages is a list of OCI Image referenced by digest that should be
54+
pinned and pre-loaded by the nodes of a MachineConfigPool.
55+
Translates into a new file inside the /etc/crio/crio.conf.d directory
56+
with content similar to this:
57+
58+
pinned_images = [
59+
"quay.io/openshift-release-dev/ocp-release@sha256:...",
60+
"quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
61+
"quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...",
62+
...
63+
]
64+
65+
These image references should all be by digest, tags aren't allowed.
66+
items:
67+
properties:
68+
name:
69+
description: |-
70+
name is an OCI Image referenced by digest.
71+
72+
The format of the image ref is:
73+
host[:port][/namespace]/name@sha256:<digest>
74+
maxLength: 447
75+
minLength: 1
76+
type: string
77+
x-kubernetes-validations:
78+
- message: the OCI Image reference must end with a valid '@sha256:<digest>'
79+
suffix, where '<digest>' is 64 characters long
80+
rule: self.split('@').size() == 2 && self.split('@')[1].matches('^sha256:[a-f0-9]{64}$')
81+
- message: the OCI Image name should follow the host[:port][/namespace]/name
82+
format, resembling a valid URL without the scheme
83+
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-_.]*?$')
84+
required:
85+
- name
86+
type: object
87+
maxItems: 500
88+
minItems: 1
89+
type: array
90+
x-kubernetes-list-map-keys:
91+
- name
92+
x-kubernetes-list-type: map
93+
required:
94+
- pinnedImages
95+
type: object
96+
status:
97+
description: status describes the last observed state of this pinned image
98+
set.
99+
properties:
100+
conditions:
101+
description: conditions represent the observations of a pinned image
102+
set's current state.
103+
items:
104+
description: Condition contains details for one aspect of the current
105+
state of this API Resource.
106+
properties:
107+
lastTransitionTime:
108+
description: |-
109+
lastTransitionTime is the last time the condition transitioned from one status to another.
110+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
111+
format: date-time
112+
type: string
113+
message:
114+
description: |-
115+
message is a human readable message indicating details about the transition.
116+
This may be an empty string.
117+
maxLength: 32768
118+
type: string
119+
observedGeneration:
120+
description: |-
121+
observedGeneration represents the .metadata.generation that the condition was set based upon.
122+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
123+
with respect to the current state of the instance.
124+
format: int64
125+
minimum: 0
126+
type: integer
127+
reason:
128+
description: |-
129+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
130+
Producers of specific condition types may define expected values and meanings for this field,
131+
and whether the values are considered a guaranteed API.
132+
The value should be a CamelCase string.
133+
This field may not be empty.
134+
maxLength: 1024
135+
minLength: 1
136+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
137+
type: string
138+
status:
139+
description: status of the condition, one of True, False, Unknown.
140+
enum:
141+
- "True"
142+
- "False"
143+
- Unknown
144+
type: string
145+
type:
146+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
147+
maxLength: 316
148+
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])$
149+
type: string
150+
required:
151+
- lastTransitionTime
152+
- message
153+
- reason
154+
- status
155+
- type
156+
type: object
157+
type: array
158+
x-kubernetes-list-map-keys:
159+
- type
160+
x-kubernetes-list-type: map
161+
type: object
162+
required:
163+
- spec
164+
type: object
165+
served: true
166+
storage: true
167+
subresources:
168+
status: {}

0 commit comments

Comments
 (0)