|
| 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 | +// +openshift:api-approved.openshift.io=https://github.com/openshift/api/pull/2198 |
| 13 | +// +openshift:file-pattern=cvoRunLevel=0000_80,operatorName=machine-config,operatorOrdering=01 |
| 14 | +// +openshift:enable:FeatureGate=PinnedImages |
| 15 | +// +kubebuilder:metadata:labels=openshift.io/operator-managed= |
| 16 | + |
| 17 | +// PinnedImageSet describes a set of images that should be pinned by CRI-O and |
| 18 | +// pulled to the nodes which are members of the declared MachineConfigPools. |
| 19 | +// |
| 20 | +// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). |
| 21 | +// +openshift:compatibility-gen:level=1 |
| 22 | +type PinnedImageSet struct { |
| 23 | + metav1.TypeMeta `json:",inline"` |
| 24 | + |
| 25 | + // metadata is the standard object metadata. |
| 26 | + // +optional |
| 27 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 28 | + |
| 29 | + // spec describes the configuration of this pinned image set. |
| 30 | + // +required |
| 31 | + Spec PinnedImageSetSpec `json:"spec"` |
| 32 | +} |
| 33 | + |
| 34 | +// PinnedImageSetSpec defines the desired state of a PinnedImageSet. |
| 35 | +type PinnedImageSetSpec struct { |
| 36 | + // pinnedImages is a list of OCI Image referenced by digest that should be |
| 37 | + // pinned and pre-loaded by the nodes of a MachineConfigPool. |
| 38 | + // Translates into a new file inside the /etc/crio/crio.conf.d directory |
| 39 | + // with content similar to this: |
| 40 | + // |
| 41 | + // pinned_images = [ |
| 42 | + // "quay.io/openshift-release-dev/ocp-release@sha256:...", |
| 43 | + // "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...", |
| 44 | + // "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:...", |
| 45 | + // ... |
| 46 | + // ] |
| 47 | + // |
| 48 | + // Image references must be by digest. |
| 49 | + // A maximum of 500 images may be specified. |
| 50 | + // +required |
| 51 | + // +kubebuilder:validation:MinItems=1 |
| 52 | + // +kubebuilder:validation:MaxItems=500 |
| 53 | + // +listType=map |
| 54 | + // +listMapKey=name |
| 55 | + PinnedImages []PinnedImageRef `json:"pinnedImages"` |
| 56 | +} |
| 57 | + |
| 58 | +// PinnedImageRef represents a reference to an OCI image |
| 59 | +type PinnedImageRef struct { |
| 60 | + // name is an OCI Image 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 | + // +required |
| 65 | + Name ImageDigestFormat `json:"name"` |
| 66 | +} |
| 67 | + |
| 68 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 69 | + |
| 70 | +// PinnedImageSetList is a list of PinnedImageSet resources |
| 71 | +// |
| 72 | +// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). |
| 73 | +// +openshift:compatibility-gen:level=1 |
| 74 | +type PinnedImageSetList struct { |
| 75 | + metav1.TypeMeta `json:",inline"` |
| 76 | + |
| 77 | + // metadata is the standard list metadata. |
| 78 | + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 79 | + // +optional |
| 80 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 81 | + |
| 82 | + // items contains a collection of PinnedImageSet resources. |
| 83 | + // +kubebuilder:validation:MaxItems=500 |
| 84 | + // +optional |
| 85 | + Items []PinnedImageSet `json:"items"` |
| 86 | +} |
0 commit comments