Updating EndpointSlice controllers to support NodeName field
This commit is contained in:
@@ -27,10 +27,12 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/leaderelection/resourcelock"
|
||||
"k8s.io/kubernetes/pkg/apis/discovery/validation"
|
||||
endpointutil "k8s.io/kubernetes/pkg/controller/util/endpoint"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
)
|
||||
|
||||
// addrTypePortMapKey is used to uniquely identify groups of endpoint ports and
|
||||
@@ -138,6 +140,9 @@ func addressToEndpoint(address corev1.EndpointAddress, ready bool) *discovery.En
|
||||
endpoint.Topology = map[string]string{
|
||||
"kubernetes.io/hostname": *address.NodeName,
|
||||
}
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceNodeName) {
|
||||
endpoint.NodeName = address.NodeName
|
||||
}
|
||||
}
|
||||
if address.Hostname != "" {
|
||||
endpoint.Hostname = &address.Hostname
|
||||
|
Reference in New Issue
Block a user