Skip to content

Commit

Permalink
NE-1516: Adds a field in the cluster ingress config object and Ingres…
Browse files Browse the repository at this point in the history
…s Controller to set EIP via installer and Ingress Controller

`config/v1/types_ingress.go` - Adds an API field `eip-allocations` in the cluster ingress config object whose value is set by the installer using install-config.yaml
`operator/v1/types_ingress.go` - Adds an API field `eip-allocations` in the Ingress Controller CR object using which the Ingress Operator scales an Ingress Controller
with service type balancer whose annotation `service.beta.kubernetes.io/aws-load-balancer-eip-allocations` is set by the value of the field `eip-allocations` of the Ingress Controller.
Epic: https://issues.redhat.com/browse/NE-1274
Story: https://issues.redhat.com/browse/NE-1516
  • Loading branch information
miheer committed Mar 30, 2024
1 parent f28a8dc commit 41914f9
Show file tree
Hide file tree
Showing 24 changed files with 3,078 additions and 10 deletions.
7 changes: 7 additions & 0 deletions config/v1/feature_gates.go
Expand Up @@ -206,6 +206,13 @@ var (
enableIn(TechPreviewNoUpgrade).
mustRegister()

FeatureGateSetEIPForNLBIngressController = newFeatureGate("SetEIPForNLBIngressController").
reportProblemsToJiraComponent("Routing").
contactPerson("miheer").
productScope(ocpSpecific).
enableIn(TechPreviewNoUpgrade).
mustRegister()

FeatureGateOpenShiftPodSecurityAdmission = newFeatureGate("OpenShiftPodSecurityAdmission").
reportProblemsToJiraComponent("auth").
contactPerson("stlaz").
Expand Down
Empty file.
16 changes: 16 additions & 0 deletions config/v1/types_ingress.go
Expand Up @@ -130,6 +130,7 @@ type LoadBalancer struct {

// AWSIngressSpec holds the desired state of the Ingress for Amazon Web Services infrastructure provider.
// This only includes fields that can be modified in the cluster.
// +kubebuilder:validation:XValidation:rule="self.type != 'Classic' && !has(self.networkLoadBalancer)",message="Network load balancer parameters are allowed only when load balancer type is NLB."
// +union
type AWSIngressSpec struct {
// type allows user to set a load balancer type.
Expand All @@ -151,8 +152,23 @@ type AWSIngressSpec struct {
// +kubebuilder:validation:Enum:=NLB;Classic
// +kubebuilder:validation:Required
Type AWSLBType `json:"type,omitempty"`

// networkLoadBalancerParameters holds configuration parameters for an AWS
// network load balancer. Present only if type is NLB.
//
// +optional
NetworkLoadBalancerParameters *AWSNetworkLoadBalancerParameters `json:"networkLoadBalancer,omitempty"`
}

// AWSNetworkLoadBalancerParameters holds configuration parameters for an
// AWS Network load balancer.
// +openshift:enable:FeatureGate=SetEIPForNLBIngressController
type AWSNetworkLoadBalancerParameters struct {
EIPAllocations []EIPAllocations `json:"eip-allocations,omitempty"`
}

type EIPAllocations string

type AWSLBType string

const (
Expand Down
Expand Up @@ -133,6 +133,16 @@ spec:
description: aws contains settings specific to the Amazon
Web Services infrastructure provider.
properties:
networkLoadBalancer:
description: networkLoadBalancerParameters holds configuration
parameters for an AWS network load balancer. Present
only if type is NLB.
properties:
eip-allocations:
items:
type: string
type: array
type: object
type:
description: "type allows user to set a load balancer
type. When this field is set the default ingresscontroller
Expand All @@ -153,6 +163,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: Network load balancer parameters are allowed only
when load balancer type is NLB.
rule: self.type != 'Classic' && !has(self.networkLoadBalancer)
type:
description: type is the underlying infrastructure provider
for the cluster. Allowed values are "AWS", "Azure", "BareMetal",
Expand Down
28 changes: 27 additions & 1 deletion config/v1/zz_generated.deepcopy.go

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

3 changes: 2 additions & 1 deletion config/v1/zz_generated.featuregated-crd-manifests.yaml
Expand Up @@ -323,7 +323,8 @@ ingresses.config.openshift.io:
CRDName: ingresses.config.openshift.io
Capability: ""
Category: ""
FeatureGates: []
FeatureGates:
- SetEIPForNLBIngressController
FilenameOperatorName: config-operator
FilenameOperatorOrdering: "01"
FilenameRunLevel: "0000_10"
Expand Down
Expand Up @@ -134,6 +134,16 @@ spec:
description: aws contains settings specific to the Amazon
Web Services infrastructure provider.
properties:
networkLoadBalancer:
description: networkLoadBalancerParameters holds configuration
parameters for an AWS network load balancer. Present
only if type is NLB.
properties:
eip-allocations:
items:
type: string
type: array
type: object
type:
description: "type allows user to set a load balancer
type. When this field is set the default ingresscontroller
Expand All @@ -154,6 +164,10 @@ spec:
required:
- type
type: object
x-kubernetes-validations:
- message: Network load balancer parameters are allowed only
when load balancer type is NLB.
rule: self.type != 'Classic' && !has(self.networkLoadBalancer)
type:
description: type is the underlying infrastructure provider
for the cluster. Allowed values are "AWS", "Azure", "BareMetal",
Expand Down

0 comments on commit 41914f9

Please sign in to comment.