Adding NodeName to EndpointSlice API, deprecation updates

In addition to adding NodeName, this notes that the topology field will
be deprecated soon. It also removes the IP address type that was
deprecated in Kubernetes 1.17 and intended to be removed in 1.20.
This commit is contained in:
Rob Scott
2020-11-10 17:47:20 -08:00
parent fbc589f35d
commit 9613f79add
18 changed files with 443 additions and 147 deletions

View File

@@ -10897,6 +10897,10 @@
"description": "hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS Label (RFC 1123) validation.", "description": "hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS Label (RFC 1123) validation.",
"type": "string" "type": "string"
}, },
"nodeName": {
"description": "nodeName represents the name of the Node hosting this endpoint. This can be used to determine endpoints local to a Node.",
"type": "string"
},
"targetRef": { "targetRef": {
"$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference", "$ref": "#/definitions/io.k8s.api.core.v1.ObjectReference",
"description": "targetRef is a reference to a Kubernetes object that represents this endpoint." "description": "targetRef is a reference to a Kubernetes object that represents this endpoint."
@@ -10905,7 +10909,7 @@
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "string"
}, },
"description": "topology contains arbitrary topology information associated with the endpoint. These key/value pairs must conform with the label format. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Topology may include a maximum of 16 key/value pairs. This includes, but is not limited to the following well known keys: * kubernetes.io/hostname: the value indicates the hostname of the node\n where the endpoint is located. This should match the corresponding\n node label.\n* topology.kubernetes.io/zone: the value indicates the zone where the\n endpoint is located. This should match the corresponding node label.\n* topology.kubernetes.io/region: the value indicates the region where the\n endpoint is located. This should match the corresponding node label.", "description": "topology contains arbitrary topology information associated with the endpoint. These key/value pairs must conform with the label format. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Topology may include a maximum of 16 key/value pairs. This includes, but is not limited to the following well known keys: * kubernetes.io/hostname: the value indicates the hostname of the node\n where the endpoint is located. This should match the corresponding\n node label.\n* topology.kubernetes.io/zone: the value indicates the zone where the\n endpoint is located. This should match the corresponding node label.\n* topology.kubernetes.io/region: the value indicates the region where the\n endpoint is located. This should match the corresponding node label.\nthis field will be deprecated in an upcoming release.",
"type": "object" "type": "object"
} }
}, },

View File

@@ -57,12 +57,6 @@ type EndpointSlice struct {
type AddressType string type AddressType string
const ( const (
// AddressTypeIP represents an IP Address.
// This address type has been deprecated and has been replaced by the IPv4
// and IPv6 adddress types. New resources with this address type will be
// considered invalid. This will be fully removed in 1.18.
// +deprecated
AddressTypeIP = AddressType("IP")
// AddressTypeIPv4 represents an IPv4 Address. // AddressTypeIPv4 represents an IPv4 Address.
AddressTypeIPv4 = AddressType(api.IPv4Protocol) AddressTypeIPv4 = AddressType(api.IPv4Protocol)
// AddressTypeIPv6 represents an IPv6 Address. // AddressTypeIPv6 represents an IPv6 Address.
@@ -105,8 +99,13 @@ type Endpoint struct {
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// * topology.kubernetes.io/region: the value indicates the region where the // * topology.kubernetes.io/region: the value indicates the region where the
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// this field will be deprecated in an upcoming release.
// +optional // +optional
Topology map[string]string Topology map[string]string
// nodeName represents the name of the Node hosting this endpoint. This can
// be used to determine endpoints local to a Node.
// +optional
NodeName *string
} }
// EndpointConditions represents the current condition of an endpoint. // EndpointConditions represents the current condition of an endpoint.

View File

@@ -99,6 +99,7 @@ func autoConvert_v1alpha1_Endpoint_To_discovery_Endpoint(in *v1alpha1.Endpoint,
out.Hostname = (*string)(unsafe.Pointer(in.Hostname)) out.Hostname = (*string)(unsafe.Pointer(in.Hostname))
out.TargetRef = (*core.ObjectReference)(unsafe.Pointer(in.TargetRef)) out.TargetRef = (*core.ObjectReference)(unsafe.Pointer(in.TargetRef))
out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology)) out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology))
out.NodeName = (*string)(unsafe.Pointer(in.NodeName))
return nil return nil
} }
@@ -115,6 +116,7 @@ func autoConvert_discovery_Endpoint_To_v1alpha1_Endpoint(in *discovery.Endpoint,
out.Hostname = (*string)(unsafe.Pointer(in.Hostname)) out.Hostname = (*string)(unsafe.Pointer(in.Hostname))
out.TargetRef = (*v1.ObjectReference)(unsafe.Pointer(in.TargetRef)) out.TargetRef = (*v1.ObjectReference)(unsafe.Pointer(in.TargetRef))
out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology)) out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology))
out.NodeName = (*string)(unsafe.Pointer(in.NodeName))
return nil return nil
} }

View File

@@ -99,6 +99,7 @@ func autoConvert_v1beta1_Endpoint_To_discovery_Endpoint(in *v1beta1.Endpoint, ou
out.Hostname = (*string)(unsafe.Pointer(in.Hostname)) out.Hostname = (*string)(unsafe.Pointer(in.Hostname))
out.TargetRef = (*core.ObjectReference)(unsafe.Pointer(in.TargetRef)) out.TargetRef = (*core.ObjectReference)(unsafe.Pointer(in.TargetRef))
out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology)) out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology))
out.NodeName = (*string)(unsafe.Pointer(in.NodeName))
return nil return nil
} }
@@ -115,6 +116,7 @@ func autoConvert_discovery_Endpoint_To_v1beta1_Endpoint(in *discovery.Endpoint,
out.Hostname = (*string)(unsafe.Pointer(in.Hostname)) out.Hostname = (*string)(unsafe.Pointer(in.Hostname))
out.TargetRef = (*v1.ObjectReference)(unsafe.Pointer(in.TargetRef)) out.TargetRef = (*v1.ObjectReference)(unsafe.Pointer(in.TargetRef))
out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology)) out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology))
out.NodeName = (*string)(unsafe.Pointer(in.NodeName))
return nil return nil
} }

View File

@@ -9,11 +9,13 @@ go_library(
"//pkg/apis/core:go_default_library", "//pkg/apis/core:go_default_library",
"//pkg/apis/core/validation:go_default_library", "//pkg/apis/core/validation:go_default_library",
"//pkg/apis/discovery:go_default_library", "//pkg/apis/discovery:go_default_library",
"//pkg/features:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/validation:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/validation:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
], ],
) )
@@ -24,7 +26,10 @@ go_test(
deps = [ deps = [
"//pkg/apis/core:go_default_library", "//pkg/apis/core:go_default_library",
"//pkg/apis/discovery:go_default_library", "//pkg/apis/discovery:go_default_library",
"//pkg/features:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library", "//vendor/k8s.io/utils/pointer:go_default_library",
], ],
) )

View File

@@ -22,9 +22,11 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation" "k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/validation/field"
utilfeature "k8s.io/apiserver/pkg/util/feature"
api "k8s.io/kubernetes/pkg/apis/core" api "k8s.io/kubernetes/pkg/apis/core"
apivalidation "k8s.io/kubernetes/pkg/apis/core/validation" apivalidation "k8s.io/kubernetes/pkg/apis/core/validation"
"k8s.io/kubernetes/pkg/apis/discovery" "k8s.io/kubernetes/pkg/apis/discovery"
"k8s.io/kubernetes/pkg/features"
) )
var ( var (
@@ -33,9 +35,6 @@ var (
string(discovery.AddressTypeIPv6), string(discovery.AddressTypeIPv6),
string(discovery.AddressTypeFQDN), string(discovery.AddressTypeFQDN),
) )
deprecatedAddressTypes = sets.NewString(
string(discovery.AddressTypeIP),
)
supportedPortProtocols = sets.NewString( supportedPortProtocols = sets.NewString(
string(api.ProtocolTCP), string(api.ProtocolTCP),
string(api.ProtocolUDP), string(api.ProtocolUDP),
@@ -53,10 +52,10 @@ var (
var ValidateEndpointSliceName = apimachineryvalidation.NameIsDNSSubdomain var ValidateEndpointSliceName = apimachineryvalidation.NameIsDNSSubdomain
// ValidateEndpointSlice validates an EndpointSlice. // ValidateEndpointSlice validates an EndpointSlice.
func ValidateEndpointSlice(endpointSlice *discovery.EndpointSlice, validAddressTypes sets.String) field.ErrorList { func ValidateEndpointSlice(endpointSlice *discovery.EndpointSlice, allowNodeName bool) field.ErrorList {
allErrs := apivalidation.ValidateObjectMeta(&endpointSlice.ObjectMeta, true, ValidateEndpointSliceName, field.NewPath("metadata")) allErrs := apivalidation.ValidateObjectMeta(&endpointSlice.ObjectMeta, true, ValidateEndpointSliceName, field.NewPath("metadata"))
allErrs = append(allErrs, validateAddressType(endpointSlice.AddressType, validAddressTypes)...) allErrs = append(allErrs, validateAddressType(endpointSlice.AddressType)...)
allErrs = append(allErrs, validateEndpoints(endpointSlice.Endpoints, endpointSlice.AddressType, field.NewPath("endpoints"))...) allErrs = append(allErrs, validateEndpoints(endpointSlice.Endpoints, endpointSlice.AddressType, allowNodeName, field.NewPath("endpoints"))...)
allErrs = append(allErrs, validatePorts(endpointSlice.Ports, field.NewPath("ports"))...) allErrs = append(allErrs, validatePorts(endpointSlice.Ports, field.NewPath("ports"))...)
return allErrs return allErrs
@@ -64,18 +63,33 @@ func ValidateEndpointSlice(endpointSlice *discovery.EndpointSlice, validAddressT
// ValidateEndpointSliceCreate validates an EndpointSlice when it is created. // ValidateEndpointSliceCreate validates an EndpointSlice when it is created.
func ValidateEndpointSliceCreate(endpointSlice *discovery.EndpointSlice) field.ErrorList { func ValidateEndpointSliceCreate(endpointSlice *discovery.EndpointSlice) field.ErrorList {
return ValidateEndpointSlice(endpointSlice, supportedAddressTypes) // allow NodeName value if the feature gate is set.
allowNodeName := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceNodeName)
return ValidateEndpointSlice(endpointSlice, allowNodeName)
} }
// ValidateEndpointSliceUpdate validates an EndpointSlice when it is updated. // ValidateEndpointSliceUpdate validates an EndpointSlice when it is updated.
func ValidateEndpointSliceUpdate(newEndpointSlice, oldEndpointSlice *discovery.EndpointSlice) field.ErrorList { func ValidateEndpointSliceUpdate(newEndpointSlice, oldEndpointSlice *discovery.EndpointSlice) field.ErrorList {
allErrs := ValidateEndpointSlice(newEndpointSlice, supportedAddressTypes.Union(deprecatedAddressTypes)) // allow NodeName value if the feature gate is set.
allowNodeName := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceNodeName)
if !allowNodeName {
for _, ep := range oldEndpointSlice.Endpoints {
if ep.NodeName != nil {
allowNodeName = true
break
}
}
}
allErrs := ValidateEndpointSlice(newEndpointSlice, allowNodeName)
allErrs = append(allErrs, apivalidation.ValidateImmutableField(newEndpointSlice.AddressType, oldEndpointSlice.AddressType, field.NewPath("addressType"))...) allErrs = append(allErrs, apivalidation.ValidateImmutableField(newEndpointSlice.AddressType, oldEndpointSlice.AddressType, field.NewPath("addressType"))...)
return allErrs return allErrs
} }
func validateEndpoints(endpoints []discovery.Endpoint, addrType discovery.AddressType, fldPath *field.Path) field.ErrorList { func validateEndpoints(endpoints []discovery.Endpoint, addrType discovery.AddressType, allowNodeName bool, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if len(endpoints) > maxEndpoints { if len(endpoints) > maxEndpoints {
@@ -97,10 +111,6 @@ func validateEndpoints(endpoints []discovery.Endpoint, addrType discovery.Addres
// This validates known address types, unknown types fall through // This validates known address types, unknown types fall through
// and do not get validated. // and do not get validated.
switch addrType { switch addrType {
case discovery.AddressTypeIP:
for _, msg := range validation.IsValidIP(address) {
allErrs = append(allErrs, field.Invalid(addressPath.Index(i), address, msg))
}
case discovery.AddressTypeIPv4: case discovery.AddressTypeIPv4:
allErrs = append(allErrs, validation.IsValidIPv4Address(addressPath.Index(i), address)...) allErrs = append(allErrs, validation.IsValidIPv4Address(addressPath.Index(i), address)...)
case discovery.AddressTypeIPv6: case discovery.AddressTypeIPv6:
@@ -110,6 +120,17 @@ func validateEndpoints(endpoints []discovery.Endpoint, addrType discovery.Addres
} }
} }
if endpoint.NodeName != nil {
nnPath := idxPath.Child("nodeName")
if allowNodeName {
for _, msg := range apivalidation.ValidateNodeName(*endpoint.NodeName, false) {
allErrs = append(allErrs, field.Invalid(nnPath, *endpoint.NodeName, msg))
}
} else {
allErrs = append(allErrs, field.Forbidden(nnPath, "may not be set unless EndpointSliceNodeName feature gate is enabled"))
}
}
topologyPath := idxPath.Child("topology") topologyPath := idxPath.Child("topology")
if len(endpoint.Topology) > maxTopologyLabels { if len(endpoint.Topology) > maxTopologyLabels {
allErrs = append(allErrs, field.TooMany(topologyPath, len(endpoint.Topology), maxTopologyLabels)) allErrs = append(allErrs, field.TooMany(topologyPath, len(endpoint.Topology), maxTopologyLabels))
@@ -162,13 +183,13 @@ func validatePorts(endpointPorts []discovery.EndpointPort, fldPath *field.Path)
return allErrs return allErrs
} }
func validateAddressType(addressType discovery.AddressType, validAddressTypes sets.String) field.ErrorList { func validateAddressType(addressType discovery.AddressType) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if addressType == "" { if addressType == "" {
allErrs = append(allErrs, field.Required(field.NewPath("addressType"), "")) allErrs = append(allErrs, field.Required(field.NewPath("addressType"), ""))
} else if !validAddressTypes.Has(string(addressType)) { } else if !supportedAddressTypes.Has(string(addressType)) {
allErrs = append(allErrs, field.NotSupported(field.NewPath("addressType"), addressType, validAddressTypes.List())) allErrs = append(allErrs, field.NotSupported(field.NewPath("addressType"), addressType, supportedAddressTypes.List()))
} }
return allErrs return allErrs

View File

@@ -22,8 +22,11 @@ import (
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilfeature "k8s.io/apiserver/pkg/util/feature"
featuregatetesting "k8s.io/component-base/featuregate/testing"
api "k8s.io/kubernetes/pkg/apis/core" api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/discovery" "k8s.io/kubernetes/pkg/apis/discovery"
"k8s.io/kubernetes/pkg/features"
utilpointer "k8s.io/utils/pointer" utilpointer "k8s.io/utils/pointer"
) )
@@ -92,7 +95,7 @@ func TestValidateEndpointSlice(t *testing.T) {
expectedErrors: 0, expectedErrors: 0,
endpointSlice: &discovery.EndpointSlice{ endpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressTypeIPv4,
Ports: []discovery.EndpointPort{{ Ports: []discovery.EndpointPort{{
Name: utilpointer.StringPtr("one"), Name: utilpointer.StringPtr("one"),
Protocol: protocolPtr(api.ProtocolTCP), Protocol: protocolPtr(api.ProtocolTCP),
@@ -378,7 +381,7 @@ func TestValidateEndpointSlice(t *testing.T) {
expectedErrors: 1, expectedErrors: 1,
endpointSlice: &discovery.EndpointSlice{ endpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressTypeIPv4,
Ports: []discovery.EndpointPort{{ Ports: []discovery.EndpointPort{{
Name: utilpointer.StringPtr("http"), Name: utilpointer.StringPtr("http"),
Protocol: protocolPtr(api.ProtocolTCP), Protocol: protocolPtr(api.ProtocolTCP),
@@ -438,7 +441,7 @@ func TestValidateEndpointSlice(t *testing.T) {
expectedErrors: 1, expectedErrors: 1,
endpointSlice: &discovery.EndpointSlice{ endpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressTypeIPv4,
Ports: []discovery.EndpointPort{{ Ports: []discovery.EndpointPort{{
Name: utilpointer.StringPtr("http"), Name: utilpointer.StringPtr("http"),
Protocol: protocolPtr(api.ProtocolTCP), Protocol: protocolPtr(api.ProtocolTCP),
@@ -458,7 +461,7 @@ func TestValidateEndpointSlice(t *testing.T) {
for name, testCase := range testCases { for name, testCase := range testCases {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
errs := ValidateEndpointSlice(testCase.endpointSlice, supportedAddressTypes.Union(deprecatedAddressTypes)) errs := ValidateEndpointSlice(testCase.endpointSlice, true)
if len(errs) != testCase.expectedErrors { if len(errs) != testCase.expectedErrors {
t.Errorf("Expected %d errors, got %d errors: %v", testCase.expectedErrors, len(errs), errs) t.Errorf("Expected %d errors, got %d errors: %v", testCase.expectedErrors, len(errs), errs)
} }
@@ -473,8 +476,9 @@ func TestValidateEndpointSliceCreate(t *testing.T) {
} }
testCases := map[string]struct { testCases := map[string]struct {
expectedErrors int expectedErrors int
endpointSlice *discovery.EndpointSlice endpointSlice *discovery.EndpointSlice
nodeNameGateEnabled bool
}{ }{
"good-slice": { "good-slice": {
expectedErrors: 0, expectedErrors: 0,
@@ -491,13 +495,64 @@ func TestValidateEndpointSliceCreate(t *testing.T) {
}}, }},
}, },
}, },
"good-slice-node-name": {
expectedErrors: 0,
nodeNameGateEnabled: true,
endpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Ports: []discovery.EndpointPort{{
Name: utilpointer.StringPtr("http"),
Protocol: protocolPtr(api.ProtocolTCP),
}},
Endpoints: []discovery.Endpoint{{
Addresses: generateIPAddresses(1),
Hostname: utilpointer.StringPtr("valid-123"),
NodeName: utilpointer.StringPtr("valid-node-name"),
}},
},
},
// expected failures // expected failures
"bad-node-name": {
expectedErrors: 1,
nodeNameGateEnabled: true,
endpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Ports: []discovery.EndpointPort{{
Name: utilpointer.StringPtr("http"),
Protocol: protocolPtr(api.ProtocolTCP),
}},
Endpoints: []discovery.Endpoint{{
Addresses: generateIPAddresses(1),
Hostname: utilpointer.StringPtr("valid-123"),
NodeName: utilpointer.StringPtr("INvalid-node-name"),
}},
},
},
"node-name-disabled": {
expectedErrors: 1,
nodeNameGateEnabled: false,
endpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Ports: []discovery.EndpointPort{{
Name: utilpointer.StringPtr("http"),
Protocol: protocolPtr(api.ProtocolTCP),
}},
Endpoints: []discovery.Endpoint{{
Addresses: generateIPAddresses(1),
Hostname: utilpointer.StringPtr("valid-123"),
NodeName: utilpointer.StringPtr("valid-node-name"),
}},
},
},
"deprecated-address-type": { "deprecated-address-type": {
expectedErrors: 1, expectedErrors: 1,
endpointSlice: &discovery.EndpointSlice{ endpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressType("IP"),
Ports: []discovery.EndpointPort{{ Ports: []discovery.EndpointPort{{
Name: utilpointer.StringPtr("http"), Name: utilpointer.StringPtr("http"),
Protocol: protocolPtr(api.ProtocolTCP), Protocol: protocolPtr(api.ProtocolTCP),
@@ -524,6 +579,8 @@ func TestValidateEndpointSliceCreate(t *testing.T) {
} }
for name, testCase := range testCases { for name, testCase := range testCases {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.EndpointSliceNodeName, testCase.nodeNameGateEnabled)()
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
errs := ValidateEndpointSliceCreate(testCase.endpointSlice) errs := ValidateEndpointSliceCreate(testCase.endpointSlice)
if len(errs) != testCase.expectedErrors { if len(errs) != testCase.expectedErrors {
@@ -537,9 +594,10 @@ func TestValidateEndpointSliceUpdate(t *testing.T) {
standardMeta := metav1.ObjectMeta{Name: "es1", Namespace: "test"} standardMeta := metav1.ObjectMeta{Name: "es1", Namespace: "test"}
testCases := map[string]struct { testCases := map[string]struct {
expectedErrors int expectedErrors int
newEndpointSlice *discovery.EndpointSlice nodeNameGateEnabled bool
oldEndpointSlice *discovery.EndpointSlice newEndpointSlice *discovery.EndpointSlice
oldEndpointSlice *discovery.EndpointSlice
}{ }{
"valid and identical slices": { "valid and identical slices": {
newEndpointSlice: &discovery.EndpointSlice{ newEndpointSlice: &discovery.EndpointSlice{
@@ -552,21 +610,99 @@ func TestValidateEndpointSliceUpdate(t *testing.T) {
}, },
expectedErrors: 0, expectedErrors: 0,
}, },
"deprecated address type": { "node name set before + after, gate disabled": {
expectedErrors: 0,
newEndpointSlice: &discovery.EndpointSlice{ newEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressTypeIPv4,
Endpoints: []discovery.Endpoint{{
Addresses: []string{"10.1.2.3"},
NodeName: utilpointer.StringPtr("foo"),
}},
}, },
oldEndpointSlice: &discovery.EndpointSlice{ oldEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressTypeIPv4,
Endpoints: []discovery.Endpoint{{
Addresses: []string{"10.1.2.3"},
NodeName: utilpointer.StringPtr("foo"),
}},
},
expectedErrors: 0,
},
"node name set after, gate enabled": {
nodeNameGateEnabled: true,
newEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Endpoints: []discovery.Endpoint{{
Addresses: []string{"10.1.2.3"},
}},
},
oldEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Endpoints: []discovery.Endpoint{{
Addresses: []string{"10.1.2.3"},
NodeName: utilpointer.StringPtr("foo"),
}},
},
expectedErrors: 0,
},
// expected errors
"invalide node name set after, gate enabled": {
nodeNameGateEnabled: true,
newEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Endpoints: []discovery.Endpoint{{
Addresses: []string{"10.1.2.3"},
NodeName: utilpointer.StringPtr("INVALID foo"),
}},
},
oldEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Endpoints: []discovery.Endpoint{{
Addresses: []string{"10.1.2.3"},
}},
},
expectedErrors: 1,
},
"node name set after, gate disabled": {
nodeNameGateEnabled: false,
newEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Endpoints: []discovery.Endpoint{{
Addresses: []string{"10.1.2.3"},
}},
},
oldEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIPv4,
Endpoints: []discovery.Endpoint{{
Addresses: []string{"10.1.2.3"},
NodeName: utilpointer.StringPtr("foo"),
}},
},
expectedErrors: 0,
},
"deprecated address type": {
expectedErrors: 1,
newEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressType("IP"),
},
oldEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta,
AddressType: discovery.AddressType("IP"),
}, },
}, },
"valid and identical slices with different address types": { "valid and identical slices with different address types": {
newEndpointSlice: &discovery.EndpointSlice{ newEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressTypeIPv4,
}, },
oldEndpointSlice: &discovery.EndpointSlice{ oldEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
@@ -577,7 +713,7 @@ func TestValidateEndpointSliceUpdate(t *testing.T) {
"invalid slices with valid address types": { "invalid slices with valid address types": {
newEndpointSlice: &discovery.EndpointSlice{ newEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressTypeIPv4,
Ports: []discovery.EndpointPort{{ Ports: []discovery.EndpointPort{{
Name: utilpointer.StringPtr(""), Name: utilpointer.StringPtr(""),
Protocol: protocolPtr(api.Protocol("invalid")), Protocol: protocolPtr(api.Protocol("invalid")),
@@ -585,7 +721,7 @@ func TestValidateEndpointSliceUpdate(t *testing.T) {
}, },
oldEndpointSlice: &discovery.EndpointSlice{ oldEndpointSlice: &discovery.EndpointSlice{
ObjectMeta: standardMeta, ObjectMeta: standardMeta,
AddressType: discovery.AddressTypeIP, AddressType: discovery.AddressTypeIPv4,
}, },
expectedErrors: 1, expectedErrors: 1,
}, },
@@ -593,6 +729,8 @@ func TestValidateEndpointSliceUpdate(t *testing.T) {
for name, testCase := range testCases { for name, testCase := range testCases {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.EndpointSliceNodeName, testCase.nodeNameGateEnabled)()
errs := ValidateEndpointSliceUpdate(testCase.newEndpointSlice, testCase.oldEndpointSlice) errs := ValidateEndpointSliceUpdate(testCase.newEndpointSlice, testCase.oldEndpointSlice)
if len(errs) != testCase.expectedErrors { if len(errs) != testCase.expectedErrors {
t.Errorf("Expected %d errors, got %d errors: %v", testCase.expectedErrors, len(errs), errs) t.Errorf("Expected %d errors, got %d errors: %v", testCase.expectedErrors, len(errs), errs)

View File

@@ -51,6 +51,11 @@ func (in *Endpoint) DeepCopyInto(out *Endpoint) {
(*out)[key] = val (*out)[key] = val
} }
} }
if in.NodeName != nil {
in, out := &in.NodeName, &out.NodeName
*out = new(string)
**out = **in
}
return return
} }

View File

@@ -200,57 +200,58 @@ func init() {
} }
var fileDescriptor_772f83c5b34e07a5 = []byte{ var fileDescriptor_772f83c5b34e07a5 = []byte{
// 787 bytes of a gzipped FileDescriptorProto // 801 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x8f, 0xe3, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x8f, 0xe3, 0x44,
0x10, 0x8d, 0x27, 0x13, 0xad, 0xdd, 0xd9, 0x11, 0xbb, 0x2d, 0x0e, 0xd1, 0x00, 0xf6, 0x28, 0x08, 0x10, 0x8d, 0x27, 0x13, 0xd6, 0xee, 0xec, 0x88, 0xdd, 0x16, 0x87, 0x68, 0x00, 0x7b, 0x14, 0x84,
0x11, 0x69, 0xa0, 0x4d, 0x46, 0x80, 0x56, 0x70, 0x1a, 0xc3, 0xf2, 0x21, 0xf1, 0x31, 0xf4, 0xce, 0x88, 0x34, 0xd0, 0x26, 0x23, 0x40, 0x2b, 0x38, 0x8d, 0x61, 0xf9, 0x90, 0x60, 0x19, 0x7a, 0xe7,
0x01, 0x21, 0x0e, 0xf4, 0xd8, 0xb5, 0x8e, 0x49, 0xec, 0xb6, 0xba, 0x3b, 0x91, 0x72, 0xe3, 0x1f, 0x80, 0x10, 0x07, 0x7a, 0xec, 0x5a, 0xc7, 0x24, 0x76, 0x5b, 0xdd, 0x9d, 0x48, 0xb9, 0xf1, 0x0f,
0xc0, 0x0f, 0xe2, 0x88, 0xd0, 0x1c, 0xf7, 0xb8, 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0xe8, 0xfe, 0xad, 0x29, 0x7f, 0x9d, 0x48, 0x85, 0x7f, 0xdc, 0x99, 0x34, 0xd9, 0x6f, 0xd2,
0x48, 0x9b, 0xd9, 0xbc, 0xb3, 0xa7, 0x0b, 0xd3, 0x5e, 0x67, 0xe3, 0x4b, 0x2d, 0x41, 0x2b, 0xa5, 0x9a, 0x6d, 0xe6, 0xdc, 0xde, 0x66, 0x83, 0xf4, 0xa6, 0xfc, 0x1d, 0x1a, 0x25, 0x0a, 0xd2, 0x66,
0x80, 0x5c, 0xdf, 0xb8, 0x83, 0x67, 0x37, 0xee, 0xe0, 0xf9, 0x8d, 0x3b, 0xf8, 0xa5, 0x74, 0xad, 0x36, 0xef, 0xee, 0xe9, 0xc2, 0xb4, 0xd7, 0xd9, 0xf8, 0x4a, 0x4b, 0xd0, 0x4a, 0x29, 0x20, 0xd7,
0xeb, 0xd2, 0xb5, 0x9e, 0x95, 0xae, 0xf5, 0xbc, 0x74, 0xad, 0xbf, 0x4a, 0xd7, 0xfa, 0xed, 0x85, 0x37, 0xee, 0xe0, 0xe9, 0x8d, 0x3b, 0x78, 0x76, 0xe3, 0x0e, 0x7e, 0x29, 0x5d, 0xeb, 0xba, 0x74,
0x3b, 0xf8, 0xc1, 0x6e, 0x34, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xa7, 0x11, 0xa7, 0x0f, 0xd0, 0xad, 0xa7, 0xa5, 0x6b, 0x3d, 0x2b, 0x5d, 0xeb, 0xcf, 0xd2, 0xb5, 0x7e, 0x7b, 0xee, 0x0e, 0x7e,
0x06, 0x00, 0x00, 0xb0, 0x1b, 0xcd, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x03, 0x95, 0x92, 0xa5, 0xfa, 0x06, 0x00,
0x00,
} }
func (m *Endpoint) Marshal() (dAtA []byte, err error) { func (m *Endpoint) Marshal() (dAtA []byte, err error) {
@@ -273,6 +274,13 @@ func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.NodeName != nil {
i -= len(*m.NodeName)
copy(dAtA[i:], *m.NodeName)
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NodeName)))
i--
dAtA[i] = 0x32
}
if len(m.Topology) > 0 { if len(m.Topology) > 0 {
keysForTopology := make([]string, 0, len(m.Topology)) keysForTopology := make([]string, 0, len(m.Topology))
for k := range m.Topology { for k := range m.Topology {
@@ -594,6 +602,10 @@ func (m *Endpoint) Size() (n int) {
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
} }
} }
if m.NodeName != nil {
l = len(*m.NodeName)
n += 1 + l + sovGenerated(uint64(l))
}
return n return n
} }
@@ -707,6 +719,7 @@ func (this *Endpoint) String() string {
`Hostname:` + valueToStringGenerated(this.Hostname) + `,`, `Hostname:` + valueToStringGenerated(this.Hostname) + `,`,
`TargetRef:` + strings.Replace(fmt.Sprintf("%v", this.TargetRef), "ObjectReference", "v1.ObjectReference", 1) + `,`, `TargetRef:` + strings.Replace(fmt.Sprintf("%v", this.TargetRef), "ObjectReference", "v1.ObjectReference", 1) + `,`,
`Topology:` + mapStringForTopology + `,`, `Topology:` + mapStringForTopology + `,`,
`NodeName:` + valueToStringGenerated(this.NodeName) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@@ -1073,6 +1086,39 @@ func (m *Endpoint) Unmarshal(dAtA []byte) error {
} }
m.Topology[mapkey] = mapvalue m.Topology[mapkey] = mapvalue
iNdEx = postIndex iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NodeName", 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.NodeName = &s
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:]) skippy, err := skipGenerated(dAtA[iNdEx:])

View File

@@ -67,8 +67,14 @@ message Endpoint {
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// * topology.kubernetes.io/region: the value indicates the region where the // * topology.kubernetes.io/region: the value indicates the region where the
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// This field will be deprecated in an upcoming release.
// +optional // +optional
map<string, string> topology = 5; map<string, string> topology = 5;
// nodeName represents the name of the Node hosting this endpoint. This can
// be used to determine endpoints local to a Node.
// +optional
optional string nodeName = 6;
} }
// EndpointConditions represents the current condition of an endpoint. // EndpointConditions represents the current condition of an endpoint.

View File

@@ -106,8 +106,13 @@ type Endpoint struct {
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// * topology.kubernetes.io/region: the value indicates the region where the // * topology.kubernetes.io/region: the value indicates the region where the
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// This field will be deprecated in an upcoming release.
// +optional // +optional
Topology map[string]string `json:"topology,omitempty" protobuf:"bytes,5,opt,name=topology"` Topology map[string]string `json:"topology,omitempty" protobuf:"bytes,5,opt,name=topology"`
// nodeName represents the name of the Node hosting this endpoint. This can
// be used to determine endpoints local to a Node.
// +optional
NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,6,opt,name=nodeName"`
} }
// EndpointConditions represents the current condition of an endpoint. // EndpointConditions represents the current condition of an endpoint.

View File

@@ -33,7 +33,8 @@ var map_Endpoint = map[string]string{
"conditions": "conditions contains information about the current status of the endpoint.", "conditions": "conditions contains information about the current status of the endpoint.",
"hostname": "hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS label (RFC 1123) validation.", "hostname": "hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS label (RFC 1123) validation.",
"targetRef": "targetRef is a reference to a Kubernetes object that represents this endpoint.", "targetRef": "targetRef is a reference to a Kubernetes object that represents this endpoint.",
"topology": "topology contains arbitrary topology information associated with the endpoint. These key/value pairs must conform with the label format. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Topology may include a maximum of 16 key/value pairs. This includes, but is not limited to the following well known keys: * kubernetes.io/hostname: the value indicates the hostname of the node\n where the endpoint is located. This should match the corresponding\n node label.\n* topology.kubernetes.io/zone: the value indicates the zone where the\n endpoint is located. This should match the corresponding node label.\n* topology.kubernetes.io/region: the value indicates the region where the\n endpoint is located. This should match the corresponding node label.", "topology": "topology contains arbitrary topology information associated with the endpoint. These key/value pairs must conform with the label format. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Topology may include a maximum of 16 key/value pairs. This includes, but is not limited to the following well known keys: * kubernetes.io/hostname: the value indicates the hostname of the node\n where the endpoint is located. This should match the corresponding\n node label.\n* topology.kubernetes.io/zone: the value indicates the zone where the\n endpoint is located. This should match the corresponding node label.\n* topology.kubernetes.io/region: the value indicates the region where the\n endpoint is located. This should match the corresponding node label.\nThis field will be deprecated in an upcoming release.",
"nodeName": "nodeName represents the name of the Node hosting this endpoint. This can be used to determine endpoints local to a Node.",
} }
func (Endpoint) SwaggerDoc() map[string]string { func (Endpoint) SwaggerDoc() map[string]string {

View File

@@ -51,6 +51,11 @@ func (in *Endpoint) DeepCopyInto(out *Endpoint) {
(*out)[key] = val (*out)[key] = val
} }
} }
if in.NodeName != nil {
in, out := &in.NodeName, &out.NodeName
*out = new(string)
**out = **in
}
return return
} }

View File

@@ -200,56 +200,57 @@ func init() {
} }
var fileDescriptor_ece80bbc872d519b = []byte{ var fileDescriptor_ece80bbc872d519b = []byte{
// 784 bytes of a gzipped FileDescriptorProto // 798 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x8f, 0xe3, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x8f, 0xe3, 0x44,
0x10, 0x8d, 0x27, 0x63, 0x8d, 0xdd, 0xd9, 0x11, 0xbb, 0x2d, 0x0e, 0xd1, 0xb0, 0xb2, 0x47, 0x41, 0x10, 0x8d, 0x27, 0x63, 0xc6, 0xee, 0xec, 0x88, 0xdd, 0x16, 0x87, 0x68, 0x58, 0xd9, 0xa3, 0x20,
0xa0, 0x88, 0xd1, 0xda, 0xcc, 0x6a, 0x85, 0x56, 0x70, 0x1a, 0xc3, 0x08, 0x90, 0x80, 0x8d, 0x7a, 0x50, 0xc4, 0x68, 0x6d, 0x66, 0xb5, 0x42, 0x2b, 0x38, 0x8d, 0x61, 0x04, 0x48, 0xb0, 0x1b, 0xf5,
0x23, 0x21, 0x21, 0x0e, 0x74, 0xec, 0x5a, 0xc7, 0x24, 0x76, 0x5b, 0xdd, 0x9d, 0x48, 0xb9, 0xf1, 0x46, 0x42, 0x42, 0x1c, 0xe8, 0xd8, 0xb5, 0x8e, 0x49, 0xec, 0xb6, 0xba, 0x3b, 0x91, 0x72, 0xe3,
0x0f, 0xe0, 0xf7, 0x70, 0x45, 0x42, 0x73, 0xdc, 0xe3, 0x9e, 0x2c, 0x62, 0xfe, 0xc5, 0x9c, 0x50, 0x1f, 0xc0, 0x7f, 0x42, 0x42, 0x73, 0xdc, 0xe3, 0x9e, 0x2c, 0x62, 0xf8, 0x15, 0x7b, 0x42, 0xdd,
0xb7, 0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 0x14, 0x3c, 0xb9, 0xdb, 0x6e, 0x37, 0xb3, 0x41, 0x76, 0x66, 0x3c, 0x41, 0x66, 0x22, 0x21, 0x6d, 0x26, 0x73, 0x75, 0x9c,
0x3a, 0xbd, 0xd7, 0x5b, 0xa7, 0xf7, 0x66, 0xeb, 0xf4, 0x7e, 0x2a, 0x1d, 0xe3, 0xae, 0x74, 0x8c, 0x09, 0xdd, 0x5d, 0xe7, 0xe2, 0x2b, 0xa5, 0x40, 0x2a, 0xa1, 0xe0, 0xd1, 0xdd, 0xd6, 0xe9, 0xbd,
0xd7, 0xa5, 0x63, 0xbc, 0x29, 0x1d, 0xe3, 0x8f, 0xd2, 0x31, 0x7e, 0xf9, 0xd3, 0xe9, 0x7d, 0x77, 0xda, 0x3a, 0xbd, 0xd7, 0x5b, 0xa7, 0xf7, 0x53, 0xe9, 0x18, 0x77, 0xa5, 0x63, 0xbc, 0x2a, 0x1d,
0x56, 0x4b, 0xfe, 0x15, 0x00, 0x00, 0xff, 0xff, 0x95, 0x55, 0x4b, 0x65, 0xc8, 0x06, 0x00, 0x00, 0xe3, 0x75, 0xe9, 0x18, 0xbf, 0x97, 0x8e, 0xf1, 0xcb, 0x1f, 0x4e, 0xef, 0xbb, 0xb3, 0x5a, 0xf2,
0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x35, 0xe6, 0xf5, 0xf2, 0x06, 0x00, 0x00,
} }
func (m *Endpoint) Marshal() (dAtA []byte, err error) { func (m *Endpoint) Marshal() (dAtA []byte, err error) {
@@ -272,6 +273,13 @@ func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.NodeName != nil {
i -= len(*m.NodeName)
copy(dAtA[i:], *m.NodeName)
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NodeName)))
i--
dAtA[i] = 0x32
}
if len(m.Topology) > 0 { if len(m.Topology) > 0 {
keysForTopology := make([]string, 0, len(m.Topology)) keysForTopology := make([]string, 0, len(m.Topology))
for k := range m.Topology { for k := range m.Topology {
@@ -593,6 +601,10 @@ func (m *Endpoint) Size() (n int) {
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
} }
} }
if m.NodeName != nil {
l = len(*m.NodeName)
n += 1 + l + sovGenerated(uint64(l))
}
return n return n
} }
@@ -706,6 +718,7 @@ func (this *Endpoint) String() string {
`Hostname:` + valueToStringGenerated(this.Hostname) + `,`, `Hostname:` + valueToStringGenerated(this.Hostname) + `,`,
`TargetRef:` + strings.Replace(fmt.Sprintf("%v", this.TargetRef), "ObjectReference", "v1.ObjectReference", 1) + `,`, `TargetRef:` + strings.Replace(fmt.Sprintf("%v", this.TargetRef), "ObjectReference", "v1.ObjectReference", 1) + `,`,
`Topology:` + mapStringForTopology + `,`, `Topology:` + mapStringForTopology + `,`,
`NodeName:` + valueToStringGenerated(this.NodeName) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@@ -1072,6 +1085,39 @@ func (m *Endpoint) Unmarshal(dAtA []byte) error {
} }
m.Topology[mapkey] = mapvalue m.Topology[mapkey] = mapvalue
iNdEx = postIndex iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NodeName", 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.NodeName = &s
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:]) skippy, err := skipGenerated(dAtA[iNdEx:])

View File

@@ -67,8 +67,14 @@ message Endpoint {
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// * topology.kubernetes.io/region: the value indicates the region where the // * topology.kubernetes.io/region: the value indicates the region where the
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// this field will be deprecated in an upcoming release.
// +optional // +optional
map<string, string> topology = 5; map<string, string> topology = 5;
// nodeName represents the name of the Node hosting this endpoint. This can
// be used to determine endpoints local to a Node.
// +optional
optional string nodeName = 6;
} }
// EndpointConditions represents the current condition of an endpoint. // EndpointConditions represents the current condition of an endpoint.

View File

@@ -60,12 +60,6 @@ type EndpointSlice struct {
type AddressType string type AddressType string
const ( const (
// AddressTypeIP represents an IP Address.
// This address type has been deprecated and has been replaced by the IPv4
// and IPv6 adddress types. New resources with this address type will be
// considered invalid. This will be fully removed in 1.18.
// +deprecated
AddressTypeIP = AddressType("IP")
// AddressTypeIPv4 represents an IPv4 Address. // AddressTypeIPv4 represents an IPv4 Address.
AddressTypeIPv4 = AddressType(v1.IPv4Protocol) AddressTypeIPv4 = AddressType(v1.IPv4Protocol)
// AddressTypeIPv6 represents an IPv6 Address. // AddressTypeIPv6 represents an IPv6 Address.
@@ -108,8 +102,13 @@ type Endpoint struct {
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// * topology.kubernetes.io/region: the value indicates the region where the // * topology.kubernetes.io/region: the value indicates the region where the
// endpoint is located. This should match the corresponding node label. // endpoint is located. This should match the corresponding node label.
// this field will be deprecated in an upcoming release.
// +optional // +optional
Topology map[string]string `json:"topology,omitempty" protobuf:"bytes,5,opt,name=topology"` Topology map[string]string `json:"topology,omitempty" protobuf:"bytes,5,opt,name=topology"`
// nodeName represents the name of the Node hosting this endpoint. This can
// be used to determine endpoints local to a Node.
// +optional
NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,6,opt,name=nodeName"`
} }
// EndpointConditions represents the current condition of an endpoint. // EndpointConditions represents the current condition of an endpoint.

View File

@@ -33,7 +33,8 @@ var map_Endpoint = map[string]string{
"conditions": "conditions contains information about the current status of the endpoint.", "conditions": "conditions contains information about the current status of the endpoint.",
"hostname": "hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS Label (RFC 1123) validation.", "hostname": "hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must be lowercase and pass DNS Label (RFC 1123) validation.",
"targetRef": "targetRef is a reference to a Kubernetes object that represents this endpoint.", "targetRef": "targetRef is a reference to a Kubernetes object that represents this endpoint.",
"topology": "topology contains arbitrary topology information associated with the endpoint. These key/value pairs must conform with the label format. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Topology may include a maximum of 16 key/value pairs. This includes, but is not limited to the following well known keys: * kubernetes.io/hostname: the value indicates the hostname of the node\n where the endpoint is located. This should match the corresponding\n node label.\n* topology.kubernetes.io/zone: the value indicates the zone where the\n endpoint is located. This should match the corresponding node label.\n* topology.kubernetes.io/region: the value indicates the region where the\n endpoint is located. This should match the corresponding node label.", "topology": "topology contains arbitrary topology information associated with the endpoint. These key/value pairs must conform with the label format. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Topology may include a maximum of 16 key/value pairs. This includes, but is not limited to the following well known keys: * kubernetes.io/hostname: the value indicates the hostname of the node\n where the endpoint is located. This should match the corresponding\n node label.\n* topology.kubernetes.io/zone: the value indicates the zone where the\n endpoint is located. This should match the corresponding node label.\n* topology.kubernetes.io/region: the value indicates the region where the\n endpoint is located. This should match the corresponding node label.\nthis field will be deprecated in an upcoming release.",
"nodeName": "nodeName represents the name of the Node hosting this endpoint. This can be used to determine endpoints local to a Node.",
} }
func (Endpoint) SwaggerDoc() map[string]string { func (Endpoint) SwaggerDoc() map[string]string {

View File

@@ -51,6 +51,11 @@ func (in *Endpoint) DeepCopyInto(out *Endpoint) {
(*out)[key] = val (*out)[key] = val
} }
} }
if in.NodeName != nil {
in, out := &in.NodeName, &out.NodeName
*out = new(string)
**out = **in
}
return return
} }