Adds the statefulset.kubernetes.io/pod-name label allowing users to

attach a Service to an individual Pod.
This commit is contained in:
Kenneth Owens
2017-11-20 09:13:07 -08:00
parent 98fb71e8ce
commit 1ce4ef8229
5 changed files with 21 additions and 3 deletions

View File

@@ -78,6 +78,11 @@ func TestIdentityMatches(t *testing.T) {
if identityMatches(set, pod) {
t.Error("identity matches for a Pod with the wrong namespace")
}
pod = newStatefulSetPod(set, 1)
delete(pod.Labels, apps.StatefulSetPodNameLabel)
if identityMatches(set, pod) {
t.Error("identity matches for a Pod with the wrong statefulSetPodNameLabel")
}
}
func TestStorageMatches(t *testing.T) {
@@ -127,6 +132,11 @@ func TestUpdateIdentity(t *testing.T) {
if !identityMatches(set, pod) {
t.Error("updateIdentity failed to update the Pods namespace")
}
delete(pod.Labels, apps.StatefulSetPodNameLabel)
updateIdentity(set, pod)
if !identityMatches(set, pod) {
t.Error("updateIdentity failed to restore the statefulSetPodName label")
}
}
func TestUpdateStorage(t *testing.T) {