diff --git a/pkg/api/endpoints/util.go b/pkg/api/endpoints/util.go index 792a2536fef..a67521cd9f9 100644 --- a/pkg/api/endpoints/util.go +++ b/pkg/api/endpoints/util.go @@ -28,18 +28,6 @@ import ( hashutil "k8s.io/kubernetes/pkg/util/hash" ) -const ( - // TODO: to be deleted after v1.3 is released - // Its value is the json representation of map[string(IP)][HostRecord] - // example: '{"10.245.1.6":{"HostName":"my-webserver"}}' - PodHostnamesAnnotation = "endpoints.beta.kubernetes.io/hostnames-map" -) - -// TODO: to be deleted after v1.3 is released -type HostRecord struct { - HostName string -} - // RepackSubsets takes a slice of EndpointSubset objects, expands it to the full // representation, and then repacks that into the canonical layout. This // ensures that code which operates on these objects can rely on the common diff --git a/pkg/api/v1/endpoints/util.go b/pkg/api/v1/endpoints/util.go index c81999f370f..0ecac9c6c14 100644 --- a/pkg/api/v1/endpoints/util.go +++ b/pkg/api/v1/endpoints/util.go @@ -28,18 +28,6 @@ import ( hashutil "k8s.io/kubernetes/pkg/util/hash" ) -const ( - // TODO: to be deleted after v1.3 is released - // Its value is the json representation of map[string(IP)][HostRecord] - // example: '{"10.245.1.6":{"HostName":"my-webserver"}}' - PodHostnamesAnnotation = "endpoints.beta.kubernetes.io/hostnames-map" -) - -// TODO: to be deleted after v1.3 is released -type HostRecord struct { - HostName string -} - // RepackSubsets takes a slice of EndpointSubset objects, expands it to the full // representation, and then repacks that into the canonical layout. This // ensures that code which operates on these objects can rely on the common diff --git a/pkg/api/validation/BUILD b/pkg/api/validation/BUILD index 0b4d273953e..e6e524dc7ce 100644 --- a/pkg/api/validation/BUILD +++ b/pkg/api/validation/BUILD @@ -19,7 +19,6 @@ go_library( tags = ["automanaged"], deps = [ "//pkg/api:go_default_library", - "//pkg/api/endpoints:go_default_library", "//pkg/api/meta:go_default_library", "//pkg/api/pod:go_default_library", "//pkg/api/resource:go_default_library", diff --git a/pkg/api/validation/validation.go b/pkg/api/validation/validation.go index c568398dd9b..773e021d18f 100644 --- a/pkg/api/validation/validation.go +++ b/pkg/api/validation/validation.go @@ -28,7 +28,6 @@ import ( "github.com/golang/glog" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/endpoints" utilpod "k8s.io/kubernetes/pkg/api/pod" "k8s.io/kubernetes/pkg/api/resource" apiservice "k8s.io/kubernetes/pkg/api/service" @@ -183,13 +182,6 @@ func ValidatePodSpecificAnnotationUpdates(newPod, oldPod *api.Pod, fldPath *fiel func ValidateEndpointsSpecificAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList { allErrs := field.ErrorList{} - // TODO: remove this after we EOL the annotation. - hostnamesMap, exists := annotations[endpoints.PodHostnamesAnnotation] - if exists && !isValidHostnamesMap(hostnamesMap) { - allErrs = append(allErrs, field.Invalid(fldPath, endpoints.PodHostnamesAnnotation, - `must be a valid json representation of map[string(IP)][HostRecord] e.g. "{"10.245.1.6":{"HostName":"my-webserver"}}"`)) - } - return allErrs } @@ -3729,28 +3721,6 @@ func ValidateLoadBalancerStatus(status *api.LoadBalancerStatus, fldPath *field.P return allErrs } -// TODO: remove this after we EOL the annotation that carries it. -func isValidHostnamesMap(serializedPodHostNames string) bool { - if len(serializedPodHostNames) == 0 { - return false - } - podHostNames := map[string]endpoints.HostRecord{} - err := json.Unmarshal([]byte(serializedPodHostNames), &podHostNames) - if err != nil { - return false - } - - for ip, hostRecord := range podHostNames { - if len(validation.IsDNS1123Label(hostRecord.HostName)) != 0 { - return false - } - if net.ParseIP(ip) == nil { - return false - } - } - return true -} - func sysctlIntersection(a []api.Sysctl, b []api.Sysctl) []string { lookup := make(map[string]struct{}, len(a)) result := []string{} diff --git a/pkg/controller/endpoint/endpoints_controller.go b/pkg/controller/endpoint/endpoints_controller.go index 1dd94f9d9b1..e05e7833f0f 100644 --- a/pkg/controller/endpoint/endpoints_controller.go +++ b/pkg/controller/endpoint/endpoints_controller.go @@ -22,8 +22,6 @@ import ( "strconv" "time" - "encoding/json" - "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/api/v1/endpoints" @@ -375,7 +373,6 @@ func (e *EndpointController) syncService(key string) error { } subsets := []v1.EndpointSubset{} - podHostNames := map[string]endpoints.HostRecord{} var tolerateUnreadyEndpoints bool if v, ok := service.Annotations[TolerateUnreadyEndpointsAnnotation]; ok { @@ -428,11 +425,6 @@ func (e *EndpointController) syncService(key string) error { if len(hostname) > 0 && getSubdomain(pod) == service.Name && service.Namespace == pod.Namespace { - hostRecord := endpoints.HostRecord{ - HostName: hostname, - } - // TODO: stop populating podHostNames annotation in 1.4 - podHostNames[string(pod.Status.PodIP)] = hostRecord epa.Hostname = hostname } @@ -469,17 +461,6 @@ func (e *EndpointController) syncService(key string) error { } } - serializedPodHostNames := "" - if len(podHostNames) > 0 { - b, err := json.Marshal(podHostNames) - if err != nil { - return err - } - serializedPodHostNames = string(b) - } - - newAnnotations := make(map[string]string) - newAnnotations[endpoints.PodHostnamesAnnotation] = serializedPodHostNames if reflect.DeepEqual(currentEndpoints.Subsets, subsets) && reflect.DeepEqual(currentEndpoints.Labels, service.Labels) { glog.V(5).Infof("endpoints are equal for %s/%s, skipping update", service.Namespace, service.Name) @@ -491,11 +472,6 @@ func (e *EndpointController) syncService(key string) error { if newEndpoints.Annotations == nil { newEndpoints.Annotations = make(map[string]string) } - if len(serializedPodHostNames) == 0 { - delete(newEndpoints.Annotations, endpoints.PodHostnamesAnnotation) - } else { - newEndpoints.Annotations[endpoints.PodHostnamesAnnotation] = serializedPodHostNames - } glog.V(4).Infof("Update endpoints for %v/%v, ready: %d not ready: %d", service.Namespace, service.Name, readyEps, notReadyEps) createEndpoints := len(currentEndpoints.ResourceVersion) == 0