-
Notifications
You must be signed in to change notification settings - Fork 235
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 --short-name flag for resource creation commands #419
add --short-name flag for resource creation commands #419
Conversation
Welcome @carlory! |
/assign @yue9944882 |
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.
thanks, couple of nits otherwise LGTM
@@ -54,6 +55,7 @@ apiserver-boot create group version resource --group insect --version v1beta1 -- | |||
func AddCreateResource(cmd *cobra.Command) { | |||
RegisterResourceFlags(createResourceCmd) | |||
|
|||
createResourceCmd.Flags().StringVar(&shortName, "short-name", "", "if set, add a short name for the resource, exposed in API discovery documents, and used by clients to support invocations like 'kubectl get <shortname>'. It must be all lowercase.") |
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.
"if set, add a short name for the resource, exposed in API discovery documents, and used by clients to support invocations like 'kubectl get '. It must be all lowercase."
if len(shortName) > 0 { | ||
if errs := utilvalidation.IsDNS1035Label(shortName); len(errs) > 0 { | ||
detail := strings.Join(errs, ",") | ||
klog.Fatalf("--short-name has bad format. %q : %s", shortName, detail) |
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.
klog.Fatalf("--short-name has bad format. %q : %s", shortName, detail) | |
klog.Fatalf("--short-name %q has bad format: %s", shortName, detail) |
"regexp" | ||
"strings" | ||
|
||
"k8s.io/klog" |
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.
move it below L30
@@ -323,7 +327,7 @@ import ( | |||
|
|||
// {{.Kind}} | |||
// +k8s:openapi-gen=true | |||
// +resource:path={{.Resource}},strategy={{.Kind}}Strategy | |||
// +resource:path={{.Resource}},strategy={{.Kind}}Strategy{{- if .ShortName }},shortname={{.ShortName}}{{- end }} |
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.
// +resource:path={{.Resource}},strategy={{.Kind}}Strategy{{- if .ShortName }},shortname={{.ShortName}}{{- end }} | |
// +resource:path={{.Resource}},strategy={{.Kind}}Strategy{{ if .ShortName }},shortname={{.ShortName}}{{ end }} |
@yue9944882 fixed! |
@DirectXMan12 @yue9944882 it is ready for review. |
thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: carlory, yue9944882 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 |
ref: #249