helm icon indicating copy to clipboard operation
helm copied to clipboard

Don't require `nodePort` to template if none is specified

Open jessebot opened this issue 1 year ago • 2 comments

Description of the change

The actual port that the NodePort type service uses can be automatically generated if no nodeport field is specified, as per the docs here: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport

Benefits

We now use a with instead of an if to make the code a bit cleaner, instead of setting the nodePort to "" which I think may also be confusing and/or not work.

Possible drawbacks

none that I can think of, but always open to feedback :)

Applicable issues

  • fixes #44

Additional information

The actual value of nil in values.yaml has to change, otherwise, it interprets the nil as a string.

Checklist

jessebot avatar Jul 26 '24 10:07 jessebot

oh no, why are all these tests failing? 🤔 Looks like it's because of this error:

Service in version "v1" cannot be handled as a Service: json: cannot unmarshal string into Go struct field ServicePort.spec.ports.nodePort of type int32

Let me see if I can fix it locally...

jessebot avatar Jul 26 '24 10:07 jessebot

ok, the fix was remove the nil from the values.yaml for the nodePort helm parameter 👍

jessebot avatar Jul 26 '24 10:07 jessebot