Don't require `nodePort` to template if none is specified
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
- [x] I have read the CONTRIBUTING.md doc.
- [x] DCO has been signed off on the commit.
- [x] Chart version bumped in
Chart.yamlaccording to semver. - [x] (optional) Parameters are documented in the README.md
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...
ok, the fix was remove the nil from the values.yaml for the nodePort helm parameter 👍