From 327eb2166a3a98d0515e04e0e8bed5d6c61529d5 Mon Sep 17 00:00:00 2001 From: miheer Date: Wed, 9 Apr 2025 10:32:48 +1000 Subject: [PATCH] CORENET-5857: Add a field for specifying UDN Name for a project --- .../generated_openapi/zz_generated.openapi.go | 7 ++ openapi/openapi.json | 4 + project/v1/generated.pb.go | 116 ++++++++++++------ project/v1/generated.proto | 6 + project/v1/types.go | 8 ++ .../v1/zz_generated.swagger_doc_generated.go | 1 + 6 files changed, 105 insertions(+), 37 deletions(-) diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index 1616b701290..f1b8b986875 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -60822,6 +60822,13 @@ func schema_openshift_api_project_v1_ProjectRequest(ref common.ReferenceCallback Format: "", }, }, + "udnName": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, }, }, }, diff --git a/openapi/openapi.json b/openapi/openapi.json index a521a8bcfe7..5c9dcf7c53f 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -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" } } }, diff --git a/project/v1/generated.pb.go b/project/v1/generated.pb.go index 822dbbc3013..5a637d4c360 100644 --- a/project/v1/generated.pb.go +++ b/project/v1/generated.pb.go @@ -182,43 +182,45 @@ func init() { } var fileDescriptor_fbf46eaac05029bf = []byte{ - // 573 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0x4d, 0x6f, 0xd3, 0x30, - 0x18, 0xc7, 0x9b, 0x6d, 0x1d, 0xab, 0xcb, 0x26, 0x14, 0x2e, 0x55, 0x0f, 0x69, 0xc9, 0x24, 0xd4, - 0x03, 0x38, 0xb4, 0xbc, 0x88, 0x73, 0x40, 0x88, 0x49, 0xbc, 0x0c, 0x73, 0xab, 0x38, 0xe0, 0xa6, - 0x6e, 0x6a, 0xba, 0xc4, 0x26, 0x76, 0x2b, 0x8d, 0x13, 0x1f, 0x81, 0x3b, 0x9f, 0x83, 0x2b, 0xe7, - 0x1e, 0x77, 0xdc, 0xa9, 0x5a, 0xc3, 0xb7, 0xd8, 0x09, 0xd9, 0x71, 0x93, 0xc0, 0x8a, 0xd4, 0x5d, - 0xb8, 0xd5, 0x4f, 0xfe, 0xbf, 0x9f, 0xed, 0xe7, 0x49, 0x03, 0x1e, 0x86, 0x54, 0x8e, 0xa7, 0x03, - 0x18, 0xb0, 0xc8, 0x63, 0x9c, 0xc4, 0x62, 0x4c, 0x47, 0xd2, 0xc3, 0x9c, 0x7a, 0x3c, 0x61, 0x9f, - 0x48, 0x20, 0xbd, 0x59, 0xd7, 0x0b, 0x49, 0x4c, 0x12, 0x2c, 0xc9, 0x10, 0xf2, 0x84, 0x49, 0x66, - 0x1f, 0x16, 0x10, 0xcc, 0x21, 0x88, 0x39, 0x85, 0x06, 0x82, 0xb3, 0x6e, 0xf3, 0x7e, 0xc9, 0x1c, - 0xb2, 0x90, 0x79, 0x9a, 0x1d, 0x4c, 0x47, 0x7a, 0xa5, 0x17, 0xfa, 0x57, 0xe6, 0x6c, 0xba, 0x93, - 0xa7, 0x02, 0x52, 0xa6, 0xb7, 0x0e, 0x58, 0x42, 0xd6, 0xec, 0xdb, 0x7c, 0x54, 0x64, 0x22, 0x1c, - 0x8c, 0x69, 0x4c, 0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x75, 0xac, 0x8b, 0xd4, 0xb1, 0xbe, 0xfd, 0x72, 0x2a, 0xfd, 0xc3, 0x0d, 0xbe, 0x8e, 0xbf, - 0x03, 0x00, 0x00, 0xff, 0xff, 0xb3, 0x9b, 0x1f, 0xba, 0x43, 0x05, 0x00, 0x00, + // 595 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0x3f, 0x6f, 0xd3, 0x40, + 0x18, 0x87, 0xe3, 0x34, 0x69, 0x9a, 0x0b, 0x2d, 0xc8, 0x2c, 0x51, 0x06, 0x27, 0xb8, 0x12, 0x0a, + 0x12, 0x9c, 0x49, 0xf8, 0x23, 0x66, 0x53, 0x21, 0x2a, 0x41, 0x29, 0x46, 0x2c, 0x11, 0x03, 0x17, + 0xe7, 0xe2, 0x1c, 0xa9, 0xed, 0xc3, 0x77, 0x8e, 0x54, 0x26, 0x76, 0x16, 0x76, 0x3e, 0x07, 0x2b, + 0x73, 0xc6, 0x8e, 0x9d, 0x22, 0x62, 0xbe, 0x45, 0x27, 0x74, 0xe7, 0x8b, 0x6d, 0x68, 0x90, 0xd2, + 0x85, 0x2d, 0xf7, 0xde, 0xef, 0x79, 0x2e, 0xf7, 0xbe, 0x97, 0x80, 0x07, 0x1e, 0xe1, 0x93, 0x78, + 0x08, 0xdd, 0xd0, 0xb7, 0x42, 0x8a, 0x03, 0x36, 0x21, 0x63, 0x6e, 0x21, 0x4a, 0x2c, 0x1a, 0x85, + 0x1f, 0xb0, 0xcb, 0xad, 0x59, 0xcf, 0xf2, 0x70, 0x80, 0x23, 0xc4, 0xf1, 0x08, 0xd2, 0x28, 0xe4, + 0xa1, 0xbe, 0x9f, 0x43, 0x30, 0x83, 0x20, 0xa2, 0x04, 0x2a, 0x08, 0xce, 0x7a, 0xad, 0x7b, 0x05, + 0xb3, 0x17, 0x7a, 0xa1, 0x25, 0xd9, 0x61, 0x3c, 0x96, 0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 0x00, 0x80, 0x1b, 0x06, 0x23, 0x22, 0xae, 0xbd, 0x7a, 0x24, 0xb7, 0x0b, + 0xb3, 0x83, 0x02, 0x87, 0x45, 0xfc, 0xe9, 0x2a, 0x9e, 0x4f, 0x2c, 0x2b, 0x31, 0xa7, 0x60, 0xb3, + 0x0f, 0xe7, 0x4b, 0xa3, 0x74, 0xb6, 0x34, 0x4a, 0xe7, 0x4b, 0xa3, 0xf4, 0x39, 0x31, 0xb4, 0x79, + 0x62, 0x68, 0x67, 0x89, 0xa1, 0x9d, 0x27, 0x86, 0xf6, 0x33, 0x31, 0xb4, 0xaf, 0xbf, 0x8c, 0xd2, + 0x60, 0x7f, 0x83, 0x3f, 0xd2, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xff, 0x2c, 0x37, 0x6e, + 0x05, 0x00, 0x00, } func (m *Project) Marshal() (dAtA []byte, err error) { @@ -341,6 +343,11 @@ func (m *ProjectRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + i -= len(m.UDNName) + copy(dAtA[i:], m.UDNName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.UDNName))) + i-- + dAtA[i] = 0x22 i -= len(m.Description) copy(dAtA[i:], m.Description) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) @@ -493,6 +500,8 @@ func (m *ProjectRequest) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = len(m.Description) n += 1 + l + sovGenerated(uint64(l)) + l = len(m.UDNName) + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -570,6 +579,7 @@ func (this *ProjectRequest) String() string { `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `DisplayName:` + fmt.Sprintf("%v", this.DisplayName) + `,`, `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `UDNName:` + fmt.Sprintf("%v", this.UDNName) + `,`, `}`, }, "") return s @@ -1000,6 +1010,38 @@ func (m *ProjectRequest) Unmarshal(dAtA []byte) error { } m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UDNName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UDNName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/project/v1/generated.proto b/project/v1/generated.proto index d1ffbc341bf..5400abb3aa1 100644 --- a/project/v1/generated.proto +++ b/project/v1/generated.proto @@ -67,6 +67,12 @@ message ProjectRequest { // description is the description to apply to a project optional string description = 3; + + // 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 + // +kubebuilder:validation:MaxLength=63 + // +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$` + optional string udnName = 4; } // ProjectSpec describes the attributes on a Project diff --git a/project/v1/types.go b/project/v1/types.go index 5e69b775b53..7529428034f 100644 --- a/project/v1/types.go +++ b/project/v1/types.go @@ -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 @@ -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 + // +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"` } diff --git a/project/v1/zz_generated.swagger_doc_generated.go b/project/v1/zz_generated.swagger_doc_generated.go index b764eaface1..21c5e19b9ad 100644 --- a/project/v1/zz_generated.swagger_doc_generated.go +++ b/project/v1/zz_generated.swagger_doc_generated.go @@ -37,6 +37,7 @@ var map_ProjectRequest = map[string]string{ "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", "displayName": "displayName is the display name to apply to a project", "description": "description is the description to apply to a project", + "udnName": "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", } func (ProjectRequest) SwaggerDoc() map[string]string {