Fix label mutation in endpoints controller
This commit is contained in:
@@ -48,6 +48,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
endpointutil "k8s.io/kubernetes/pkg/controller/util/endpoint"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
utillabels "k8s.io/kubernetes/pkg/util/labels"
|
||||
utilnet "k8s.io/utils/net"
|
||||
)
|
||||
|
||||
@@ -503,9 +504,9 @@ func (e *EndpointController) syncService(key string) error {
|
||||
}
|
||||
|
||||
if !helper.IsServiceIPSet(service) {
|
||||
newEndpoints.Labels[v1.IsHeadlessService] = ""
|
||||
newEndpoints.Labels = utillabels.CloneAndAddLabel(newEndpoints.Labels, v1.IsHeadlessService, "")
|
||||
} else {
|
||||
delete(newEndpoints.Labels, v1.IsHeadlessService)
|
||||
newEndpoints.Labels = utillabels.CloneAndRemoveLabel(newEndpoints.Labels, v1.IsHeadlessService)
|
||||
}
|
||||
|
||||
klog.V(4).Infof("Update endpoints for %v/%v, ready: %d not ready: %d", service.Namespace, service.Name, totalReadyEps, totalNotReadyEps)
|
||||
|
Reference in New Issue
Block a user