-
Notifications
You must be signed in to change notification settings - Fork 2.3k
add support for kustomize edit set namespace
#247
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
Conversation
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.
Thank you for working on this.
return errors.New("must specify exactly one namespace value") | ||
} | ||
ns := args[0] | ||
if errs := validation.IsDNS1123Label(ns); len(errs) != 0 { |
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.
Does namespace follow this label format? Is there any doc for that?
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'm not aware of a doc but I used this validation function after a little experimentation and reading some source code:
$ kubectl create ns _test_
The Namespace "_test_" is invalid: metadata.name: Invalid value: "_test_": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')
I traced that error through:
https://github.com/kubernetes/apimachinery/blob/master/pkg/util/validation/validation.go#L108
https://github.com/kubernetes/apimachinery/blob/master/pkg/api/validation/generic.go#L62
https://github.com/kubernetes/kubernetes/blob/e38efdcce6860141609bb8b9f959d06d6643fdf5/pkg/apis/core/validation/validation.go#L4996
But let me know if I missed something.
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.
Good tracing and that gives enough info.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: ryane The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
fixes #246