-
Notifications
You must be signed in to change notification settings - Fork 326
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
Add defaults and validation for ServiceDefaults #320
Add defaults and validation for ServiceDefaults #320
Conversation
0f1acdf
to
9ea49fa
Compare
f2f7b1d
to
03ada6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validating logic looks awesome!
I wasn't super sure if we need defaulting though. It seems like a duplication of logic that already exists in Consul, and so I'm not sure what is the value of having it in the controller as well. It also couples us to consul versions more tightly - if consul changes defaults, you'd need to update to the version of the controller/consul-k8s that has that default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
d0989eb
to
d0a466c
Compare
1e3740e
to
bc3686a
Compare
Changes proposed in this PR:
Add defaulting and validation for ServiceDefaults
Checklist:
How I tested the PR:
• Used the image
ashwinvenkatesh/consul-k8s:validation
to deploy consul via helm with the controller enabled.• Tried creating service default resource with
• Invalid mesh gateway mode
• Invalid expose path protocol (not in "http" and "http2") and path value (not prefixed by "/")
This led to webhook errors which indicated the invalid fields
• Combinations of various invalid values for the above fields
This led to webhook errors that listed every single invalid field
How I expect people to test the PR:
• You can retry the above scenarios with multiple invalid values to verify every invalid value is mentioned in the returned error from the webhook.