Skip to content

Commit

Permalink
OCPBUGS-39148: Add Feature Gate AND on NetworkLoadBalancer CEL
Browse files Browse the repository at this point in the history
Previously, the AWSNetworkLoadBalancerParameters struct had CEL that
referenced both Subnets and EIPAllocations, but only was gated on the
EIPAllocations feature gate. This means if the subnets feature gate was
ever disabled, then the IngressController CRD would be invalid because
the CEL would still be present, causing an error when installing the
CRD.

We are now able to add "AND" logic to the FeatureGateAwareXValidation
tag which enables us to feature gate the CEL on both Subnets and
EIPAllocations feature gates.
  • Loading branch information
gcs278 committed Jan 24, 2025
1 parent e8e07fa commit ab53306
Show file tree
Hide file tree
Showing 4 changed files with 3,228 additions and 41 deletions.
6 changes: 3 additions & 3 deletions operator/v1/types_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,9 @@ type AWSClassicLoadBalancerParameters struct {

// AWSNetworkLoadBalancerParameters holds configuration parameters for an
// AWS Network load balancer. For Example: Setting AWS EIPs https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html
// +openshift:validation:FeatureGateAwareXValidation:featureGate=SetEIPForNLBIngressController,rule=`has(self.subnets) && has(self.subnets.ids) && has(self.subnets.names) && has(self.eipAllocations) ? size(self.subnets.ids + self.subnets.names) == size(self.eipAllocations) : true`,message="number of subnets must be equal to number of eipAllocations"
// +openshift:validation:FeatureGateAwareXValidation:featureGate=SetEIPForNLBIngressController,rule=`has(self.subnets) && has(self.subnets.ids) && !has(self.subnets.names) && has(self.eipAllocations) ? size(self.subnets.ids) == size(self.eipAllocations) : true`,message="number of subnets must be equal to number of eipAllocations"
// +openshift:validation:FeatureGateAwareXValidation:featureGate=SetEIPForNLBIngressController,rule=`has(self.subnets) && has(self.subnets.names) && !has(self.subnets.ids) && has(self.eipAllocations) ? size(self.subnets.names) == size(self.eipAllocations) : true`,message="number of subnets must be equal to number of eipAllocations"
// +openshift:validation:FeatureGateAwareXValidation:requiredFeatureGate=SetEIPForNLBIngressController;IngressControllerLBSubnetsAWS,rule=`has(self.subnets) && has(self.subnets.ids) && has(self.subnets.names) && has(self.eipAllocations) ? size(self.subnets.ids + self.subnets.names) == size(self.eipAllocations) : true`,message="number of subnets must be equal to number of eipAllocations"
// +openshift:validation:FeatureGateAwareXValidation:requiredFeatureGate=SetEIPForNLBIngressController;IngressControllerLBSubnetsAWS,rule=`has(self.subnets) && has(self.subnets.ids) && !has(self.subnets.names) && has(self.eipAllocations) ? size(self.subnets.ids) == size(self.eipAllocations) : true`,message="number of subnets must be equal to number of eipAllocations"
// +openshift:validation:FeatureGateAwareXValidation:requiredFeatureGate=SetEIPForNLBIngressController;IngressControllerLBSubnetsAWS,rule=`has(self.subnets) && has(self.subnets.names) && !has(self.subnets.ids) && has(self.eipAllocations) ? size(self.subnets.names) == size(self.eipAllocations) : true`,message="number of subnets must be equal to number of eipAllocations"
type AWSNetworkLoadBalancerParameters struct {
// subnets specifies the subnets to which the load balancer will
// attach. The subnets may be specified by either their
Expand Down
1 change: 1 addition & 0 deletions operator/v1/zz_generated.featuregated-crd-manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ ingresscontrollers.operator.openshift.io:
FeatureGates:
- IngressControllerLBSubnetsAWS
- SetEIPForNLBIngressController
- SetEIPForNLBIngressController+IngressControllerLBSubnetsAWS
FilenameOperatorName: ingress
FilenameOperatorOrdering: "00"
FilenameRunLevel: "0000_50"
Expand Down
Loading

0 comments on commit ab53306

Please sign in to comment.