Skip to content

Commit f7cf91c

Browse files
committed
CORENET-5674: Add new field for UDN in oc
Adds a new field to create a new project via user or admin.
1 parent 1719de8 commit f7cf91c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/cli/admin/project/new_project.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type NewProjectOptions struct {
3232
ProjectName string
3333
DisplayName string
3434
Description string
35+
UDNName string
3536
NodeSelector string
3637

3738
UseNodeSelector bool
@@ -82,6 +83,7 @@ func NewCmdNewProject(f kcmdutil.Factory, streams genericiooptions.IOStreams) *c
8283
cmd.Flags().StringVar(&o.AdminUser, "admin", o.AdminUser, "Project admin username")
8384
cmd.Flags().StringVar(&o.DisplayName, "display-name", o.DisplayName, "Project display name")
8485
cmd.Flags().StringVar(&o.Description, "description", o.Description, "Project description")
86+
cmd.Flags().StringVar(&o.UDNName, "udn-name", o.UDNName, "UserDefinedNetwork Name")
8587
cmd.Flags().StringVar(&o.NodeSelector, "node-selector", o.NodeSelector, "Restrict pods onto nodes matching given label selector. Format: '<key1>=<value1>, <key2>=<value2>...'. Specifying \"\" means any node, not default. If unspecified, cluster default node selector will be used.")
8688

8789
return cmd
@@ -133,6 +135,7 @@ func (o *NewProjectOptions) Run() error {
133135
project.Annotations = make(map[string]string)
134136
project.Annotations[annotations.OpenShiftDescription] = o.Description
135137
project.Annotations[annotations.OpenShiftDisplayName] = o.DisplayName
138+
projectv1.ProjectUDNName = o.UDNName
136139
if o.UseNodeSelector {
137140
project.Annotations[projectv1.ProjectNodeSelector] = o.NodeSelector
138141
}

pkg/cli/requestproject/request_project.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type RequestProjectOptions struct {
2222
ProjectName string
2323
DisplayName string
2424
Description string
25+
UDNName string
2526

2627
Server string
2728

@@ -92,6 +93,7 @@ func NewCmdRequestProject(f kcmdutil.Factory, streams genericiooptions.IOStreams
9293
}
9394
cmd.Flags().StringVar(&o.DisplayName, "display-name", o.DisplayName, "Project display name")
9495
cmd.Flags().StringVar(&o.Description, "description", o.Description, "Project description")
96+
cmd.Flags().StringVar(&o.UDNName, "udn-name", o.UDNName, "UserDefinedNetwork Name")
9597
cmd.Flags().BoolVar(&o.SkipConfigWrite, "skip-config-write", o.SkipConfigWrite, "If true, the project will not be set as a cluster entry in kubeconfig after being created")
9698

9799
return cmd
@@ -140,6 +142,7 @@ func (o *RequestProjectOptions) Run() error {
140142
projectRequest.Name = o.ProjectName
141143
projectRequest.DisplayName = o.DisplayName
142144
projectRequest.Description = o.Description
145+
projectRequest.UDNName = o.UDNName
143146
projectRequest.Annotations = make(map[string]string)
144147

145148
project, err := o.Client.ProjectRequests().Create(context.TODO(), projectRequest, metav1.CreateOptions{})

0 commit comments

Comments
 (0)