Skip to content

Commit

Permalink
add validation for mutually exclusive fields
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Aug 16, 2023
1 parent 0ebf03f commit fa4aaf9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ spec:
networkType:
description: networkType is the target type of network migration. Set this to the target network type to allow changing the default network. If unset, the operation of changing cluster default network plugin will be rejected. The supported values are OpenShiftSDN, OVNKubernetes
type: string
x-kubernetes-validations:
- rule: '!has(self.mtu) || !has(self.mode) || self.mode == ”'
message: migration mode may not be configured at the same time as an mtu migration
observedConfig:
description: observedConfig holds a sparse config that controller has observed from the cluster state. It exists in spec because it is an input to the level for the operator
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ spec:
networkType:
description: networkType is the target type of network migration. Set this to the target network type to allow changing the default network. If unset, the operation of changing cluster default network plugin will be rejected. The supported values are OpenShiftSDN, OVNKubernetes
type: string
x-kubernetes-validations:
- rule: '!has(self.mtu) || !has(self.mode) || self.mode == ”'
message: migration mode may not be configured at the same time as an mtu migration
observedConfig:
description: observedConfig holds a sparse config that controller has observed from the cluster state. It exists in spec because it is an input to the level for the operator
type: object
Expand Down
1 change: 1 addition & 0 deletions operator/v1/types_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const (
)

// NetworkMigration represents the cluster network configuration.
// +openshift:validation:FeatureSetAwareXValidation:featureSet=CustomNoUpgrade;TechPreviewNoUpgrade,rule="!has(self.mtu) || !has(self.mode) || self.mode == ”",message="migration mode may not be configured at the same time as an mtu migration"
type NetworkMigration struct {
// networkType is the target type of network migration. Set this to the
// target network type to allow changing the default network. If unset, the
Expand Down

0 comments on commit fa4aaf9

Please sign in to comment.