kubenix icon indicating copy to clipboard operation
kubenix copied to clipboard

Fix: fix error when containerPort misses protocol

Open YBeaugnon opened this issue 1 year ago • 3 comments

Using helm chart with ports, without protocol specified (which default to TCP), cause error during https://github.com/hall/kubenix/blob/08740f5f557adf9368fc8388485965935cd241e2/pkgs/generators/k8s/default.nix#L391 evaluation.

This hack use TCP as a default when protocol key is not defined.

I think a cleaner way could be to give default to option, based on k8s default options.

YBeaugnon avatar Jul 19 '23 10:07 YBeaugnon

Hi @YBeaugnon, thanks for flagging this! I agree it's a pain. It was introduced in #21 as an unfortunate side effect with the hope that it could be solved down the line.

What I'd like to do is add some testing here that can validate that this (and future changes) don't break existing functionality.

hall avatar Aug 26 '23 22:08 hall

I think the same issue also arises with the ServicePort spec. I encountered it when trying to import the dashboard yaml from https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml where the container's ports specify "protocol" but the service's ports do not.

thorstenweber83 avatar Sep 26 '23 20:09 thorstenweber83

What would be an acceptable fix for this issue? Would it make sense to mkDefault a value of "TCP" instead of null?

Is mkDefault a mkOverride 1002 in our case?

felixscheinost avatar Nov 21 '23 10:11 felixscheinost