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 @@ -87,7 +87,7 @@ tests:
desiredUpdate:
architecture: Multi
expectedError: "Version must be set if Architecture is set"
- name: Should not allow image and architecture to be set
- name: Should allow image and architecture Multi to be set
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -97,7 +97,15 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should be able to create a ClusterVersion with base capability None, and additional capabilities baremetal and MachineAPI
initial: |
apiVersion: config.openshift.io/v1
Expand Down Expand Up @@ -211,7 +219,7 @@ tests:
- marketplace
expectedError: the `marketplace` capability requires the `OperatorLifecycleManager` capability, which is neither explicitly or implicitly enabled in this cluster, please enable the `OperatorLifecycleManager` capability
onUpdate:
- name: Should not allow image to be set if architecture set
- name: Should allow image to be set if architecture is Multi
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -229,8 +237,16 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
- name: Should not allow architecture to be set if image set
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should allow architecture Multi to be set if image set
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -247,7 +263,15 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should be able to add the baremetal capability with a ClusterVersion with base capability None, and implicitly enabled MachineAPI
initial: |
apiVersion: config.openshift.io/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tests:
desiredUpdate:
architecture: Multi
expectedError: "Version must be set if Architecture is set"
- name: Should not allow image and architecture to be set
- name: Should allow image and architecture Multi to be set
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -99,7 +99,15 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should be able to create a ClusterVersion with base capability None, and additional capabilities baremetal and MachineAPI
initial: |
apiVersion: config.openshift.io/v1
Expand Down Expand Up @@ -173,7 +181,7 @@ tests:
- marketplace
expectedError: the `marketplace` capability requires the `OperatorLifecycleManager` capability, which is neither explicitly or implicitly enabled in this cluster, please enable the `OperatorLifecycleManager` capability
onUpdate:
- name: Should not allow image to be set if architecture set
- name: Should allow image to be set if architecture is Multi
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -191,8 +199,16 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
- name: Should not allow architecture to be set if image set
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should allow architecture Multi to be set if image set
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -209,7 +225,15 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should be able to add the baremetal capability with a ClusterVersion with base capability None, and implicitly enabled MachineAPI
initial: |
apiVersion: config.openshift.io/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tests:
desiredUpdate:
architecture: Multi
expectedError: "Version must be set if Architecture is set"
- name: Should not allow image and architecture to be set
- name: Should allow image and architecture Multi to be set
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -99,7 +99,15 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should be able to create a ClusterVersion with base capability None, and additional capabilities baremetal and MachineAPI
initial: |
apiVersion: config.openshift.io/v1
Expand Down Expand Up @@ -267,7 +275,7 @@ tests:
clusterID: foo
signatureStores: []
onUpdate:
- name: Should not allow image to be set if architecture set
- name: Should allow image to be set if architecture is Multi
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -285,8 +293,16 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
- name: Should not allow architecture to be set if image set
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should allow architecture Multi to be set if image set
initial: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
Expand All @@ -303,7 +319,15 @@ tests:
architecture: Multi
version: 4.11.1
image: bar
expectedError: "cannot set both Architecture and Image"
expected: |
apiVersion: config.openshift.io/v1
kind: ClusterVersion
spec:
clusterID: foo
desiredUpdate:
architecture: Multi
version: 4.11.1
image: bar
- name: Should be able to add the baremetal capability with a ClusterVersion with base capability None, and implicitly enabled MachineAPI
initial: |
apiVersion: config.openshift.io/v1
Expand Down
8 changes: 4 additions & 4 deletions config/v1/types_cluster_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ type ComponentOverride struct {
type URL string

// Update represents an administrator update request.
// +kubebuilder:validation:XValidation:rule="has(self.architecture) && has(self.image) ? (self.architecture == \"\" || self.image == \"\") : true",message="cannot set both Architecture and Image"
// +kubebuilder:validation:XValidation:rule="has(self.architecture) && has(self.image) ? (self.architecture == \"\" || self.image == \"\" || self.architecture == \"Multi\") : true",message="cannot set both Architecture and Image unless Architecture is Multi"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
// +kubebuilder:validation:XValidation:rule="has(self.architecture) && self.architecture != \"\" ? self.version != \"\" : true",message="Version must be set if Architecture is set"
// +k8s:deepcopy-gen=true
type Update struct {
Expand All @@ -742,8 +742,8 @@ type Update struct {
// architecture means either a single architecture or a multi
// architecture. architecture can only be set to Multi thereby
// only allowing updates from single to multi architecture. If
// architecture is set, image cannot be set and version must be
// set.
// architecture is set, version must be set. image can be set only
// when architecture is Multi.
// Valid values are 'Multi' and empty.
//
// +optional
Expand All @@ -758,7 +758,7 @@ type Update struct {

// image is a container image location that contains the update.
// image should be used when the desired version does not exist in availableUpdates or history.
// When image is set, architecture cannot be specified.
// When image is set, architecture can be specified only as Multi.
// If both version and image are set, the version extracted from the referenced image must match the specified version.
//
// +optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ spec:
architecture means either a single architecture or a multi
architecture. architecture can only be set to Multi thereby
only allowing updates from single to multi architecture. If
architecture is set, image cannot be set and version must be
set.
architecture is set, version must be set. image can be set only
when architecture is Multi.
Valid values are 'Multi' and empty.
enum:
- Multi
Expand All @@ -217,7 +217,7 @@ spec:
description: |-
image is a container image location that contains the update.
image should be used when the desired version does not exist in availableUpdates or history.
When image is set, architecture cannot be specified.
When image is set, architecture can be specified only as Multi.
If both version and image are set, the version extracted from the referenced image must match the specified version.
type: string
mode:
Expand Down Expand Up @@ -245,9 +245,10 @@ spec:
type: string
type: object
x-kubernetes-validations:
- message: cannot set both Architecture and Image
- message: cannot set both Architecture and Image unless Architecture
is Multi
rule: 'has(self.architecture) && has(self.image) ? (self.architecture
== "" || self.image == "") : true'
== "" || self.image == "" || self.architecture == "Multi") : true'
- message: Version must be set if Architecture is set
rule: 'has(self.architecture) && self.architecture != "" ? self.version
!= "" : true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ spec:
architecture means either a single architecture or a multi
architecture. architecture can only be set to Multi thereby
only allowing updates from single to multi architecture. If
architecture is set, image cannot be set and version must be
set.
architecture is set, version must be set. image can be set only
when architecture is Multi.
Valid values are 'Multi' and empty.
enum:
- Multi
Expand All @@ -187,7 +187,7 @@ spec:
description: |-
image is a container image location that contains the update.
image should be used when the desired version does not exist in availableUpdates or history.
When image is set, architecture cannot be specified.
When image is set, architecture can be specified only as Multi.
If both version and image are set, the version extracted from the referenced image must match the specified version.
type: string
version:
Expand All @@ -198,9 +198,10 @@ spec:
type: string
type: object
x-kubernetes-validations:
- message: cannot set both Architecture and Image
- message: cannot set both Architecture and Image unless Architecture
is Multi
rule: 'has(self.architecture) && has(self.image) ? (self.architecture
== "" || self.image == "") : true'
== "" || self.image == "" || self.architecture == "Multi") : true'
- message: Version must be set if Architecture is set
rule: 'has(self.architecture) && self.architecture != "" ? self.version
!= "" : true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ spec:
architecture means either a single architecture or a multi
architecture. architecture can only be set to Multi thereby
only allowing updates from single to multi architecture. If
architecture is set, image cannot be set and version must be
set.
architecture is set, version must be set. image can be set only
when architecture is Multi.
Valid values are 'Multi' and empty.
enum:
- Multi
Expand All @@ -217,7 +217,7 @@ spec:
description: |-
image is a container image location that contains the update.
image should be used when the desired version does not exist in availableUpdates or history.
When image is set, architecture cannot be specified.
When image is set, architecture can be specified only as Multi.
If both version and image are set, the version extracted from the referenced image must match the specified version.
type: string
mode:
Expand Down Expand Up @@ -245,9 +245,10 @@ spec:
type: string
type: object
x-kubernetes-validations:
- message: cannot set both Architecture and Image
- message: cannot set both Architecture and Image unless Architecture
is Multi
rule: 'has(self.architecture) && has(self.image) ? (self.architecture
== "" || self.image == "") : true'
== "" || self.image == "" || self.architecture == "Multi") : true'
- message: Version must be set if Architecture is set
rule: 'has(self.architecture) && self.architecture != "" ? self.version
!= "" : true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ spec:
architecture means either a single architecture or a multi
architecture. architecture can only be set to Multi thereby
only allowing updates from single to multi architecture. If
architecture is set, image cannot be set and version must be
set.
architecture is set, version must be set. image can be set only
when architecture is Multi.
Valid values are 'Multi' and empty.
enum:
- Multi
Expand All @@ -187,7 +187,7 @@ spec:
description: |-
image is a container image location that contains the update.
image should be used when the desired version does not exist in availableUpdates or history.
When image is set, architecture cannot be specified.
When image is set, architecture can be specified only as Multi.
If both version and image are set, the version extracted from the referenced image must match the specified version.
type: string
version:
Expand All @@ -198,9 +198,10 @@ spec:
type: string
type: object
x-kubernetes-validations:
- message: cannot set both Architecture and Image
- message: cannot set both Architecture and Image unless Architecture
is Multi
rule: 'has(self.architecture) && has(self.image) ? (self.architecture
== "" || self.image == "") : true'
== "" || self.image == "" || self.architecture == "Multi") : true'
- message: Version must be set if Architecture is set
rule: 'has(self.architecture) && self.architecture != "" ? self.version
!= "" : true'
Expand Down
Loading