kubelet: Make service environment variables optional

This commit is contained in:
Brad Hoekstra
2018-09-17 16:27:36 -04:00
parent 690179b122
commit ac8799a80d
43 changed files with 1413 additions and 867 deletions

View File

@@ -61,6 +61,7 @@ func newStorage(t *testing.T) (*REST, *BindingREST, *StatusREST, *etcdtesting.Et
func validNewPod() *api.Pod {
grace := int64(30)
enableServiceLinks := api.DefaultEnableServiceLinks
return &api.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
@@ -82,8 +83,9 @@ func validNewPod() *api.Pod {
SecurityContext: securitycontext.ValidInternalSecurityContextWithContainerDefaults(),
},
},
SecurityContext: &api.PodSecurityContext{},
SchedulerName: api.DefaultSchedulerName,
SecurityContext: &api.PodSecurityContext{},
SchedulerName: api.DefaultSchedulerName,
EnableServiceLinks: &enableServiceLinks,
},
}
}
@@ -832,6 +834,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
}
grace := int64(30)
enableServiceLinks := api.DefaultEnableServiceLinks
podIn := api.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
@@ -855,6 +858,7 @@ func TestEtcdUpdateScheduled(t *testing.T) {
TerminationGracePeriodSeconds: &grace,
SecurityContext: &api.PodSecurityContext{},
SchedulerName: api.DefaultSchedulerName,
EnableServiceLinks: &enableServiceLinks,
},
}
_, _, err = storage.Update(ctx, podIn.Name, rest.DefaultUpdatedObjectInfo(&podIn), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{})
@@ -932,9 +936,11 @@ func TestEtcdUpdateStatus(t *testing.T) {
expected := podStart
expected.ResourceVersion = "2"
grace := int64(30)
enableServiceLinks := api.DefaultEnableServiceLinks
expected.Spec.TerminationGracePeriodSeconds = &grace
expected.Spec.RestartPolicy = api.RestartPolicyAlways
expected.Spec.DNSPolicy = api.DNSClusterFirst
expected.Spec.EnableServiceLinks = &enableServiceLinks
expected.Spec.Containers[0].ImagePullPolicy = api.PullIfNotPresent
expected.Spec.Containers[0].TerminationMessagePath = api.TerminationMessagePathDefault
expected.Spec.Containers[0].TerminationMessagePolicy = api.TerminationMessageReadFile