Skip to content

WIP: CORENET-5857: Add a field for specifying UDN Name for a project #2265

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -35655,6 +35655,10 @@
"description": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"default": {},
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
},
"udnName": {
"description": "udnName is the User Defined Networks Name to apply to a project Reference of regex and max length: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set",
"type": "string"
}
}
},
Expand Down
116 changes: 79 additions & 37 deletions project/v1/generated.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions project/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions project/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const (
// ProjectRequesterAnnotation is the username that requested a given project. Its not guaranteed to be present,
// but it is set by the default project template.
ProjectRequesterAnnotation = "openshift.io/requester"

// ProjectUDNName is a label which refers to a UDN Name for a project
ProjectUDNName = "k8s.ovn.org/primary-user-defined-network"
)

// ProjectSpec describes the attributes on a Project
Expand Down Expand Up @@ -108,4 +111,9 @@ type ProjectRequest struct {
DisplayName string `json:"displayName,omitempty" protobuf:"bytes,2,opt,name=displayName"`
// description is the description to apply to a project
Description string `json:"description,omitempty" protobuf:"bytes,3,opt,name=description"`
// udnName is the User Defined Networks Name to apply to a project
// Reference of regex and max length: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't include a documentation reference here. Instead, state in plain sentences what the constraints of this field are.

// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$`
UDNName string `json:"udnName,omitempty" protobuf:"bytes,4,opt,name=udnName"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this field is intended to be optional and therefore should have the // +optional marker. It should also be mentioned explicitly in the GoDoc that this field is optional.

What happens if this value is not provided by a user? Explain this in the GoDoc as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is the empty string ("") a valid value to specify? If so, how is this different than not specifying the value? If not, this should probably have a minimum length constraint as well.

}
1 change: 1 addition & 0 deletions project/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.