-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kubevious removes required fields containing empty strings #20
Comments
hi @peter-tar, good catch! I've experienced the same issue with GKE HealthCheckPolicy where the target ref could be a Service with an empty |
@peter-tar, on a different note, since you're also using GCP Config Connector would you be willing to help with writing custom rules to validate semantics of config connector manifests? For example, it would validate that the |
Hey @rubenhak, thanks for picking this up. When you are talking about custom rules, do you mean these? |
Hi @peter-tar, the fix is merged and released as v1.0.61. I've added initial rules for semantic validation in GCP Config Connector SQL resources. You can try this example below. Feel free to change the instanceRef or secret references in ./demos.git/guard/60-gcp-config-connector and check the results. git clone https://github.com/kubevious/demos.git demos.git
kubevious guard ./demos.git/crds/gcp-config-connector ./demos.git/crds/sealed-secrets ./demos.git/guard/60-gcp-config-connector If you wish to play around with editing/writing your own rules, try this:
The --skip-community-rules tells the command to not to load any rules from the library. You can then pass the relevant rules from the file system: ./rules-library.git/gcp-config-connector. Feel free to let me know if you need assistance. |
Hey @rubenhak I will also look at the semantic validation rules, thanks for the intro. I will try to get around to it in the next couple of weeks. |
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.Unfortunately kubevious doesn't seem to like that:
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!
The text was updated successfully, but these errors were encountered: