-
Notifications
You must be signed in to change notification settings - Fork 979
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
Provisioner cluster endpoint validation #618
Conversation
✔️ Deploy Preview for karpenter-docs-prod canceled. 🔨 Explore the source changes: 426409a 🔍 Inspect the deploy log: https://app.netlify.com/sites/karpenter-docs-prod/deploys/6119c1500d02cc00084a866a |
@@ -20,50 +20,77 @@ cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNF | |||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= | |||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= | |||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= | |||
cloud.google.com/go/bigquery v1.8.0 h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA= |
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.
Curious what caused all these changes.
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.
I don't know - is it important?
// url.Parse() will accept a lot of input without error; make | ||
// sure it's a real URL | ||
if err != nil || !endpoint.IsAbs() || endpoint.Hostname() == "" { | ||
errs = errs.Also(apis.ErrInvalidValue(c.Endpoint, "endpoint")) |
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.
Can you write in a helpful message about what it should be (e.g. a valid uri). IIRC, you can put this message into the .Also()
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.
done
} { | ||
badCluster := cluster | ||
badCluster.Endpoint = endpoint | ||
provisioner.Spec.Cluster = badCluster |
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.
nit:
provisioner.Spec.Cluster = &ClusterP{
Endpoint: endpoint
}
or
provisioner.spec.Cluster.Endpoint = endpoint
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.
done
9306b3b
to
212c44b
Compare
Issue, if available:
#600
Description of changes:
Make sure Provisioner.Cluster.Endpoint is a valid absolute URL and at least has a hostname.
Testing: unit test plus example bad input detection in running cluster:
Produces expected error from webhook in logs:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.