diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index e3753083a43..731bdea02aa 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -12070,6 +12070,10 @@ "io.k8s.api.discovery.v1alpha1.EndpointPort": { "description": "EndpointPort represents a Port used by an EndpointSlice", "properties": { + "appProtocol": { + "description": "The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and http://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names. Default is empty string.", + "type": "string" + }, "name": { "description": "The name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is dervied from a Kubernetes service, this corresponds to the Service.ports[].name. Name must either be an empty string or pass DNS_LABEL validation: * must be no more than 63 characters long. * must consist of lower case alphanumeric characters or '-'. * must start and end with an alphanumeric character. Default is empty string.", "type": "string" diff --git a/pkg/apis/discovery/types.go b/pkg/apis/discovery/types.go index cb5c91f8146..dad50f6887b 100644 --- a/pkg/apis/discovery/types.go +++ b/pkg/apis/discovery/types.go @@ -130,6 +130,14 @@ type EndpointPort struct { // If this is not specified, ports are not restricted and must be // interpreted in the context of the specific consumer. Port *int32 + // The application protocol for this port. + // This field follows standard Kubernetes label syntax. + // Un-prefixed names are reserved for IANA standard service names (as per + // RFC-6335 and http://www.iana.org/assignments/service-names). + // Non-standard protocols should use prefixed names. + // Default is empty string. + // +optional + AppProtocol *string } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/discovery/v1alpha1/zz_generated.conversion.go b/pkg/apis/discovery/v1alpha1/zz_generated.conversion.go index 97469829d6d..a37934bf4b5 100644 --- a/pkg/apis/discovery/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/discovery/v1alpha1/zz_generated.conversion.go @@ -147,6 +147,7 @@ func autoConvert_v1alpha1_EndpointPort_To_discovery_EndpointPort(in *v1alpha1.En out.Name = (*string)(unsafe.Pointer(in.Name)) out.Protocol = (*core.Protocol)(unsafe.Pointer(in.Protocol)) out.Port = (*int32)(unsafe.Pointer(in.Port)) + out.AppProtocol = (*string)(unsafe.Pointer(in.AppProtocol)) return nil } @@ -159,6 +160,7 @@ func autoConvert_discovery_EndpointPort_To_v1alpha1_EndpointPort(in *discovery.E out.Name = (*string)(unsafe.Pointer(in.Name)) out.Protocol = (*v1.Protocol)(unsafe.Pointer(in.Protocol)) out.Port = (*int32)(unsafe.Pointer(in.Port)) + out.AppProtocol = (*string)(unsafe.Pointer(in.AppProtocol)) return nil } diff --git a/pkg/apis/discovery/validation/validation.go b/pkg/apis/discovery/validation/validation.go index cc9d6b5957b..cfd1551e754 100644 --- a/pkg/apis/discovery/validation/validation.go +++ b/pkg/apis/discovery/validation/validation.go @@ -143,6 +143,12 @@ func validatePorts(endpointPorts []discovery.EndpointPort, fldPath *field.Path) } else if !supportedPortProtocols.Has(string(*endpointPort.Protocol)) { allErrs = append(allErrs, field.NotSupported(idxPath.Child("protocol"), *endpointPort.Protocol, supportedPortProtocols.List())) } + + if endpointPort.AppProtocol != nil { + for _, msg := range validation.IsQualifiedName(*endpointPort.AppProtocol) { + allErrs = append(allErrs, field.Invalid(idxPath.Child("appProtocol"), endpointPort.AppProtocol, msg)) + } + } } return allErrs diff --git a/pkg/apis/discovery/validation/validation_test.go b/pkg/apis/discovery/validation/validation_test.go index 4faf29a40ec..0f7e7853a60 100644 --- a/pkg/apis/discovery/validation/validation_test.go +++ b/pkg/apis/discovery/validation/validation_test.go @@ -88,6 +88,34 @@ func TestValidateEndpointSlice(t *testing.T) { }}, }, }, + "app-protocols": { + expectedErrors: 0, + endpointSlice: &discovery.EndpointSlice{ + ObjectMeta: standardMeta, + AddressType: addressTypePtr(discovery.AddressTypeIP), + Ports: []discovery.EndpointPort{{ + Name: utilpointer.StringPtr("one"), + Protocol: protocolPtr(api.ProtocolTCP), + AppProtocol: utilpointer.StringPtr("HTTP"), + }, { + Name: utilpointer.StringPtr("two"), + Protocol: protocolPtr(api.ProtocolTCP), + AppProtocol: utilpointer.StringPtr("https"), + }, { + Name: utilpointer.StringPtr("three"), + Protocol: protocolPtr(api.ProtocolTCP), + AppProtocol: utilpointer.StringPtr("my-protocol"), + }, { + Name: utilpointer.StringPtr("four"), + Protocol: protocolPtr(api.ProtocolTCP), + AppProtocol: utilpointer.StringPtr("example.com/custom-protocol"), + }}, + Endpoints: []discovery.Endpoint{{ + Addresses: generateIPAddresses(1), + Hostname: utilpointer.StringPtr("valid-123"), + }}, + }, + }, "empty-port-name": { expectedErrors: 0, endpointSlice: &discovery.EndpointSlice{ @@ -390,6 +418,22 @@ func TestValidateEndpointSlice(t *testing.T) { }}, }, }, + "bad-app-protocol": { + expectedErrors: 1, + endpointSlice: &discovery.EndpointSlice{ + ObjectMeta: standardMeta, + AddressType: addressTypePtr(discovery.AddressTypeIP), + Ports: []discovery.EndpointPort{{ + Name: utilpointer.StringPtr("http"), + Protocol: protocolPtr(api.ProtocolTCP), + AppProtocol: utilpointer.StringPtr("--"), + }}, + Endpoints: []discovery.Endpoint{{ + Addresses: generateIPAddresses(1), + Hostname: utilpointer.StringPtr("valid-123"), + }}, + }, + }, "empty-everything": { expectedErrors: 3, endpointSlice: &discovery.EndpointSlice{ diff --git a/pkg/apis/discovery/zz_generated.deepcopy.go b/pkg/apis/discovery/zz_generated.deepcopy.go index d4c33c5482b..4ac7376b96d 100644 --- a/pkg/apis/discovery/zz_generated.deepcopy.go +++ b/pkg/apis/discovery/zz_generated.deepcopy.go @@ -103,6 +103,11 @@ func (in *EndpointPort) DeepCopyInto(out *EndpointPort) { *out = new(int32) **out = **in } + if in.AppProtocol != nil { + in, out := &in.AppProtocol, &out.AppProtocol + *out = new(string) + **out = **in + } return } diff --git a/pkg/controller/endpointslice/endpointslice_controller_test.go b/pkg/controller/endpointslice/endpointslice_controller_test.go index 752d2e6df81..db4f9bcb8f5 100644 --- a/pkg/controller/endpointslice/endpointslice_controller_test.go +++ b/pkg/controller/endpointslice/endpointslice_controller_test.go @@ -267,7 +267,7 @@ func TestSyncServiceFull(t *testing.T) { slice := sliceList.Items[0] assert.Len(t, slice.Endpoints, 2, "Expected 2 endpoints in first slice") assert.Equal(t, slice.Annotations["endpoints.kubernetes.io/last-change-trigger-time"], serviceCreateTime.Format(time.RFC3339Nano)) - assert.EqualValues(t, []discovery.EndpointPort{{ + assert.ElementsMatch(t, []discovery.EndpointPort{{ Name: strPtr("tcp-example"), Protocol: protoPtr(v1.ProtocolTCP), Port: int32Ptr(int32(80)), diff --git a/staging/src/k8s.io/api/discovery/v1alpha1/generated.pb.go b/staging/src/k8s.io/api/discovery/v1alpha1/generated.pb.go index 34f6b28d71f..917e2e4141a 100644 --- a/staging/src/k8s.io/api/discovery/v1alpha1/generated.pb.go +++ b/staging/src/k8s.io/api/discovery/v1alpha1/generated.pb.go @@ -200,53 +200,54 @@ func init() { } var fileDescriptor_772f83c5b34e07a5 = []byte{ - // 728 bytes of a gzipped FileDescriptorProto + // 744 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4b, 0x6f, 0xd3, 0x4a, - 0x14, 0x8e, 0x9b, 0x5a, 0xb2, 0x27, 0x8d, 0xd4, 0x8e, 0xee, 0x22, 0xca, 0xbd, 0xd7, 0x8e, 0xc2, - 0x82, 0x48, 0x85, 0x31, 0xa9, 0x28, 0xaa, 0x60, 0x43, 0x8d, 0xca, 0x43, 0xe2, 0x11, 0x86, 0x2e, - 0x10, 0x62, 0xc1, 0xc4, 0x9e, 0x3a, 0x26, 0x89, 0xc7, 0xb2, 0x27, 0x91, 0xb2, 0xe3, 0x27, 0x20, - 0xf1, 0x77, 0x58, 0xb2, 0xe8, 0xb2, 0xcb, 0xae, 0x0c, 0x35, 0xff, 0xa2, 0x2b, 0x34, 0xe3, 0x57, - 0x4a, 0x78, 0x64, 0x37, 0xe7, 0x9b, 0xf3, 0x7d, 0xe7, 0x9c, 0x6f, 0xce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67, 0x4a, 0x36, 0x3a, 0xbd, 0x30, 0x6a, 0x67, 0x17, 0x46, 0xed, 0xfc, + 0xc2, 0xa8, 0xbd, 0x4f, 0x0d, 0xe5, 0x34, 0x35, 0x94, 0xb3, 0xd4, 0x50, 0xce, 0x53, 0x43, 0xf9, + 0x9a, 0x1a, 0xca, 0x87, 0x6f, 0x46, 0xed, 0xb5, 0x56, 0x68, 0x7e, 0x0f, 0x00, 0x00, 0xff, 0xff, + 0x99, 0xbb, 0x72, 0xd7, 0x71, 0x06, 0x00, 0x00, } func (m *Endpoint) Marshal() (dAtA []byte, err error) { @@ -387,6 +388,13 @@ func (m *EndpointPort) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.AppProtocol != nil { + i -= len(*m.AppProtocol) + copy(dAtA[i:], *m.AppProtocol) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.AppProtocol))) + i-- + dAtA[i] = 0x22 + } if m.Port != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.Port)) i-- @@ -597,6 +605,10 @@ func (m *EndpointPort) Size() (n int) { if m.Port != nil { n += 1 + sovGenerated(uint64(*m.Port)) } + if m.AppProtocol != nil { + l = len(*m.AppProtocol) + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -692,6 +704,7 @@ func (this *EndpointPort) String() string { `Name:` + valueToStringGenerated(this.Name) + `,`, `Protocol:` + valueToStringGenerated(this.Protocol) + `,`, `Port:` + valueToStringGenerated(this.Port) + `,`, + `AppProtocol:` + valueToStringGenerated(this.AppProtocol) + `,`, `}`, }, "") return s @@ -1246,6 +1259,39 @@ func (m *EndpointPort) Unmarshal(dAtA []byte) error { } } m.Port = &v + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppProtocol", 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 + } + s := string(dAtA[iNdEx:postIndex]) + m.AppProtocol = &s + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/staging/src/k8s.io/api/discovery/v1alpha1/generated.proto b/staging/src/k8s.io/api/discovery/v1alpha1/generated.proto index 53fcad3f260..69093655e05 100644 --- a/staging/src/k8s.io/api/discovery/v1alpha1/generated.proto +++ b/staging/src/k8s.io/api/discovery/v1alpha1/generated.proto @@ -104,6 +104,14 @@ message EndpointPort { // If this is not specified, ports are not restricted and must be // interpreted in the context of the specific consumer. optional int32 port = 3; + + // The application protocol for this port. + // This field follows standard Kubernetes label syntax. + // Un-prefixed names are reserved for IANA standard service names (as per + // RFC-6335 and http://www.iana.org/assignments/service-names). + // Non-standard protocols should use prefixed names. + // Default is empty string. + optional string appProtocol = 4; } // EndpointSlice represents a subset of the endpoints that implement a service. diff --git a/staging/src/k8s.io/api/discovery/v1alpha1/types.go b/staging/src/k8s.io/api/discovery/v1alpha1/types.go index be08b33317b..4452dd4f614 100644 --- a/staging/src/k8s.io/api/discovery/v1alpha1/types.go +++ b/staging/src/k8s.io/api/discovery/v1alpha1/types.go @@ -135,6 +135,13 @@ type EndpointPort struct { // If this is not specified, ports are not restricted and must be // interpreted in the context of the specific consumer. Port *int32 `json:"port,omitempty" protobuf:"bytes,3,opt,name=port"` + // The application protocol for this port. + // This field follows standard Kubernetes label syntax. + // Un-prefixed names are reserved for IANA standard service names (as per + // RFC-6335 and http://www.iana.org/assignments/service-names). + // Non-standard protocols should use prefixed names. + // Default is empty string. + AppProtocol *string `json:"appProtocol,omitempty" protobuf:"bytes,4,name=appProtocol"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/staging/src/k8s.io/api/discovery/v1alpha1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/discovery/v1alpha1/types_swagger_doc_generated.go index 908e7070a76..226f9528cc1 100644 --- a/staging/src/k8s.io/api/discovery/v1alpha1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/discovery/v1alpha1/types_swagger_doc_generated.go @@ -50,10 +50,11 @@ func (EndpointConditions) SwaggerDoc() map[string]string { } var map_EndpointPort = map[string]string{ - "": "EndpointPort represents a Port used by an EndpointSlice", - "name": "The name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is dervied from a Kubernetes service, this corresponds to the Service.ports[].name. Name must either be an empty string or pass DNS_LABEL validation: * must be no more than 63 characters long. * must consist of lower case alphanumeric characters or '-'. * must start and end with an alphanumeric character. Default is empty string.", - "protocol": "The IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.", - "port": "The port number of the endpoint. If this is not specified, ports are not restricted and must be interpreted in the context of the specific consumer.", + "": "EndpointPort represents a Port used by an EndpointSlice", + "name": "The name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is dervied from a Kubernetes service, this corresponds to the Service.ports[].name. Name must either be an empty string or pass DNS_LABEL validation: * must be no more than 63 characters long. * must consist of lower case alphanumeric characters or '-'. * must start and end with an alphanumeric character. Default is empty string.", + "protocol": "The IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.", + "port": "The port number of the endpoint. If this is not specified, ports are not restricted and must be interpreted in the context of the specific consumer.", + "appProtocol": "The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and http://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names. Default is empty string.", } func (EndpointPort) SwaggerDoc() map[string]string { diff --git a/staging/src/k8s.io/api/discovery/v1alpha1/zz_generated.deepcopy.go b/staging/src/k8s.io/api/discovery/v1alpha1/zz_generated.deepcopy.go index e424fccf3b3..de1eae5563c 100644 --- a/staging/src/k8s.io/api/discovery/v1alpha1/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/api/discovery/v1alpha1/zz_generated.deepcopy.go @@ -103,6 +103,11 @@ func (in *EndpointPort) DeepCopyInto(out *EndpointPort) { *out = new(int32) **out = **in } + if in.AppProtocol != nil { + in, out := &in.AppProtocol, &out.AppProtocol + *out = new(string) + **out = **in + } return }