kurtosis-tech / kurtosis

A platform for packaging and launching ephemeral backend stacks with a focus on approachability for the average developer.
https://docs.kurtosistech.com/
Apache License 2.0
376 stars 53 forks source link

Unable to pass None to toleration_seconds #2093

Open barnabasbusa opened 9 months ago

barnabasbusa commented 9 months ago

What's your CLI version?

0.86.12

Description & steps to reproduce

Current workaround:

        for toleration_data in tolerations:
            if toleration_data.get("toleration_seconds"):
                toleration_list.append(
                    Toleration(
                        key=toleration_data.get("key", ""),
                        value=toleration_data.get("value", ""),
                        operator=toleration_data.get("operator", ""),
                        effect=toleration_data.get("effect", ""),
                        toleration_seconds=toleration_data.get("toleration_seconds")
                    )
                )
            # Gyani has to fix this in the future
            else:
                toleration_list.append(
                    Toleration(
                        key=toleration_data.get("key", ""),
                        value=toleration_data.get("value", ""),
                        operator=toleration_data.get("operator", ""),
                        effect=toleration_data.get("effect", ""),
                    )
                )

Desired behavior

I should be able to pass None to toleration_seconds, then I wouldn't need to create two different type of Tolerations.

What is the severity of this bug?

Painful; this is causing significant friction in my workflow.

What area of the product does this pertain to?

CLI: the Command Line Interface

h4ck3rk3y commented 9 months ago

Note this applies to all optionals in Starlark.

I tried two quick approaches one that would involve not throwing a validation error if its optional && None, but it was more involved than a quick fix. Also it will have effect on other option & none combinations so I didn't investigate fully.

I agree with Barnabas though, the if condition he has had to write is janky. He can't put 0 as a default value as the underlying treats 0 differently from no value entered.