De-share the Handler struct in core API (#105979)
* De-share the Handler struct in core API An upcoming PR adds a handler that only applies on one of these paths. Having fields that don't work seems bad. This never should have been shared. Lifecycle hooks are like a "write" while probes are more like a "read". HTTPGet and TCPSocket don't really make sense as lifecycle hooks (but I can't take that back). When we add gRPC, it is EXPLICITLY a health check (defined by gRPC) not an arbitrary RPC - so a probe makes sense but a hook does not. In the future I can also see adding lifecycle hooks that don't make sense as probes. E.g. 'sleep' is a common lifecycle request. The only option is `exec`, which requires having a sleep binary in your image. * Run update scripts
This commit is contained in:
@@ -51,88 +51,88 @@ func TestWorkloadDefaults(t *testing.T) {
|
||||
// Forbidden: changing an existing default value
|
||||
// Allowed: adding a new field `MyContainer *MyType` and defaulting a child of that type (e.g. `MyContainer.MyChildField`) if and only if MyContainer is non-nil
|
||||
expectedDefaults := map[string]string{
|
||||
".Spec.Containers[0].Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.Containers[0].ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.Containers[0].Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].LivenessProbe.FailureThreshold": `3`,
|
||||
".Spec.Containers[0].LivenessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].LivenessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].LivenessProbe.PeriodSeconds": `10`,
|
||||
".Spec.Containers[0].LivenessProbe.SuccessThreshold": `1`,
|
||||
".Spec.Containers[0].LivenessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.Containers[0].Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.Containers[0].ReadinessProbe.FailureThreshold": `3`,
|
||||
".Spec.Containers[0].ReadinessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].ReadinessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].ReadinessProbe.PeriodSeconds": `10`,
|
||||
".Spec.Containers[0].ReadinessProbe.SuccessThreshold": `1`,
|
||||
".Spec.Containers[0].ReadinessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.Containers[0].StartupProbe.FailureThreshold": "3",
|
||||
".Spec.Containers[0].StartupProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].StartupProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.Containers[0].StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.Containers[0].StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.Containers[0].TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.Containers[0].TerminationMessagePolicy": `"File"`,
|
||||
".Spec.Containers[0].Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.Containers[0].ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.Containers[0].Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].LivenessProbe.FailureThreshold": `3`,
|
||||
".Spec.Containers[0].LivenessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].LivenessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].LivenessProbe.PeriodSeconds": `10`,
|
||||
".Spec.Containers[0].LivenessProbe.SuccessThreshold": `1`,
|
||||
".Spec.Containers[0].LivenessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.Containers[0].Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.Containers[0].ReadinessProbe.FailureThreshold": `3`,
|
||||
".Spec.Containers[0].ReadinessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].ReadinessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].ReadinessProbe.PeriodSeconds": `10`,
|
||||
".Spec.Containers[0].ReadinessProbe.SuccessThreshold": `1`,
|
||||
".Spec.Containers[0].ReadinessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.Containers[0].StartupProbe.FailureThreshold": "3",
|
||||
".Spec.Containers[0].StartupProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].StartupProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.Containers[0].StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.Containers[0].StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.Containers[0].TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.Containers[0].TerminationMessagePolicy": `"File"`,
|
||||
".Spec.DNSPolicy": `"ClusterFirst"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.TerminationMessagePolicy": `"File"`,
|
||||
".Spec.InitContainers[0].Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.InitContainers[0].ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.FailureThreshold": `3`,
|
||||
".Spec.InitContainers[0].LivenessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.PeriodSeconds": `10`,
|
||||
".Spec.InitContainers[0].LivenessProbe.SuccessThreshold": `1`,
|
||||
".Spec.InitContainers[0].LivenessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.InitContainers[0].Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.FailureThreshold": `3`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.PeriodSeconds": `10`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.SuccessThreshold": `1`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.InitContainers[0].StartupProbe.FailureThreshold": "3",
|
||||
".Spec.InitContainers[0].StartupProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].StartupProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.InitContainers[0].StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.InitContainers[0].StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.InitContainers[0].TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.InitContainers[0].TerminationMessagePolicy": `"File"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.TerminationMessagePolicy": `"File"`,
|
||||
".Spec.InitContainers[0].Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.InitContainers[0].ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.FailureThreshold": `3`,
|
||||
".Spec.InitContainers[0].LivenessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.PeriodSeconds": `10`,
|
||||
".Spec.InitContainers[0].LivenessProbe.SuccessThreshold": `1`,
|
||||
".Spec.InitContainers[0].LivenessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.InitContainers[0].Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.FailureThreshold": `3`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.PeriodSeconds": `10`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.SuccessThreshold": `1`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.InitContainers[0].StartupProbe.FailureThreshold": "3",
|
||||
".Spec.InitContainers[0].StartupProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].StartupProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.InitContainers[0].StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.InitContainers[0].StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.InitContainers[0].TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.InitContainers[0].TerminationMessagePolicy": `"File"`,
|
||||
".Spec.RestartPolicy": `"Always"`,
|
||||
".Spec.SchedulerName": `"default-scheduler"`,
|
||||
".Spec.SecurityContext": `{}`,
|
||||
@@ -175,91 +175,91 @@ func TestPodDefaults(t *testing.T) {
|
||||
// Forbidden: changing an existing default value
|
||||
// Allowed: adding a new field `MyContainer *MyType` and defaulting a child of that type (e.g. `MyContainer.MyChildField`) if and only if MyContainer is non-nil
|
||||
expectedDefaults := map[string]string{
|
||||
".Spec.Containers[0].Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.Containers[0].ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.Containers[0].Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].LivenessProbe.FailureThreshold": `3`,
|
||||
".Spec.Containers[0].LivenessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].LivenessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].LivenessProbe.PeriodSeconds": `10`,
|
||||
".Spec.Containers[0].LivenessProbe.SuccessThreshold": `1`,
|
||||
".Spec.Containers[0].LivenessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.Containers[0].Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.Containers[0].ReadinessProbe.FailureThreshold": `3`,
|
||||
".Spec.Containers[0].ReadinessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].ReadinessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].ReadinessProbe.PeriodSeconds": `10`,
|
||||
".Spec.Containers[0].ReadinessProbe.SuccessThreshold": `1`,
|
||||
".Spec.Containers[0].ReadinessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.Containers[0].Resources.Requests": `{"":"0"}`, // this gets defaulted from the limits field
|
||||
".Spec.Containers[0].StartupProbe.FailureThreshold": "3",
|
||||
".Spec.Containers[0].StartupProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].StartupProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.Containers[0].StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.Containers[0].StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.Containers[0].TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.Containers[0].TerminationMessagePolicy": `"File"`,
|
||||
".Spec.Containers[0].Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.Containers[0].ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.Containers[0].Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].LivenessProbe.FailureThreshold": `3`,
|
||||
".Spec.Containers[0].LivenessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].LivenessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].LivenessProbe.PeriodSeconds": `10`,
|
||||
".Spec.Containers[0].LivenessProbe.SuccessThreshold": `1`,
|
||||
".Spec.Containers[0].LivenessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.Containers[0].Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.Containers[0].ReadinessProbe.FailureThreshold": `3`,
|
||||
".Spec.Containers[0].ReadinessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].ReadinessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].ReadinessProbe.PeriodSeconds": `10`,
|
||||
".Spec.Containers[0].ReadinessProbe.SuccessThreshold": `1`,
|
||||
".Spec.Containers[0].ReadinessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.Containers[0].Resources.Requests": `{"":"0"}`, // this gets defaulted from the limits field
|
||||
".Spec.Containers[0].StartupProbe.FailureThreshold": "3",
|
||||
".Spec.Containers[0].StartupProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.Containers[0].StartupProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.Containers[0].StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.Containers[0].StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.Containers[0].StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.Containers[0].TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.Containers[0].TerminationMessagePolicy": `"File"`,
|
||||
".Spec.DNSPolicy": `"ClusterFirst"`,
|
||||
".Spec.EnableServiceLinks": `true`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.TerminationMessagePolicy": `"File"`,
|
||||
".Spec.InitContainers[0].Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.InitContainers[0].ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.FailureThreshold": `3`,
|
||||
".Spec.InitContainers[0].LivenessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.PeriodSeconds": `10`,
|
||||
".Spec.InitContainers[0].LivenessProbe.SuccessThreshold": `1`,
|
||||
".Spec.InitContainers[0].LivenessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.InitContainers[0].Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.FailureThreshold": `3`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.PeriodSeconds": `10`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.SuccessThreshold": `1`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.InitContainers[0].Resources.Requests": `{"":"0"}`, // this gets defaulted from the limits field
|
||||
".Spec.InitContainers[0].TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.InitContainers[0].TerminationMessagePolicy": `"File"`,
|
||||
".Spec.InitContainers[0].StartupProbe.FailureThreshold": "3",
|
||||
".Spec.InitContainers[0].StartupProbe.Handler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].StartupProbe.Handler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.InitContainers[0].StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.InitContainers[0].StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.LivenessProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.ReadinessProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.FailureThreshold": "3",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.EphemeralContainers[0].EphemeralContainerCommon.TerminationMessagePolicy": `"File"`,
|
||||
".Spec.InitContainers[0].Env[0].ValueFrom.FieldRef.APIVersion": `"v1"`,
|
||||
".Spec.InitContainers[0].ImagePullPolicy": `"IfNotPresent"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PostStart.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PostStart.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PreStop.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].Lifecycle.PreStop.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.FailureThreshold": `3`,
|
||||
".Spec.InitContainers[0].LivenessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].LivenessProbe.PeriodSeconds": `10`,
|
||||
".Spec.InitContainers[0].LivenessProbe.SuccessThreshold": `1`,
|
||||
".Spec.InitContainers[0].LivenessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.InitContainers[0].Ports[0].Protocol": `"TCP"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.FailureThreshold": `3`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.PeriodSeconds": `10`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.SuccessThreshold": `1`,
|
||||
".Spec.InitContainers[0].ReadinessProbe.TimeoutSeconds": `1`,
|
||||
".Spec.InitContainers[0].Resources.Requests": `{"":"0"}`, // this gets defaulted from the limits field
|
||||
".Spec.InitContainers[0].TerminationMessagePath": `"/dev/termination-log"`,
|
||||
".Spec.InitContainers[0].TerminationMessagePolicy": `"File"`,
|
||||
".Spec.InitContainers[0].StartupProbe.FailureThreshold": "3",
|
||||
".Spec.InitContainers[0].StartupProbe.ProbeHandler.HTTPGet.Path": `"/"`,
|
||||
".Spec.InitContainers[0].StartupProbe.ProbeHandler.HTTPGet.Scheme": `"HTTP"`,
|
||||
".Spec.InitContainers[0].StartupProbe.PeriodSeconds": "10",
|
||||
".Spec.InitContainers[0].StartupProbe.SuccessThreshold": "1",
|
||||
".Spec.InitContainers[0].StartupProbe.TimeoutSeconds": "1",
|
||||
".Spec.RestartPolicy": `"Always"`,
|
||||
".Spec.SchedulerName": `"default-scheduler"`,
|
||||
".Spec.SecurityContext": `{}`,
|
||||
@@ -676,8 +676,8 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
|
||||
assertProb := func(got, expected *v1.Container) error {
|
||||
// Assert LivenessProbe
|
||||
if got.LivenessProbe.Handler.HTTPGet.Path != expected.LivenessProbe.Handler.HTTPGet.Path ||
|
||||
got.LivenessProbe.Handler.HTTPGet.Scheme != expected.LivenessProbe.Handler.HTTPGet.Scheme ||
|
||||
if got.LivenessProbe.ProbeHandler.HTTPGet.Path != expected.LivenessProbe.ProbeHandler.HTTPGet.Path ||
|
||||
got.LivenessProbe.ProbeHandler.HTTPGet.Scheme != expected.LivenessProbe.ProbeHandler.HTTPGet.Scheme ||
|
||||
got.LivenessProbe.FailureThreshold != expected.LivenessProbe.FailureThreshold ||
|
||||
got.LivenessProbe.SuccessThreshold != expected.LivenessProbe.SuccessThreshold ||
|
||||
got.LivenessProbe.PeriodSeconds != expected.LivenessProbe.PeriodSeconds ||
|
||||
@@ -686,8 +686,8 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
}
|
||||
|
||||
// Assert ReadinessProbe
|
||||
if got.ReadinessProbe.Handler.HTTPGet.Path != expected.ReadinessProbe.Handler.HTTPGet.Path ||
|
||||
got.ReadinessProbe.Handler.HTTPGet.Scheme != expected.ReadinessProbe.Handler.HTTPGet.Scheme ||
|
||||
if got.ReadinessProbe.ProbeHandler.HTTPGet.Path != expected.ReadinessProbe.ProbeHandler.HTTPGet.Path ||
|
||||
got.ReadinessProbe.ProbeHandler.HTTPGet.Scheme != expected.ReadinessProbe.ProbeHandler.HTTPGet.Scheme ||
|
||||
got.ReadinessProbe.FailureThreshold != expected.ReadinessProbe.FailureThreshold ||
|
||||
got.ReadinessProbe.SuccessThreshold != expected.ReadinessProbe.SuccessThreshold ||
|
||||
got.ReadinessProbe.PeriodSeconds != expected.ReadinessProbe.PeriodSeconds ||
|
||||
@@ -869,14 +869,14 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
Name: "fun",
|
||||
Image: "alpine",
|
||||
LivenessProbe: &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Host: "localhost",
|
||||
},
|
||||
},
|
||||
},
|
||||
ReadinessProbe: &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Host: "localhost",
|
||||
},
|
||||
@@ -891,7 +891,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
expected: []v1.Container{
|
||||
{
|
||||
LivenessProbe: &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Path: "/",
|
||||
Scheme: v1.URISchemeHTTP,
|
||||
@@ -903,7 +903,7 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
FailureThreshold: 3,
|
||||
},
|
||||
ReadinessProbe: &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Path: "/",
|
||||
Scheme: v1.URISchemeHTTP,
|
||||
@@ -934,12 +934,12 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Lifecycle: &v1.Lifecycle{
|
||||
PostStart: &v1.Handler{
|
||||
PostStart: &v1.LifecycleHandler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Host: "localhost",
|
||||
},
|
||||
},
|
||||
PreStop: &v1.Handler{
|
||||
PreStop: &v1.LifecycleHandler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Host: "localhost",
|
||||
},
|
||||
@@ -954,13 +954,13 @@ func TestSetDefaultReplicationControllerInitContainers(t *testing.T) {
|
||||
expected: []v1.Container{
|
||||
{
|
||||
Lifecycle: &v1.Lifecycle{
|
||||
PostStart: &v1.Handler{
|
||||
PostStart: &v1.LifecycleHandler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Path: "/",
|
||||
Scheme: v1.URISchemeHTTP,
|
||||
},
|
||||
},
|
||||
PreStop: &v1.Handler{
|
||||
PreStop: &v1.LifecycleHandler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Path: "/",
|
||||
Scheme: v1.URISchemeHTTP,
|
||||
|
Reference in New Issue
Block a user