-
Notifications
You must be signed in to change notification settings - Fork 4
Description
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!