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

operator/ingress: Add load balancer type #312

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented May 10, 2019

Add a field to ingress controllers' endpoint publishing strategy to allow specifying parameters for load balancers. Define a parameter to allow choosing between an internal or an external load balancer.

This PR resolves NE-186.

  • operator/v1/types_ingress.go (LoadBalancerType): New type.
    (InternalLoadBalancer, ExternalLoadBalancer): New values.
    (LoadBalancerStrategy): New type for load balancer parameters.
    (EndpointPublishingStrategy): Add loadBalancer field.
  • operator/v1/zz_generated.deepcopy.go:
  • operator/v1/zz_generated.swagger_doc_generated.go: Regenerate.

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 10, 2019
@Miciah Miciah force-pushed the NE-186-operator-slash-ingress-add-load-balancer-type branch 2 times, most recently from b2df9d2 to 3acb36d Compare May 10, 2019 00:12
type LoadBalancerStrategy struct {
// type indicates the type of load balancer. Possible values are
// "External" and "Internal". The default is "External".
Type LoadBalancerType `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.

I'm trying to think of any other possible future types which might be in conflict with this. For example, is there some other "type" of load balancer that must also be internal? If so, would that indicate type is too broad a term? Compared to say, "scope" or "visibility"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We went with a string type instead of a Boolean value because we don't know what possible future types there may be. GCP uses the annotation cloud.google.com/load-balancer-type=Internal, AWS uses service.beta.kubernetes.io/aws-load-balancer-internal=0.0.0.0/0, and the other clouds use variations on somethingsomething-internal-somethingsomething=true.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was probably unclear. I wasn't suggesting a boolean type for Type, I was wondering if Type should be Scope or Visibility or something to that effect.

Copy link
Contributor

Choose a reason for hiding this comment

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

For compatibiliy with https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190325-unions.md, you need structs for each discriminator value:

Type LoadBalancerType `json:"type"`
External *External `json:"external,omitempty"`
Internal *Internal `json:"internal,omitempty"`

I don't think discriminator only (or partial sub-structs) will work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is Internal/External a type of LoadBalancerStrategy as opposed to (for example) a property of or a policy applied to a LoadBalancerStrategy? Seems to me more property-like (hence Scope or Visibility as alternatives to Type).

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 28, 2019
@ironcladlou
Copy link
Contributor

I don't know that we actually need a union type here. If not, my only proposed change is:

type LoadBalancerStrategy struct {
	// scope indicates the visibility scope of the load balancer.  Possible values are
	// "External" and "Internal".  The default is "External".
	Scope LoadBalancerScope `json:"scope"`
}

The PR currently proposes "Type" instead of "Scope", which 1. by the existing naming conventions seems to imply a union type (which this PR does not propose), and 2. by extension of the union type implication, implies a taxonomy of kinds of load balancers rather than one of many properties of load balancers (I currently think the latter is more accurate). I hope I described that in a way that makes sense...

@Miciah Miciah force-pushed the NE-186-operator-slash-ingress-add-load-balancer-type branch from 3acb36d to 87bd24e Compare June 12, 2019 16:41
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 12, 2019
@Miciah
Copy link
Contributor Author

Miciah commented Jun 12, 2019

Latest push makes the following changes:

  • Change "type" to "scope" in the types and fields that this PR adds.
  • Define empty HostNetworkStrategy and PrivateStrategy struct types.
  • Using these new types, add hostNetwork and private union fields to EndpointPublishingStrategy, so that each defined value for the type discriminator of EndpointPublishingStrategy has a corresponding union field.

Copy link
Contributor

@ironcladlou ironcladlou left a comment

Choose a reason for hiding this comment

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

@deads2k @sttts @damemi PTAL to make sure we're getting the union right?

operator/v1/types_ingress.go Show resolved Hide resolved
operator/v1/types_ingress.go Show resolved Hide resolved
operator/v1/types_ingress.go Show resolved Hide resolved
operator/v1/types_ingress.go Show resolved Hide resolved
operator/v1/types_ingress.go Show resolved Hide resolved
@Miciah Miciah force-pushed the NE-186-operator-slash-ingress-add-load-balancer-type branch from 87bd24e to 26ab74e Compare June 12, 2019 17:11
@Miciah
Copy link
Contributor Author

Miciah commented Jun 12, 2019

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 12, 2019
@Miciah
Copy link
Contributor Author

Miciah commented Jun 12, 2019

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 12, 2019
@Miciah Miciah force-pushed the NE-186-operator-slash-ingress-add-load-balancer-type branch from 26ab74e to b8110ef Compare June 12, 2019 19:20
@Miciah
Copy link
Contributor Author

Miciah commented Jun 12, 2019

Rebased.

@Miciah Miciah force-pushed the NE-186-operator-slash-ingress-add-load-balancer-type branch from b8110ef to 1401d95 Compare June 13, 2019 15:52
@Miciah
Copy link
Contributor Author

Miciah commented Jun 13, 2019

Latest push marks union fields with // +nullable.

@ironcladlou
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 13, 2019
// scope indicates the scope at which the load balancer is exposed.
// Possible values are "External" and "Internal". The default is
// "External".
Scope LoadBalancerScope `json:"scope"`
Copy link
Contributor

Choose a reason for hiding this comment

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

An empty config should work. I think this needs to be tagged optional

@deads2k
Copy link
Contributor

deads2k commented Jun 17, 2019

Just the comment about the optionalness of a field. lgtm otherwise.

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.
@Miciah Miciah force-pushed the NE-186-operator-slash-ingress-add-load-balancer-type branch from 1401d95 to 2024105 Compare June 17, 2019 17:25
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 17, 2019
@Miciah
Copy link
Contributor Author

Miciah commented Jun 17, 2019

Latest push marks scope as optional.

@deads2k
Copy link
Contributor

deads2k commented Jun 17, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 17, 2019
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, ironcladlou, Miciah

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 17, 2019
@openshift-merge-robot openshift-merge-robot merged commit 37678ff into openshift:master Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants