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

Do not define loadBalancerIP on service unless set in values #429

Closed
wants to merge 5 commits into from

Conversation

benyanke
Copy link
Contributor

@benyanke benyanke commented Aug 17, 2023

TLDR: Closed and replaced by #430

Pull Request

Description of the change

This PR sets the .Values.service.loadBalancerIP field as optional, and does not define it in the service if it's not set in the values.

This is because some LoadBalancer implementations allow or even require this value to remain unset, and while it may sometimes be fine to leave it set but blank, this could have unexpected impacts depending on your cluster configuration.

In particular, MetalLB will leave the service <pending> if the loadBalancerIP is set to nil, and hardcoding it to a value in the values breaks the ability for MetalLB's IPAM tooling to be used for dynamic address allocation. I suspect other LoadBalancer implementations may have similar behaviors.

Benefits

The primary benefit is more flexible usage with more LoadBalancer implementations.

Possible drawbacks

None I can think of, however I am open to discussion.

Applicable issues

Additional information

For easy review on the output, here is the before and after:

After - No LB set

Note how the loadBalancerIP is now gone when it's not defined, for more flexible usage.

$ helm template nextcloud . --set service.type=LoadBalancer | grep Service -A 15
kind: Service
metadata:
  name: nextcloud
  labels:
    app.kubernetes.io/name: nextcloud
    helm.sh/chart: nextcloud-3.6.0
    app.kubernetes.io/instance: nextcloud
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: app
spec:
  type: LoadBalancer
  ports:
  - port: 8080
    targetPort: 80
    protocol: TCP
    name: http

After - LB Set

Note how the loadBalancerIP still works as before when it's defined, for full backward compatibility.

$ helm template nextcloud . --set service.type=LoadBalancer --set service.loadBalancerIP=1.2.3.4 | grep Service -A 15
kind: Service
metadata:
  name: nextcloud
  labels:
    app.kubernetes.io/name: nextcloud
    helm.sh/chart: nextcloud-3.6.0
    app.kubernetes.io/instance: nextcloud
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: app
spec:
  type: LoadBalancer
  loadBalancerIP: 1.2.3.4
  ports:
  - port: 8080
    targetPort: 80
    protocol: TCP

After - Forcing Previous Behavior

And if you still wish to template out the field with nil in the value as before, that is still supported by explicitly setting to nil.

$ helm template nextcloud . --set service.type=LoadBalancer --set service.loadBalancerIP=nil | grep Service -A 15
kind: Service
metadata:
  name: nextcloud
  labels:
    app.kubernetes.io/name: nextcloud
    helm.sh/chart: nextcloud-3.5.22
    app.kubernetes.io/instance: nextcloud
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: app
spec:
  type: LoadBalancer
  loadBalancerIP: nil
  ports:
  - port: 8080
    targetPort: 80
    protocol: TCP

Before

Note the nil in the loadBalancerIP field.

$ helm template nextcloud . --set service.type=LoadBalancer | grep Service -A 15
kind: Service
metadata:
  name: nextcloud
  labels:
    app.kubernetes.io/name: nextcloud
    helm.sh/chart: nextcloud-3.6.0
    app.kubernetes.io/instance: nextcloud
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: app
spec:
  type: LoadBalancer
  loadBalancerIP: nil
  ports:
  - port: 8080
    targetPort: 80
    protocol: TCP
    name: http

Checklist

@provokateurin
Copy link
Member

You need to add the Signed-of-by tag to all your commits (git commit -s)

@jessebot
Copy link
Collaborator

jessebot commented Aug 17, 2023

Adding to Kate's comment, since you have four commits, you can do:

git rebase HEAD~4 --signoff
git push --force

@provokateurin
Copy link
Member

Oh I didn't know you can signoff using rebase as well, that's pretty neat :)

jessebot and others added 4 commits August 17, 2023 21:28
* updating nextcloud app version to 27.0.1

Signed-off-by: jessebot <[email protected]>

* adding some docs on upgrades and backups

Signed-off-by: jessebot <[email protected]>

* Update charts/nextcloud/README.md -  add backups link

Signed-off-by: JesseBot <[email protected]>

---------

Signed-off-by: jessebot <[email protected]>
Signed-off-by: JesseBot <[email protected]>
Signed-off-by: Ben Yanke <[email protected]>
Signed-off-by: Evan Carroll <[email protected]>
Signed-off-by: Ben Yanke <[email protected]>
Signed-off-by: jld3103 <[email protected]>
Signed-off-by: Ben Yanke <[email protected]>
@benyanke
Copy link
Contributor Author

replaced by #430

@benyanke benyanke closed this Aug 18, 2023
@benyanke
Copy link
Contributor Author

benyanke commented Aug 18, 2023

@jessebot @provokateurin - had trouble getting signing working properly, simply created a new branch with the changes. Can you review #430?

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.

Do not define loadBalancerIP on service unless set in values
4 participants