Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,42 @@ tests:
osExtensionsImage: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e
expectedError: "spec.defaultStream must reference an existing stream name from status.availableStreams"

- name: Should reject removing spec.defaultStream once it has been set
initial: |
apiVersion: machineconfiguration.openshift.io/v1alpha1
kind: OSImageStream
metadata:
name: cluster
spec:
defaultStream: rhel-coreos
updated: |
apiVersion: machineconfiguration.openshift.io/v1alpha1
kind: OSImageStream
metadata:
name: cluster
spec: {}
expectedError: "spec.defaultStream cannot be removed once set"

- name: Should allow updating spec without defaultStream when it was never set
initial: |
apiVersion: machineconfiguration.openshift.io/v1alpha1
kind: OSImageStream
metadata:
name: cluster
spec: {}
updated: |
apiVersion: machineconfiguration.openshift.io/v1alpha1
kind: OSImageStream
metadata:
name: cluster
spec: {}
Copy link
Contributor

Choose a reason for hiding this comment

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

There isn't a sibling field apart from defaultStream right?

expected: |
apiVersion: machineconfiguration.openshift.io/v1alpha1
kind: OSImageStream
metadata:
name: cluster
spec: {}

- name: Should allow updating stale spec.defaultStream to a valid stream after forced upgrade
initial: |
apiVersion: machineconfiguration.openshift.io/v1alpha1
Expand Down
2 changes: 2 additions & 0 deletions machineconfiguration/v1alpha1/types_osimagestream.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type OSImageStreamStatus struct {
}

// OSImageStreamSpec defines the desired state of a OSImageStream.
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.defaultStream) || has(self.defaultStream)",message="spec.defaultStream cannot be removed once set"
type OSImageStreamSpec struct {
// defaultStream is the desired name of the stream that should be used as the
// default when no specific stream is requested by a MachineConfigPool.
Expand All @@ -94,6 +95,7 @@ type OSImageStreamSpec struct {
// valid value is accepted.
//
// When omitted, the operator determines the default stream automatically.
// Once set, this field cannot be removed.
//
// It must be a valid RFC 1123 subdomain between 1 and 253 characters in length,
// consisting of lowercase alphanumeric characters, hyphens ('-'), and periods ('.').
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ spec:
valid value is accepted.

When omitted, the operator determines the default stream automatically.
Once set, this field cannot be removed.

It must be a valid RFC 1123 subdomain between 1 and 253 characters in length,
consisting of lowercase alphanumeric characters, hyphens ('-'), and periods ('.').
Expand All @@ -83,6 +84,9 @@ spec:
character.
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
type: object
x-kubernetes-validations:
- message: spec.defaultStream cannot be removed once set
rule: '!has(oldSelf.defaultStream) || has(self.defaultStream)'
status:
description: |-
status describes the last observed state of this OSImageStream.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ spec:
valid value is accepted.

When omitted, the operator determines the default stream automatically.
Once set, this field cannot be removed.

It must be a valid RFC 1123 subdomain between 1 and 253 characters in length,
consisting of lowercase alphanumeric characters, hyphens ('-'), and periods ('.').
Expand All @@ -83,6 +84,9 @@ spec:
character.
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
type: object
x-kubernetes-validations:
- message: spec.defaultStream cannot be removed once set
rule: '!has(oldSelf.defaultStream) || has(self.defaultStream)'
status:
description: |-
status describes the last observed state of this OSImageStream.
Expand Down

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

2 changes: 1 addition & 1 deletion openapi/generated_openapi/zz_generated.openapi.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 @@ -71,6 +71,7 @@ spec:
valid value is accepted.

When omitted, the operator determines the default stream automatically.
Once set, this field cannot be removed.

It must be a valid RFC 1123 subdomain between 1 and 253 characters in length,
consisting of lowercase alphanumeric characters, hyphens ('-'), and periods ('.').
Expand All @@ -83,6 +84,9 @@ spec:
character.
rule: '!format.dns1123Subdomain().validate(self).hasValue()'
type: object
x-kubernetes-validations:
- message: spec.defaultStream cannot be removed once set
rule: '!has(oldSelf.defaultStream) || has(self.defaultStream)'
status:
description: |-
status describes the last observed state of this OSImageStream.
Expand Down