Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Paolinelli <[email protected]>
  • Loading branch information
fedepaol committed Nov 19, 2024
1 parent 55839fb commit 4b0817f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion operator/v1/types_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type NetworkList struct {

// NetworkSpec is the top-level network configuration object.
// +kubebuilder:validation:XValidation:rule="!has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig) || !has(self.defaultNetwork.ovnKubernetesConfig.gatewayConfig) || !has(self.defaultNetwork.ovnKubernetesConfig.gatewayConfig.ipForwarding) || self.defaultNetwork.ovnKubernetesConfig.gatewayConfig.ipForwarding == oldSelf.defaultNetwork.ovnKubernetesConfig.gatewayConfig.ipForwarding || self.defaultNetwork.ovnKubernetesConfig.gatewayConfig.ipForwarding == 'Restricted' || self.defaultNetwork.ovnKubernetesConfig.gatewayConfig.ipForwarding == 'Global'",message="invalid value for IPForwarding, valid values are 'Restricted' or 'Global'"
// +openshift:validation:FeatureGateAwareXValidation:featureGate=RouteAdvertisements,requiredFeatureGate=RouteAdvertisements;AdditionalRoutingCapabilities,rule="(has(self.additionalRoutingCapabilities) && ('FRR' in self.additionalRoutingCapabilities.providers)) || !has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig) || !has(self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements) || self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements != 'Enabled'",message="Route advertisements cannot be Enabled if 'FRR' routing capability provider is not available"
// +openshift:validation:FeatureGateAwareXValidation:featureGate=RouteAdvertisements,rule="(has(self.additionalRoutingCapabilities) && ('FRR' in self.additionalRoutingCapabilities.providers)) || !has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig) || !has(self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements) || self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements != 'Enabled'",message="Route advertisements cannot be Enabled if 'FRR' routing capability provider is not available"
type NetworkSpec struct {
OperatorSpec `json:",inline"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,13 @@ spec:
type: boolean
type: object
x-kubernetes-validations:
- message: Route advertisements cannot be Enabled if 'FRR' routing capability
provider is not available
rule: (has(self.additionalRoutingCapabilities) && ('FRR' in self.additionalRoutingCapabilities.providers))
|| !has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig)
|| !has(self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements)
|| self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements !=
'Enabled'
- message: invalid value for IPForwarding, valid values are 'Restricted'
or 'Global'
rule: '!has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,13 @@ spec:
type: boolean
type: object
x-kubernetes-validations:
- message: Route advertisements cannot be Enabled if 'FRR' routing capability
provider is not available
rule: (has(self.additionalRoutingCapabilities) && ('FRR' in self.additionalRoutingCapabilities.providers))
|| !has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig)
|| !has(self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements)
|| self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements !=
'Enabled'
- message: invalid value for IPForwarding, valid values are 'Restricted'
or 'Global'
rule: '!has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,13 @@ spec:
type: boolean
type: object
x-kubernetes-validations:
- message: Route advertisements cannot be Enabled if 'FRR' routing capability
provider is not available
rule: (has(self.additionalRoutingCapabilities) && ('FRR' in self.additionalRoutingCapabilities.providers))
|| !has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig)
|| !has(self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements)
|| self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements !=
'Enabled'
- message: invalid value for IPForwarding, valid values are 'Restricted'
or 'Global'
rule: '!has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,13 @@ spec:
type: boolean
type: object
x-kubernetes-validations:
- message: Route advertisements cannot be Enabled if 'FRR' routing capability
provider is not available
rule: (has(self.additionalRoutingCapabilities) && ('FRR' in self.additionalRoutingCapabilities.providers))
|| !has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig)
|| !has(self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements)
|| self.defaultNetwork.ovnKubernetesConfig.routeAdvertisements !=
'Enabled'
- message: invalid value for IPForwarding, valid values are 'Restricted'
or 'Global'
rule: '!has(self.defaultNetwork) || !has(self.defaultNetwork.ovnKubernetesConfig)
Expand Down

0 comments on commit 4b0817f

Please sign in to comment.