Skip to content

Commit

Permalink
operator/ingress: Add load balancer scope
Browse files Browse the repository at this point in the history
Add fields to ingress controllers' endpoint publishing strategy to allow
specifying parameters for each strategy.  Define a "scope" parameter for
the LoadBalancerStrategy strategy to allow choosing between an internal or
an external load balancer.

This commit resolves NE-186.

https://jira.coreos.com/browse/NE-186

* operator/v1/types_ingress.go (LoadBalancerScope): New type.
(InternalLoadBalancer, ExternalLoadBalancer): New values.
(LoadBalancerStrategy): New type for load balancer parameters.  Define the
"scope" parameter.
(HostNetworkStrategy, PrivateStrategyType): New types.  Empty for now.
(EndpointPublishingStrategy): Add loadBalancer, hostNetwork, and private
fields.
* operator/v1/zz_generated.deepcopy.go:
* operator/v1/zz_generated.swagger_doc_generated.go: Regenerate.
  • Loading branch information
Miciah committed Jun 17, 2019
1 parent 9c4ae3c commit 2024105
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 4 deletions.
53 changes: 53 additions & 0 deletions operator/v1/types_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,42 @@ const (
PrivateStrategyType EndpointPublishingStrategyType = "Private"
)

// LoadBalancerScope is the scope at which a load balancer is exposed.
type LoadBalancerScope string

var (
// InternalLoadBalancer is a load balancer that is exposed only on the
// cluster's private network.
InternalLoadBalancer LoadBalancerScope = "Internal"

// ExternalLoadBalancer is a load balancer that is exposed on the
// cluster's public network (which is typically on the Internet).
ExternalLoadBalancer LoadBalancerScope = "External"
)

// LoadBalancerStrategy holds parameters for a load balancer.
type LoadBalancerStrategy struct {
// scope indicates the scope at which the load balancer is exposed.
// Possible values are "External" and "Internal". The default is
// "External".
// +optional
Scope LoadBalancerScope `json:"scope"`
}

// HostNetworkStrategy holds parameters for the HostNetwork endpoint publishing
// strategy.
type HostNetworkStrategy struct {
}

// PrivateStrategy holds parameters for the Private endpoint publishing
// strategy.
type PrivateStrategy struct {
}

// EndpointPublishingStrategy is a way to publish the endpoints of an
// IngressController, and represents the type and any additional configuration
// for a specific type.
// +union
type EndpointPublishingStrategy struct {
// type is the publishing strategy to use. Valid values are:
//
Expand Down Expand Up @@ -209,7 +242,27 @@ type EndpointPublishingStrategy struct {
// In this configuration, the ingress controller deployment uses container
// networking, and is not explicitly published. The user must manually publish
// the ingress controller.
// +unionDiscriminator
// +optional
Type EndpointPublishingStrategyType `json:"type"`

// loadBalancer holds parameters for the load balancer. Present only if
// type is LoadBalancerService.
// +optional
// +nullable
LoadBalancer *LoadBalancerStrategy `json:"loadBalancer,omitempty"`

// hostNetwork holds parameters for the HostNetwork endpoint publishing
// strategy. Present only if type is HostNetwork.
// +optional
// +nullable
HostNetwork *HostNetworkStrategy `json:"hostNetwork,omitempty"`

// private holds parameters for the Private endpoint publishing
// strategy. Present only if type is Private.
// +optional
// +nullable
Private *PrivateStrategy `json:"private,omitempty"`
}

var (
Expand Down
67 changes: 65 additions & 2 deletions operator/v1/zz_generated.deepcopy.go

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

32 changes: 30 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.

0 comments on commit 2024105

Please sign in to comment.