Skip to content
Merged
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
3 changes: 3 additions & 0 deletions machineconfiguration/v1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.PHONY: test
test:
make -C ../../tests test GINKGO_EXTRA_ARGS=--focus="machineconfiguration.openshift.io/v1"
27 changes: 27 additions & 0 deletions machineconfiguration/v1/custom.machineconfigpool.testsuite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[Custom] MachineConfigPool"
crd: 0000_80_machine-config_01_machineconfigpools-CustomNoUpgrade.crd.yaml
tests:
onCreate:
- name: Should be able to create a minimal MachineConfigPool
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
spec: {} # No spec is required for a MachineConfigPool
expected: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
spec: {}
- name: Should be able to add a PinnedImageSet
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
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_machine-config_01_machineconfigpools.crd.yaml
name: "[Default] MachineConfigPool"
crd: 0000_80_machine-config_01_machineconfigpools-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,27 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[TechPreview] MachineConfigPool"
crd: 0000_80_machine-config_01_machineconfigpools-TechPreviewNoUpgrade.crd.yaml
tests:
onCreate:
- name: Should be able to create a minimal MachineConfigPool
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
spec: {} # No spec is required for a MachineConfigPool
expected: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
spec: {}
- name: Should be able to add a PinnedImageSet
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
Loading