Skip to content

Kubevious removes required fields containing empty strings #20

@peter-tar

Description

@peter-tar

I ran into an interesting edge case today while attempting to create a Pubsubsubscription using Config Connector.
https://cloud.google.com/config-connector/docs/reference/resource-docs/pubsub/pubsubsubscription

If one wants to set the subscription to never expire, the expirationPolicy.ttl field needs to be set to an empty string.

Specifies the "time-to-live" duration for an associated resource. The resource expires if it is not active for a period of ttl. If ttl is set to "", the associated resource never expires. A duration in seconds with up to nine fractional digits, terminated by 's'. Example - "3.5s".

Unfortunately kubevious doesn't seem to like that:

🔴 Required property "ttl" missing under "/spec/expirationPolicy"

Digging into the code a bit it seems that as a preprocessing step kubevious deletes required fields containing empty strings as a value (if there's no default value).
https://github.com/kubevious/cli/blob/fb8ab7d57f6e585e3af7b871adf8460b929d3e61/src/validation/k8s-manifest-validator.ts#L192C1-L215C6
It's a bit unfortunate because in this scenario an empty string is the expected value.

That's the extent of my understanding. I find it a bit odd from Google to use an empty string to denote "no expiration", but nothing seems to suggest that it's forbidden by the schema based on a quick search so I decided to raise it here. Let me know if there is anything else I can provide!

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions