Removed hostname/subdomain annotation.
This commit is contained in:
@@ -20,7 +20,6 @@ go_library(
|
||||
deps = [
|
||||
"//pkg/api:go_default_library",
|
||||
"//pkg/api/v1:go_default_library",
|
||||
"//pkg/api/v1/pod:go_default_library",
|
||||
"//pkg/apis/apps/v1beta1:go_default_library",
|
||||
"//pkg/client/clientset_generated/clientset:go_default_library",
|
||||
"//pkg/client/informers/informers_generated/externalversions/apps/v1beta1:go_default_library",
|
||||
@@ -57,7 +56,6 @@ go_test(
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//pkg/api/v1:go_default_library",
|
||||
"//pkg/api/v1/pod:go_default_library",
|
||||
"//pkg/apis/apps/v1beta1:go_default_library",
|
||||
"//pkg/client/clientset_generated/clientset/fake:go_default_library",
|
||||
"//pkg/client/informers/informers_generated/externalversions:go_default_library",
|
||||
|
@@ -29,7 +29,6 @@ import (
|
||||
"k8s.io/client-go/tools/record"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
podapi "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake"
|
||||
appslisters "k8s.io/kubernetes/pkg/client/listers/apps/v1beta1"
|
||||
@@ -401,7 +400,7 @@ func TestStatefulPodControlUpdatePodConflictFailure(t *testing.T) {
|
||||
fakeClient := &fake.Clientset{}
|
||||
indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
|
||||
updatedPod := newStatefulSetPod(set, 0)
|
||||
updatedPod.Annotations[podapi.PodHostnameAnnotation] = "wrong"
|
||||
updatedPod.Spec.Hostname = "wrong"
|
||||
indexer.Add(updatedPod)
|
||||
podLister := corelisters.NewPodLister(indexer)
|
||||
control := NewRealStatefulPodControl(fakeClient, nil, podLister, nil, recorder)
|
||||
|
@@ -23,7 +23,6 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
podapi "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
|
||||
@@ -108,9 +107,8 @@ func identityMatches(set *apps.StatefulSet, pod *v1.Pod) bool {
|
||||
set.Name == parent &&
|
||||
pod.Name == getPodName(set, ordinal) &&
|
||||
pod.Namespace == set.Namespace &&
|
||||
pod.Annotations != nil &&
|
||||
pod.Annotations[podapi.PodHostnameAnnotation] == pod.Name &&
|
||||
pod.Annotations[podapi.PodSubdomainAnnotation] == set.Spec.ServiceName
|
||||
pod.Spec.Hostname == pod.Name &&
|
||||
pod.Spec.Subdomain == set.Spec.ServiceName
|
||||
}
|
||||
|
||||
// storageMatches returns true if pod's Volumes cover the set of PersistentVolumeClaims
|
||||
@@ -182,11 +180,8 @@ func updateStorage(set *apps.StatefulSet, pod *v1.Pod) {
|
||||
func updateIdentity(set *apps.StatefulSet, pod *v1.Pod) {
|
||||
pod.Name = getPodName(set, getOrdinal(pod))
|
||||
pod.Namespace = set.Namespace
|
||||
if pod.Annotations == nil {
|
||||
pod.Annotations = make(map[string]string)
|
||||
}
|
||||
pod.Annotations[podapi.PodHostnameAnnotation] = pod.Name
|
||||
pod.Annotations[podapi.PodSubdomainAnnotation] = set.Spec.ServiceName
|
||||
pod.Spec.Hostname = pod.Name
|
||||
pod.Spec.Subdomain = set.Spec.ServiceName
|
||||
}
|
||||
|
||||
// isRunningAndReady returns true if pod is in the PodRunning Phase, if it has a condition of PodReady, and if the init
|
||||
|
@@ -29,7 +29,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
podapi "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
)
|
||||
@@ -79,12 +78,12 @@ func TestIdentityMatches(t *testing.T) {
|
||||
t.Error("identity matches for a Pod with the wrong namespace")
|
||||
}
|
||||
pod = newStatefulSetPod(set, 1)
|
||||
delete(pod.Annotations, podapi.PodHostnameAnnotation)
|
||||
pod.Spec.Hostname = ""
|
||||
if identityMatches(set, pod) {
|
||||
t.Error("identity matches for a Pod with no hostname")
|
||||
}
|
||||
pod = newStatefulSetPod(set, 1)
|
||||
delete(pod.Annotations, podapi.PodSubdomainAnnotation)
|
||||
pod.Spec.Subdomain = ""
|
||||
if identityMatches(set, pod) {
|
||||
t.Error("identity matches for a Pod with no subdomain")
|
||||
}
|
||||
@@ -138,7 +137,7 @@ func TestUpdateIdentity(t *testing.T) {
|
||||
t.Error("updateIdentity failed to update the Pods namespace")
|
||||
}
|
||||
pod = newStatefulSetPod(set, 1)
|
||||
delete(pod.Annotations, podapi.PodHostnameAnnotation)
|
||||
pod.Spec.Hostname = ""
|
||||
if identityMatches(set, pod) {
|
||||
t.Error("identity matches for a Pod with no hostname")
|
||||
}
|
||||
@@ -147,7 +146,7 @@ func TestUpdateIdentity(t *testing.T) {
|
||||
t.Error("updateIdentity failed to update the Pod's hostname")
|
||||
}
|
||||
pod = newStatefulSetPod(set, 1)
|
||||
delete(pod.Annotations, podapi.PodSubdomainAnnotation)
|
||||
pod.Spec.Subdomain = ""
|
||||
if identityMatches(set, pod) {
|
||||
t.Error("identity matches for a Pod with no subdomain")
|
||||
}
|
||||
@@ -155,15 +154,6 @@ func TestUpdateIdentity(t *testing.T) {
|
||||
if !identityMatches(set, pod) {
|
||||
t.Error("updateIdentity failed to update the Pod's subdomain")
|
||||
}
|
||||
pod = newStatefulSetPod(set, 1)
|
||||
pod.Annotations = nil
|
||||
if identityMatches(set, pod) {
|
||||
t.Error("identity matches for a Pod no annotations")
|
||||
}
|
||||
updateIdentity(set, pod)
|
||||
if !identityMatches(set, pod) {
|
||||
t.Error("updateIdentity failed to update the Pod's annotations")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateStorage(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user