Change:
bug (): Originally posted by in cc /sig network /priority critical-urgent
fix in
/triage unresolved Comment when the issue is assessed and confirmed. I am a bot run by vllry. ‍

Discussion:
"//pkg/controller:go_default_library", "//pkg/controller/util/endpoint:go_default_library", "//pkg/features:go_default_library", <ins> "//pkg/util/labels:go_default_library", </ins> "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",

"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", <ins> "//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library", </ins> "//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",

"k8s.io/kubernetes/pkg/controller" endpointutil "k8s.io/kubernetes/pkg/controller/util/endpoint" "k8s.io/kubernetes/pkg/features" <ins> utillabels "k8s.io/kubernetes/pkg/util/labels" </ins> utilnet "k8s.io/utils/net" )

} if !helper.IsServiceIPSet(service) { <del> newEndpoints.Labels[v1.IsHeadlessService] = "" </del> <ins> newEndpoints.Labels = utillabels.CloneAndAddLabel(newEndpoints.Labels, v1.IsHeadlessService, "") </ins> } else { <del> delete(newEndpoints.Labels, v1.IsHeadlessService) </del> <ins> newEndpoints.Labels = utillabels.CloneAndRemoveLabel(newEndpoints.Labels, v1.IsHeadlessService) </ins> } klog.V(4).Infof("Update endpoints for %v/%v, ready: %d not ready: %d", service.Namespace, service.Name, totalReadyEps, totalNotReadyEps)

"fmt" "net/http" "net/http/httptest" <ins> "reflect" </ins> "strconv" "testing" "time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" <ins> "k8s.io/apimachinery/pkg/util/diff" </ins> "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" utilfeature "k8s.io/apiserver/pkg/util/feature"

}}, }) addPods(endpoints.podStore, ns, 1, 1, 0, false) <del> endpoints.serviceStore.Add(&v1.Service{ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: ns}, </del> <ins> service := &v1.Service{ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: ns, Labels: map[string]string{"a": "b"}}, </ins> Spec: v1.ServiceSpec{ Selector:  map[string]string{}, ClusterIP: api.ClusterIPNone, Ports:     []v1.ServicePort{}, }, <del> }) </del> <ins> } originalService := service.DeepCopy() endpoints.serviceStore.Add(service) </ins> endpoints.syncService(ns + "/foo") data := runtime.EncodeOrDie(testapi.Default.Codec(), &v1.Endpoints{ ObjectMeta: metav1.ObjectMeta{

Namespace:       ns, ResourceVersion: "1", Labels: map[string]string{ <ins> "a":                  "b", </ins> v1.IsHeadlessService: "", }, },

Ports:     []v1.EndpointPort{}, }}, }) <ins> if !reflect.DeepEqual(originalService, service) { t.Fatalf("syncing endpoints changed service: %s", diff.ObjectReflectDiff(service, originalService)) } </ins> endpointsHandler.ValidateRequestCount(t, 1) endpointsHandler.ValidateRequest(t, testapi.Default.ResourcePath("endpoints", ns, "foo"), "PUT", &data) }