Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions machineconfiguration/v1/custom.machineconfigpool.testsuite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[Custom] MachineConfigPool"
crd: 0000_80_machineconfigpool-TechPreviewNoUpgrade.crd.yaml
tests:
onCreate:
- name: Should be able to create a minimal MachineConfigPool
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
spec:
pinnedImageSets:
- name: test-pinnedimageset
Comment on lines +11 to +12
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a required field is it? Generally the minimal version of this test shows only required fields

Copy link
Copy Markdown
Contributor Author

@hexfusion hexfusion Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok gotcha so I can add an additional test to show this. Will update

expected: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
spec:
pinnedImageSets:
- name: test-pinnedimageset
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[Stable] MachineConfigPool"
crd: 0000_80_machineconfigpool.crd.yaml
name: "[Default] MachineConfigPool"
crd: 0000_80_machineconfigpool-Default.crd.yaml
tests:
onCreate:
- name: Should be able to create a minimal MachineConfigPool
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[TechPreview] MachineConfigPool"
crd: 0000_80_machineconfigpool-TechPreviewNoUpgrade.crd.yaml
tests:
onCreate:
- name: Should be able to create a minimal MachineConfigPool
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
spec:
pinnedImageSets:
- name: test-pinnedimageset
expected: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
spec:
pinnedImageSets:
- name: test-pinnedimageset
38 changes: 38 additions & 0 deletions machineconfiguration/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,44 @@ type MachineConfigPoolSpec struct {
// The targeted MachineConfig object for the machine config pool.
// +optional
Configuration MachineConfigPoolStatusConfiguration `json:"configuration"`

// pinnedImageSets specifies a sequence of PinnedImageSetRef objects for the
// pool. Nodes within this pool will preload and pin images defined in the
// PinnedImageSet. Before pulling images the MachineConfigDaemon will ensure
// the total uncompressed size of all the images does not exceed available
// resources. If the total size of the images exceeds the available
// resources the controller will report a Degraded status to the
// MachineConfigPool and not attempt to pull any images. Also to help ensure
// the kubelet can mitigate storage risk, the pinned_image configuration and
// subsequent service reload will happen only after all of the images have
// been pulled for each set. Images from multiple PinnedImageSets are loaded
// and pinned sequentially as listed. Duplicate and existing images will be
// skipped.
//
// Any failure to prefetch or pin images will result in a Degraded pool.
// Resolving these failures is the responsibility of the user. The admin
// should be proactive in ensuring adequate storage and proper image
// authentication exists in advance.
// +openshift:enable:FeatureGate=PinnedImages
// +optional
// +listType=map
// +listMapKey=name
PinnedImageSets []PinnedImageSetRef `json:"pinnedImageSets,omitempty"`
}

type PinnedImageSetRef struct {
// name is a reference to the name of a PinnedImageSet. Must adhere to
// RFC-1123 (https://tools.ietf.org/html/rfc1123).
// Made up of one of more period-separated (.) segments, where each segment
// consists of alphanumeric characters and hyphens (-), must begin and end
// with an alphanumeric character, and is at most 63 characters in length.
// The total length of the name must not exceed 253 characters.
// +openshift:enable:FeatureGate=PinnedImages
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$`
// +kubebuilder:validation:Required
Name string `json:"name"`
}

// MachineConfigPoolStatus is the status for MachineConfigPool resource.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
release.openshift.io/feature-set: Default
labels:
openshift.io/operator-managed: ""
name: machineconfigpools.machineconfiguration.openshift.io
Expand Down

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions machineconfiguration/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ machineconfigpools.machineconfiguration.openshift.io:
CRDName: machineconfigpools.machineconfiguration.openshift.io
Capability: ""
Category: ""
FeatureGates: []
FeatureGates:
- PinnedImages
GroupName: machineconfiguration.openshift.io
HasStatus: true
KindName: MachineConfigPool
Expand Down
Loading