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

Enable configuration of loadbalancer class #342

Merged
merged 3 commits into from
May 3, 2023
Merged

Enable configuration of loadbalancer class #342

merged 3 commits into from
May 3, 2023

Conversation

stephenfin
Copy link
Contributor

Add the ability to set a loadBalancerClass value on the MetalLB CRD. The Service.Spec.LoadBalancerClass field reached GA in Kubernetes 1.24 and support was introduced in MetalLB in v0.13 1.

Signed-off-by: Stephen Finucane [email protected]
Closes: #267

@stephenfin
Copy link
Contributor Author

This was easier than I was expecting, so there's a good chance I've missed something/many things. Would appreciate some guidance if so!

I also have one open question inline regarding validation of names. I don't know if we want to do this at the operator level or not. Again, input welcome.

@stephenfin stephenfin changed the title Enable configuration of loadBalancerClass Enable configuration of loadbalancer class Apr 28, 2023
@fedepaol
Copy link
Member

This was easier than I was expecting, so there's a good chance I've missed something/many things. Would appreciate some guidance if so!

I thought it would've been more complex too, because when I added it there was not the helm wrap yet. Glad to see we made things more maintainable.

I also have one open question inline regarding validation of names. I don't know if we want to do this at the operator level or not. Again, input welcome.

We do! Otherwise I wouldn't have filed #267
I replied to your question. Also, I am not sure this deserves a e2e, I guess the unit test is fine.

@fedepaol
Copy link
Member

.. and of course you'll have to please CI :P

@stephenfin
Copy link
Contributor Author

.. and of course you'll have to please CI :P

Ack. Turns out make did not run all the linters as I'd expected. Whoops!

@fedepaol
Copy link
Member

.. and of course you'll have to please CI :P

Ack. Turns out make did not run all the linters as I'd expected. Whoops!

and you'll probably have to generate a few manifests. Just follow the errors.

@stephenfin stephenfin marked this pull request as ready for review April 29, 2023 17:30
@fedepaol
Copy link
Member

fedepaol commented May 2, 2023

Looks good! I have a couple of asks:

stephenfin added 3 commits May 2, 2023 11:45
Add the ability to set a 'loadBalancerClass' value on the 'MetalLB' CRD.
The 'Service.Spec.LoadBalancerClass' field reached GA in Kubernetes 1.24
and support was introduced in MetalLB in v0.13 [1].

[1] metallb/metallb#1417

Signed-off-by: Stephen Finucane <[email protected]>
Closes: #267
Follow the upstream docs [1].

  The value of spec.loadBalancerClass must be a label-style identifier,
  with an optional prefix such as "internal-vip" or
  "example.com/internal-vip". Unprefixed names are reserved for
  end-users.

The k8s concept guide [2] indicates that a valid label value:

- must be 63 characters or less (can be empty),
- unless empty, must begin and end with an alphanumeric character
  ([a-z0-9A-Z]),
- could contain dashes (-), underscores (_), dots (.), and alphanumerics
  between.

We're not *fully* validating this since we don't limit the total
characters to < 63 characters. I'm not sure how one can do this without
positive lookup, which isn't supported by the stdlib re library. Good
enough though.

[1] https://kubernetes.io/docs/concepts/services-networking/service/#load-balancer-class
[2] https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set

Signed-off-by: Stephen Finucane <[email protected]>
We've introduced a new field. Bump the manifests accordingly.

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin
Copy link
Contributor Author

stephenfin commented May 2, 2023

Looks good! I have a couple of asks:

Thanks. Done 👍

@fedepaol
Copy link
Member

fedepaol commented May 3, 2023

thanks, lgtm!

@fedepaol fedepaol merged commit dbccbcf into metallb:main May 3, 2023
@stephenfin stephenfin deleted the issues-267 branch May 3, 2023 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an option to set the loadbalancer class of the deployed metallb
2 participants