Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Load Balancer Type to IngressController API #672

Merged
merged 2 commits into from Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
108 changes: 108 additions & 0 deletions operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml
Expand Up @@ -94,6 +94,60 @@ spec:
description: loadBalancer holds parameters for the load balancer.
Present only if type is LoadBalancerService.
properties:
providerParameters:
description: "providerParameters holds desired load balancer
information specific to the underlying infrastructure provider.
\n If empty, defaults will be applied. See specific providerParameters
fields for details about their defaults."
properties:
aws:
description: "aws provides configuration settings that are
specific to AWS load balancers. \n If empty, defaults
will be applied. See specific aws fields for details about
their defaults."
properties:
classicLoadBalancer:
description: classicLoadBalancerParameters holds configuration
parameters for an AWS classic load balancer. Present
only if type is Classic.
type: object
networkLoadBalancer:
description: networkLoadBalancerParameters holds configuration
parameters for an AWS network load balancer. Present
only if type is NLB.
type: object
type:
description: "type is the type of AWS load balancer
to instantiate for an ingresscontroller. \n Valid
values are: \n * \"Classic\": A Classic Load Balancer
that makes routing decisions at either the transport
layer (TCP/SSL) or the application layer (HTTP/HTTPS).
See the following for additional details: \n https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-balancer-types.html#clb
\n * \"NLB\": A Network Load Balancer that makes routing
decisions at the transport layer (TCP/SSL). See
the following for additional details: \n https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-balancer-types.html#nlb"
enum:
- Classic
- NLB
type: string
required:
- type
type: object
type:
description: type is the underlying infrastructure provider
for the load balancer. Allowed values are "AWS", "Azure",
"BareMetal", "GCP", "OpenStack", and "VSphere".
enum:
- AWS
- Azure
- BareMetal
- GCP
- OpenStack
- VSphere
type: string
required:
- type
type: object
scope:
description: scope indicates the scope at which the load balancer
is exposed. Possible values are "External" and "Internal".
Expand Down Expand Up @@ -634,6 +688,60 @@ spec:
description: loadBalancer holds parameters for the load balancer.
Present only if type is LoadBalancerService.
properties:
providerParameters:
description: "providerParameters holds desired load balancer
information specific to the underlying infrastructure provider.
\n If empty, defaults will be applied. See specific providerParameters
fields for details about their defaults."
properties:
aws:
description: "aws provides configuration settings that are
specific to AWS load balancers. \n If empty, defaults
will be applied. See specific aws fields for details about
their defaults."
properties:
classicLoadBalancer:
description: classicLoadBalancerParameters holds configuration
parameters for an AWS classic load balancer. Present
only if type is Classic.
type: object
networkLoadBalancer:
description: networkLoadBalancerParameters holds configuration
parameters for an AWS network load balancer. Present
only if type is NLB.
type: object
type:
description: "type is the type of AWS load balancer
to instantiate for an ingresscontroller. \n Valid
values are: \n * \"Classic\": A Classic Load Balancer
that makes routing decisions at either the transport
layer (TCP/SSL) or the application layer (HTTP/HTTPS).
See the following for additional details: \n https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-balancer-types.html#clb
\n * \"NLB\": A Network Load Balancer that makes routing
decisions at the transport layer (TCP/SSL). See
the following for additional details: \n https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-balancer-types.html#nlb"
enum:
- Classic
- NLB
type: string
required:
- type
type: object
type:
description: type is the underlying infrastructure provider
for the load balancer. Allowed values are "AWS", "Azure",
"BareMetal", "GCP", "OpenStack", and "VSphere".
enum:
- AWS
- Azure
- BareMetal
- GCP
- OpenStack
- VSphere
type: string
required:
- type
type: object
scope:
description: scope indicates the scope at which the load balancer
is exposed. Possible values are "External" and "Internal".
Expand Down
95 changes: 95 additions & 0 deletions operator/v1/types_ingress.go
Expand Up @@ -233,6 +233,101 @@ type LoadBalancerStrategy struct {
// +kubebuilder:validation:Required
// +required
Scope LoadBalancerScope `json:"scope"`

// providerParameters holds desired load balancer information specific to
// the underlying infrastructure provider.
//
// If empty, defaults will be applied. See specific providerParameters
// fields for details about their defaults.
danehans marked this conversation as resolved.
Show resolved Hide resolved
//
// +optional
ProviderParameters ProviderLoadBalancerParameters `json:"providerParameters,omitempty"`
}

// ProviderLoadBalancerParameters holds desired load balancer information
// specific to the underlying infrastructure provider.
// +union
type ProviderLoadBalancerParameters struct {
// type is the underlying infrastructure provider for the load balancer.
// Allowed values are "AWS", "Azure", "BareMetal", "GCP", "OpenStack",
// and "VSphere".
//
// +unionDiscriminator
// +kubebuilder:validation:Required
// +required
Type LoadBalancerProviderType `json:"type"`

// aws provides configuration settings that are specific to AWS
// load balancers.
//
// If empty, defaults will be applied. See specific aws fields for
// details about their defaults.
//
// +optional
AWS *AWSLoadBalancerParameters `json:"aws,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the cloud specific nature of this, a structure that includes something like https://github.com/openshift/api/blob/master/config/v1/types_infrastructure.go#L131 may be in order.

So

type LoadBalancerStrategy struct {
    Scope
    PlatformLoadBalancerParameters PlatformLoadBalancerParameters
}

type PlatformLoadBalancerParameters struct{
    Type PlatformType `json:"type"`

    AWS *AWSLoadBalancerParameters `json:"aws,omitempty"`
}

my apologies if you had this before and I didn't pay attention to the aws-y nature of this.

}

// LoadBalancerProviderType is the underlying infrastructure provider for the
// load balancer. Allowed values are "AWS", "Azure", "BareMetal", "GCP",
// "OpenStack", and "VSphere".
//
// +kubebuilder:validation:Enum=AWS;Azure;BareMetal;GCP;OpenStack;VSphere
type LoadBalancerProviderType string

// AWSLoadBalancerParameters provides configuration settings that are
// specific to AWS load balancers.
// +union
type AWSLoadBalancerParameters struct {
// type is the type of AWS load balancer to instantiate for an ingresscontroller.
//
// Valid values are:
//
// * "Classic": A Classic Load Balancer that makes routing decisions at either
// the transport layer (TCP/SSL) or the application layer (HTTP/HTTPS). See
// the following for additional details:
//
// https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-balancer-types.html#clb
//
// * "NLB": A Network Load Balancer that makes routing decisions at the
// transport layer (TCP/SSL). See the following for additional details:
//
// https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-balancer-types.html#nlb
//
// +unionDiscriminator
// +kubebuilder:validation:Required
// +required
Type AWSLoadBalancerType `json:"type"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we make this a union discriminator now, do we need to go ahead and add classic and nlb fields with empty struct types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Miciah commit f2c24f2 adds classic and nlb fields with empty struct types.


// classicLoadBalancerParameters holds configuration parameters for an AWS
// classic load balancer. Present only if type is Classic.
//
// +optional
ClassicLoadBalancerParameters *AWSClassicLoadBalancerParameters `json:"classicLoadBalancer,omitempty"`

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

// AWSLoadBalancerType is the type of AWS load balancer to instantiate.
// +kubebuilder:validation:Enum=Classic;NLB
type AWSLoadBalancerType string

const (
AWSClassicLoadBalancer AWSLoadBalancerType = "Classic"
AWSNetworkLoadBalancer AWSLoadBalancerType = "NLB"
)

// AWSClassicLoadBalancerParameters holds configuration parameters for an
// AWS Classic load balancer.
type AWSClassicLoadBalancerParameters struct {
}

// AWSNetworkLoadBalancerParameters holds configuration parameters for an
// AWS Network load balancer.
type AWSNetworkLoadBalancerParameters struct {
}

// HostNetworkStrategy holds parameters for the HostNetwork endpoint publishing
Expand Down
82 changes: 81 additions & 1 deletion operator/v1/zz_generated.deepcopy.go

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

42 changes: 40 additions & 2 deletions operator/v1/zz_generated.swagger_doc_generated.go

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