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:
Tim Hockin
2021-10-29 13:15:11 -07:00
committed by GitHub
parent adff4a75ad
commit 11a25bfeb6
55 changed files with 2625 additions and 2093 deletions

View File

@@ -2022,7 +2022,7 @@ type ExecAction struct {
// alive or ready to receive traffic.
type Probe struct {
// The action taken to determine the health of a container
Handler
ProbeHandler
// Length of time before health checking is activated. In seconds.
// +optional
InitialDelaySeconds int32
@@ -2188,9 +2188,29 @@ type Container struct {
TTY bool
}
// Handler defines a specific action that should be taken
// ProbeHandler defines a specific action that should be taken in a probe.
// This type has a strong relationship to LifecycleHandler - overlapping fields
// should be identical.
// TODO: pass structured data to these actions, and document that data here.
type Handler struct {
type ProbeHandler struct {
// One and only one of the following should be specified.
// Exec specifies the action to take.
// +optional
Exec *ExecAction
// HTTPGet specifies the http request to perform.
// +optional
HTTPGet *HTTPGetAction
// TCPSocket specifies an action involving a TCP port.
// TODO: implement a realistic TCP lifecycle hook
// +optional
TCPSocket *TCPSocketAction
}
// LifecycleHandler defines a specific action that should be taken in a lifecycle
// hook. This type has a strong relationship to ProbeHandler - overlapping fields
// should be identical.
// TODO: pass structured data to these actions, and document that data here.
type LifecycleHandler struct {
// One and only one of the following should be specified.
// Exec specifies the action to take.
// +optional
@@ -2211,7 +2231,7 @@ type Lifecycle struct {
// PostStart is called immediately after a container is created. If the handler fails, the container
// is terminated and restarted.
// +optional
PostStart *Handler
PostStart *LifecycleHandler
// PreStop is called immediately before a container is terminated due to an
// API request or management event such as liveness/startup probe failure,
// preemption, resource contention, etc. The handler is not called if the
@@ -2222,7 +2242,7 @@ type Lifecycle struct {
// period. Other management of the container blocks until the hook completes
// or until the termination grace period is reached.
// +optional
PreStop *Handler
PreStop *LifecycleHandler
}
// The below types are used by kube_client and api_server.

View File

@@ -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,

View File

@@ -692,16 +692,6 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.Handler)(nil), (*core.Handler)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_Handler_To_core_Handler(a.(*v1.Handler), b.(*core.Handler), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*core.Handler)(nil), (*v1.Handler)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_core_Handler_To_v1_Handler(a.(*core.Handler), b.(*v1.Handler), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.HostAlias)(nil), (*core.HostAlias)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_HostAlias_To_core_HostAlias(a.(*v1.HostAlias), b.(*core.HostAlias), scope)
}); err != nil {
@@ -762,6 +752,16 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.LifecycleHandler)(nil), (*core.LifecycleHandler)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_LifecycleHandler_To_core_LifecycleHandler(a.(*v1.LifecycleHandler), b.(*core.LifecycleHandler), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*core.LifecycleHandler)(nil), (*v1.LifecycleHandler)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_core_LifecycleHandler_To_v1_LifecycleHandler(a.(*core.LifecycleHandler), b.(*v1.LifecycleHandler), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.LimitRange)(nil), (*core.LimitRange)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_LimitRange_To_core_LimitRange(a.(*v1.LimitRange), b.(*core.LimitRange), scope)
}); err != nil {
@@ -1452,6 +1452,16 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.ProbeHandler)(nil), (*core.ProbeHandler)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_ProbeHandler_To_core_ProbeHandler(a.(*v1.ProbeHandler), b.(*core.ProbeHandler), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*core.ProbeHandler)(nil), (*v1.ProbeHandler)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_core_ProbeHandler_To_v1_ProbeHandler(a.(*core.ProbeHandler), b.(*v1.ProbeHandler), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.ProjectedVolumeSource)(nil), (*core.ProjectedVolumeSource)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_ProjectedVolumeSource_To_core_ProjectedVolumeSource(a.(*v1.ProjectedVolumeSource), b.(*core.ProjectedVolumeSource), scope)
}); err != nil {
@@ -3941,30 +3951,6 @@ func Convert_core_HTTPHeader_To_v1_HTTPHeader(in *core.HTTPHeader, out *v1.HTTPH
return autoConvert_core_HTTPHeader_To_v1_HTTPHeader(in, out, s)
}
func autoConvert_v1_Handler_To_core_Handler(in *v1.Handler, out *core.Handler, s conversion.Scope) error {
out.Exec = (*core.ExecAction)(unsafe.Pointer(in.Exec))
out.HTTPGet = (*core.HTTPGetAction)(unsafe.Pointer(in.HTTPGet))
out.TCPSocket = (*core.TCPSocketAction)(unsafe.Pointer(in.TCPSocket))
return nil
}
// Convert_v1_Handler_To_core_Handler is an autogenerated conversion function.
func Convert_v1_Handler_To_core_Handler(in *v1.Handler, out *core.Handler, s conversion.Scope) error {
return autoConvert_v1_Handler_To_core_Handler(in, out, s)
}
func autoConvert_core_Handler_To_v1_Handler(in *core.Handler, out *v1.Handler, s conversion.Scope) error {
out.Exec = (*v1.ExecAction)(unsafe.Pointer(in.Exec))
out.HTTPGet = (*v1.HTTPGetAction)(unsafe.Pointer(in.HTTPGet))
out.TCPSocket = (*v1.TCPSocketAction)(unsafe.Pointer(in.TCPSocket))
return nil
}
// Convert_core_Handler_To_v1_Handler is an autogenerated conversion function.
func Convert_core_Handler_To_v1_Handler(in *core.Handler, out *v1.Handler, s conversion.Scope) error {
return autoConvert_core_Handler_To_v1_Handler(in, out, s)
}
func autoConvert_v1_HostAlias_To_core_HostAlias(in *v1.HostAlias, out *core.HostAlias, s conversion.Scope) error {
out.IP = in.IP
out.Hostnames = *(*[]string)(unsafe.Pointer(&in.Hostnames))
@@ -4114,8 +4100,8 @@ func Convert_core_KeyToPath_To_v1_KeyToPath(in *core.KeyToPath, out *v1.KeyToPat
}
func autoConvert_v1_Lifecycle_To_core_Lifecycle(in *v1.Lifecycle, out *core.Lifecycle, s conversion.Scope) error {
out.PostStart = (*core.Handler)(unsafe.Pointer(in.PostStart))
out.PreStop = (*core.Handler)(unsafe.Pointer(in.PreStop))
out.PostStart = (*core.LifecycleHandler)(unsafe.Pointer(in.PostStart))
out.PreStop = (*core.LifecycleHandler)(unsafe.Pointer(in.PreStop))
return nil
}
@@ -4125,8 +4111,8 @@ func Convert_v1_Lifecycle_To_core_Lifecycle(in *v1.Lifecycle, out *core.Lifecycl
}
func autoConvert_core_Lifecycle_To_v1_Lifecycle(in *core.Lifecycle, out *v1.Lifecycle, s conversion.Scope) error {
out.PostStart = (*v1.Handler)(unsafe.Pointer(in.PostStart))
out.PreStop = (*v1.Handler)(unsafe.Pointer(in.PreStop))
out.PostStart = (*v1.LifecycleHandler)(unsafe.Pointer(in.PostStart))
out.PreStop = (*v1.LifecycleHandler)(unsafe.Pointer(in.PreStop))
return nil
}
@@ -4135,6 +4121,30 @@ func Convert_core_Lifecycle_To_v1_Lifecycle(in *core.Lifecycle, out *v1.Lifecycl
return autoConvert_core_Lifecycle_To_v1_Lifecycle(in, out, s)
}
func autoConvert_v1_LifecycleHandler_To_core_LifecycleHandler(in *v1.LifecycleHandler, out *core.LifecycleHandler, s conversion.Scope) error {
out.Exec = (*core.ExecAction)(unsafe.Pointer(in.Exec))
out.HTTPGet = (*core.HTTPGetAction)(unsafe.Pointer(in.HTTPGet))
out.TCPSocket = (*core.TCPSocketAction)(unsafe.Pointer(in.TCPSocket))
return nil
}
// Convert_v1_LifecycleHandler_To_core_LifecycleHandler is an autogenerated conversion function.
func Convert_v1_LifecycleHandler_To_core_LifecycleHandler(in *v1.LifecycleHandler, out *core.LifecycleHandler, s conversion.Scope) error {
return autoConvert_v1_LifecycleHandler_To_core_LifecycleHandler(in, out, s)
}
func autoConvert_core_LifecycleHandler_To_v1_LifecycleHandler(in *core.LifecycleHandler, out *v1.LifecycleHandler, s conversion.Scope) error {
out.Exec = (*v1.ExecAction)(unsafe.Pointer(in.Exec))
out.HTTPGet = (*v1.HTTPGetAction)(unsafe.Pointer(in.HTTPGet))
out.TCPSocket = (*v1.TCPSocketAction)(unsafe.Pointer(in.TCPSocket))
return nil
}
// Convert_core_LifecycleHandler_To_v1_LifecycleHandler is an autogenerated conversion function.
func Convert_core_LifecycleHandler_To_v1_LifecycleHandler(in *core.LifecycleHandler, out *v1.LifecycleHandler, s conversion.Scope) error {
return autoConvert_core_LifecycleHandler_To_v1_LifecycleHandler(in, out, s)
}
func autoConvert_v1_LimitRange_To_core_LimitRange(in *v1.LimitRange, out *core.LimitRange, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v1_LimitRangeSpec_To_core_LimitRangeSpec(&in.Spec, &out.Spec, s); err != nil {
@@ -6462,7 +6472,7 @@ func Convert_core_PreferredSchedulingTerm_To_v1_PreferredSchedulingTerm(in *core
}
func autoConvert_v1_Probe_To_core_Probe(in *v1.Probe, out *core.Probe, s conversion.Scope) error {
if err := Convert_v1_Handler_To_core_Handler(&in.Handler, &out.Handler, s); err != nil {
if err := Convert_v1_ProbeHandler_To_core_ProbeHandler(&in.ProbeHandler, &out.ProbeHandler, s); err != nil {
return err
}
out.InitialDelaySeconds = in.InitialDelaySeconds
@@ -6480,7 +6490,7 @@ func Convert_v1_Probe_To_core_Probe(in *v1.Probe, out *core.Probe, s conversion.
}
func autoConvert_core_Probe_To_v1_Probe(in *core.Probe, out *v1.Probe, s conversion.Scope) error {
if err := Convert_core_Handler_To_v1_Handler(&in.Handler, &out.Handler, s); err != nil {
if err := Convert_core_ProbeHandler_To_v1_ProbeHandler(&in.ProbeHandler, &out.ProbeHandler, s); err != nil {
return err
}
out.InitialDelaySeconds = in.InitialDelaySeconds
@@ -6497,6 +6507,30 @@ func Convert_core_Probe_To_v1_Probe(in *core.Probe, out *v1.Probe, s conversion.
return autoConvert_core_Probe_To_v1_Probe(in, out, s)
}
func autoConvert_v1_ProbeHandler_To_core_ProbeHandler(in *v1.ProbeHandler, out *core.ProbeHandler, s conversion.Scope) error {
out.Exec = (*core.ExecAction)(unsafe.Pointer(in.Exec))
out.HTTPGet = (*core.HTTPGetAction)(unsafe.Pointer(in.HTTPGet))
out.TCPSocket = (*core.TCPSocketAction)(unsafe.Pointer(in.TCPSocket))
return nil
}
// Convert_v1_ProbeHandler_To_core_ProbeHandler is an autogenerated conversion function.
func Convert_v1_ProbeHandler_To_core_ProbeHandler(in *v1.ProbeHandler, out *core.ProbeHandler, s conversion.Scope) error {
return autoConvert_v1_ProbeHandler_To_core_ProbeHandler(in, out, s)
}
func autoConvert_core_ProbeHandler_To_v1_ProbeHandler(in *core.ProbeHandler, out *v1.ProbeHandler, s conversion.Scope) error {
out.Exec = (*v1.ExecAction)(unsafe.Pointer(in.Exec))
out.HTTPGet = (*v1.HTTPGetAction)(unsafe.Pointer(in.HTTPGet))
out.TCPSocket = (*v1.TCPSocketAction)(unsafe.Pointer(in.TCPSocket))
return nil
}
// Convert_core_ProbeHandler_To_v1_ProbeHandler is an autogenerated conversion function.
func Convert_core_ProbeHandler_To_v1_ProbeHandler(in *core.ProbeHandler, out *v1.ProbeHandler, s conversion.Scope) error {
return autoConvert_core_ProbeHandler_To_v1_ProbeHandler(in, out, s)
}
func autoConvert_v1_ProjectedVolumeSource_To_core_ProjectedVolumeSource(in *v1.ProjectedVolumeSource, out *core.ProjectedVolumeSource, s conversion.Scope) error {
if in.Sources != nil {
in, out := &in.Sources, &out.Sources

View File

@@ -253,20 +253,20 @@ func SetObjectDefaults_Pod(in *v1.Pod) {
SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
if a.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
if a.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.StartupProbe != nil {
SetDefaults_Probe(a.StartupProbe)
if a.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.Handler.HTTPGet)
if a.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.Lifecycle != nil {
@@ -303,20 +303,20 @@ func SetObjectDefaults_Pod(in *v1.Pod) {
SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
if a.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
if a.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.StartupProbe != nil {
SetDefaults_Probe(a.StartupProbe)
if a.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.Handler.HTTPGet)
if a.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.Lifecycle != nil {
@@ -353,20 +353,20 @@ func SetObjectDefaults_Pod(in *v1.Pod) {
SetDefaults_ResourceList(&a.EphemeralContainerCommon.Resources.Requests)
if a.EphemeralContainerCommon.LivenessProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.LivenessProbe)
if a.EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.ReadinessProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.ReadinessProbe)
if a.EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.StartupProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.StartupProbe)
if a.EphemeralContainerCommon.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.StartupProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.Lifecycle != nil {
@@ -473,20 +473,20 @@ func SetObjectDefaults_PodTemplate(in *v1.PodTemplate) {
SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
if a.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
if a.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.StartupProbe != nil {
SetDefaults_Probe(a.StartupProbe)
if a.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.Handler.HTTPGet)
if a.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.Lifecycle != nil {
@@ -523,20 +523,20 @@ func SetObjectDefaults_PodTemplate(in *v1.PodTemplate) {
SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
if a.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
if a.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.StartupProbe != nil {
SetDefaults_Probe(a.StartupProbe)
if a.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.Handler.HTTPGet)
if a.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.Lifecycle != nil {
@@ -573,20 +573,20 @@ func SetObjectDefaults_PodTemplate(in *v1.PodTemplate) {
SetDefaults_ResourceList(&a.EphemeralContainerCommon.Resources.Requests)
if a.EphemeralContainerCommon.LivenessProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.LivenessProbe)
if a.EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.ReadinessProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.ReadinessProbe)
if a.EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.StartupProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.StartupProbe)
if a.EphemeralContainerCommon.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.StartupProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.Lifecycle != nil {
@@ -695,20 +695,20 @@ func SetObjectDefaults_ReplicationController(in *v1.ReplicationController) {
SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
if a.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
if a.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.StartupProbe != nil {
SetDefaults_Probe(a.StartupProbe)
if a.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.Handler.HTTPGet)
if a.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.Lifecycle != nil {
@@ -745,20 +745,20 @@ func SetObjectDefaults_ReplicationController(in *v1.ReplicationController) {
SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
if a.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
if a.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.StartupProbe != nil {
SetDefaults_Probe(a.StartupProbe)
if a.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.Handler.HTTPGet)
if a.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.Lifecycle != nil {
@@ -795,20 +795,20 @@ func SetObjectDefaults_ReplicationController(in *v1.ReplicationController) {
SetDefaults_ResourceList(&a.EphemeralContainerCommon.Resources.Requests)
if a.EphemeralContainerCommon.LivenessProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.LivenessProbe)
if a.EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.LivenessProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.LivenessProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.ReadinessProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.ReadinessProbe)
if a.EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.ReadinessProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.ReadinessProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.StartupProbe != nil {
SetDefaults_Probe(a.EphemeralContainerCommon.StartupProbe)
if a.EphemeralContainerCommon.StartupProbe.Handler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.StartupProbe.Handler.HTTPGet)
if a.EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet != nil {
SetDefaults_HTTPGetAction(a.EphemeralContainerCommon.StartupProbe.ProbeHandler.HTTPGet)
}
}
if a.EphemeralContainerCommon.Lifecycle != nil {

View File

@@ -2663,7 +2663,7 @@ func validateProbe(probe *core.Probe, fldPath *field.Path) field.ErrorList {
if probe == nil {
return allErrs
}
allErrs = append(allErrs, validateHandler(&probe.Handler, fldPath)...)
allErrs = append(allErrs, validateHandler(handlerFromProbe(&probe.ProbeHandler), fldPath)...)
allErrs = append(allErrs, ValidateNonnegativeField(int64(probe.InitialDelaySeconds), fldPath.Child("initialDelaySeconds"))...)
allErrs = append(allErrs, ValidateNonnegativeField(int64(probe.TimeoutSeconds), fldPath.Child("timeoutSeconds"))...)
@@ -2676,6 +2676,28 @@ func validateProbe(probe *core.Probe, fldPath *field.Path) field.ErrorList {
return allErrs
}
type commonHandler struct {
Exec *core.ExecAction
HTTPGet *core.HTTPGetAction
TCPSocket *core.TCPSocketAction
}
func handlerFromProbe(ph *core.ProbeHandler) commonHandler {
return commonHandler{
Exec: ph.Exec,
HTTPGet: ph.HTTPGet,
TCPSocket: ph.TCPSocket,
}
}
func handlerFromLifecycle(lh *core.LifecycleHandler) commonHandler {
return commonHandler{
Exec: lh.Exec,
HTTPGet: lh.HTTPGet,
TCPSocket: lh.TCPSocket,
}
}
func validateClientIPAffinityConfig(config *core.SessionAffinityConfig, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if config == nil {
@@ -2782,7 +2804,7 @@ func validateTCPSocketAction(tcp *core.TCPSocketAction, fldPath *field.Path) fie
return ValidatePortNumOrName(tcp.Port, fldPath.Child("port"))
}
func validateHandler(handler *core.Handler, fldPath *field.Path) field.ErrorList {
func validateHandler(handler commonHandler, fldPath *field.Path) field.ErrorList {
numHandlers := 0
allErrors := field.ErrorList{}
if handler.Exec != nil {
@@ -2818,10 +2840,10 @@ func validateHandler(handler *core.Handler, fldPath *field.Path) field.ErrorList
func validateLifecycle(lifecycle *core.Lifecycle, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if lifecycle.PostStart != nil {
allErrs = append(allErrs, validateHandler(lifecycle.PostStart, fldPath.Child("postStart"))...)
allErrs = append(allErrs, validateHandler(handlerFromLifecycle(lifecycle.PostStart), fldPath.Child("postStart"))...)
}
if lifecycle.PreStop != nil {
allErrs = append(allErrs, validateHandler(lifecycle.PreStop, fldPath.Child("preStop"))...)
allErrs = append(allErrs, validateHandler(handlerFromLifecycle(lifecycle.PreStop), fldPath.Child("preStop"))...)
}
return allErrs
}

View File

@@ -5930,12 +5930,12 @@ func TestAlphaValidateVolumeDevices(t *testing.T) {
}
func TestValidateProbe(t *testing.T) {
handler := core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}}
handler := core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}}
// These fields must be positive.
positiveFields := [...]string{"InitialDelaySeconds", "TimeoutSeconds", "PeriodSeconds", "SuccessThreshold", "FailureThreshold"}
successCases := []*core.Probe{nil}
for _, field := range positiveFields {
probe := &core.Probe{Handler: handler}
probe := &core.Probe{ProbeHandler: handler}
reflect.ValueOf(probe).Elem().FieldByName(field).SetInt(10)
successCases = append(successCases, probe)
}
@@ -5948,7 +5948,7 @@ func TestValidateProbe(t *testing.T) {
errorCases := []*core.Probe{{TimeoutSeconds: 10, InitialDelaySeconds: 10}}
for _, field := range positiveFields {
probe := &core.Probe{Handler: handler}
probe := &core.Probe{ProbeHandler: handler}
reflect.ValueOf(probe).Elem().FieldByName(field).SetInt(-10)
errorCases = append(errorCases, probe)
}
@@ -5982,7 +5982,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
},
fldPath: fldPath,
},
@@ -5991,7 +5991,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
InitialDelaySeconds: -1,
},
fldPath: fldPath,
@@ -6001,7 +6001,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
TimeoutSeconds: -1,
},
fldPath: fldPath,
@@ -6011,7 +6011,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
PeriodSeconds: -1,
},
fldPath: fldPath,
@@ -6021,7 +6021,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
SuccessThreshold: -1,
},
fldPath: fldPath,
@@ -6031,7 +6031,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
FailureThreshold: -1,
},
fldPath: fldPath,
@@ -6041,7 +6041,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
TerminationGracePeriodSeconds: utilpointer.Int64(-1),
},
fldPath: fldPath,
@@ -6051,7 +6051,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
TerminationGracePeriodSeconds: utilpointer.Int64(0),
},
fldPath: fldPath,
@@ -6061,7 +6061,7 @@ func Test_validateProbe(t *testing.T) {
{
args: args{
probe: &core.Probe{
Handler: core.Handler{Exec: &core.ExecAction{Command: []string{"echo"}}},
ProbeHandler: core.ProbeHandler{Exec: &core.ExecAction{Command: []string{"echo"}}},
TerminationGracePeriodSeconds: utilpointer.Int64(1),
},
fldPath: fldPath,
@@ -6087,7 +6087,7 @@ func Test_validateProbe(t *testing.T) {
}
func TestValidateHandler(t *testing.T) {
successCases := []core.Handler{
successCases := []core.ProbeHandler{
{Exec: &core.ExecAction{Command: []string{"echo"}}},
{HTTPGet: &core.HTTPGetAction{Path: "/", Port: intstr.FromInt(1), Host: "", Scheme: "HTTP"}},
{HTTPGet: &core.HTTPGetAction{Path: "/foo", Port: intstr.FromInt(65535), Host: "host", Scheme: "HTTP"}},
@@ -6096,12 +6096,12 @@ func TestValidateHandler(t *testing.T) {
{HTTPGet: &core.HTTPGetAction{Path: "/", Port: intstr.FromString("port"), Host: "", Scheme: "HTTP", HTTPHeaders: []core.HTTPHeader{{Name: "X-Forwarded-For", Value: "1.2.3.4"}, {Name: "X-Forwarded-For", Value: "5.6.7.8"}}}},
}
for _, h := range successCases {
if errs := validateHandler(&h, field.NewPath("field")); len(errs) != 0 {
if errs := validateHandler(handlerFromProbe(&h), field.NewPath("field")); len(errs) != 0 {
t.Errorf("expected success: %v", errs)
}
}
errorCases := []core.Handler{
errorCases := []core.ProbeHandler{
{},
{Exec: &core.ExecAction{Command: []string{}}},
{HTTPGet: &core.HTTPGetAction{Path: "", Port: intstr.FromInt(0), Host: ""}},
@@ -6111,7 +6111,7 @@ func TestValidateHandler(t *testing.T) {
{HTTPGet: &core.HTTPGetAction{Path: "/", Port: intstr.FromString("port"), Host: "", Scheme: "HTTP", HTTPHeaders: []core.HTTPHeader{{Name: "X_Forwarded_For", Value: "foo.example.com"}}}},
}
for _, h := range errorCases {
if errs := validateHandler(&h, field.NewPath("field")); len(errs) == 0 {
if errs := validateHandler(handlerFromProbe(&h), field.NewPath("field")); len(errs) == 0 {
t.Errorf("expected failure for %#v", h)
}
}
@@ -6309,7 +6309,7 @@ func TestValidateEphemeralContainers(t *testing.T) {
ImagePullPolicy: "IfNotPresent",
TerminationMessagePolicy: "File",
Lifecycle: &core.Lifecycle{
PreStop: &core.Handler{
PreStop: &core.LifecycleHandler{
Exec: &core.ExecAction{Command: []string{"ls", "-l"}},
},
},
@@ -6328,7 +6328,7 @@ func TestValidateEphemeralContainers(t *testing.T) {
ImagePullPolicy: "IfNotPresent",
TerminationMessagePolicy: "File",
LivenessProbe: &core.Probe{
Handler: core.Handler{
ProbeHandler: core.ProbeHandler{
TCPSocket: &core.TCPSocketAction{Port: intstr.FromInt(80)},
},
SuccessThreshold: 1,
@@ -6365,7 +6365,7 @@ func TestValidateEphemeralContainers(t *testing.T) {
ImagePullPolicy: "IfNotPresent",
TerminationMessagePolicy: "File",
ReadinessProbe: &core.Probe{
Handler: core.Handler{
ProbeHandler: core.ProbeHandler{
TCPSocket: &core.TCPSocketAction{Port: intstr.FromInt(80)},
},
},
@@ -6584,7 +6584,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
Lifecycle: &core.Lifecycle{
PreStop: &core.Handler{
PreStop: &core.LifecycleHandler{
Exec: &core.ExecAction{Command: []string{"ls", "-l"}},
},
},
@@ -6754,7 +6754,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
Lifecycle: &core.Lifecycle{
PreStop: &core.Handler{
PreStop: &core.LifecycleHandler{
Exec: &core.ExecAction{},
},
},
@@ -6767,7 +6767,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
Lifecycle: &core.Lifecycle{
PreStop: &core.Handler{
PreStop: &core.LifecycleHandler{
HTTPGet: &core.HTTPGetAction{},
},
},
@@ -6780,7 +6780,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
Lifecycle: &core.Lifecycle{
PreStop: &core.Handler{
PreStop: &core.LifecycleHandler{
TCPSocket: &core.TCPSocketAction{},
},
},
@@ -6793,7 +6793,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
Lifecycle: &core.Lifecycle{
PreStop: &core.Handler{
PreStop: &core.LifecycleHandler{
TCPSocket: &core.TCPSocketAction{
Port: intstr.FromInt(0),
},
@@ -6808,7 +6808,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
Lifecycle: &core.Lifecycle{
PreStop: &core.Handler{},
PreStop: &core.LifecycleHandler{},
},
ImagePullPolicy: "IfNotPresent",
TerminationMessagePolicy: "File",
@@ -6819,7 +6819,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
ReadinessProbe: &core.Probe{
Handler: core.Handler{
ProbeHandler: core.ProbeHandler{
TCPSocket: &core.TCPSocketAction{},
},
TerminationGracePeriodSeconds: utilpointer.Int64Ptr(10),
@@ -6833,7 +6833,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
LivenessProbe: &core.Probe{
Handler: core.Handler{
ProbeHandler: core.ProbeHandler{
TCPSocket: &core.TCPSocketAction{},
},
},
@@ -6846,7 +6846,7 @@ func TestValidateContainers(t *testing.T) {
Name: "life-123",
Image: "image",
LivenessProbe: &core.Probe{
Handler: core.Handler{},
ProbeHandler: core.ProbeHandler{},
},
ImagePullPolicy: "IfNotPresent",
TerminationMessagePolicy: "File",

View File

@@ -1760,37 +1760,6 @@ func (in *HTTPHeader) DeepCopy() *HTTPHeader {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Handler) DeepCopyInto(out *Handler) {
*out = *in
if in.Exec != nil {
in, out := &in.Exec, &out.Exec
*out = new(ExecAction)
(*in).DeepCopyInto(*out)
}
if in.HTTPGet != nil {
in, out := &in.HTTPGet, &out.HTTPGet
*out = new(HTTPGetAction)
(*in).DeepCopyInto(*out)
}
if in.TCPSocket != nil {
in, out := &in.TCPSocket, &out.TCPSocket
*out = new(TCPSocketAction)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Handler.
func (in *Handler) DeepCopy() *Handler {
if in == nil {
return nil
}
out := new(Handler)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HostAlias) DeepCopyInto(out *HostAlias) {
*out = *in
@@ -1921,12 +1890,12 @@ func (in *Lifecycle) DeepCopyInto(out *Lifecycle) {
*out = *in
if in.PostStart != nil {
in, out := &in.PostStart, &out.PostStart
*out = new(Handler)
*out = new(LifecycleHandler)
(*in).DeepCopyInto(*out)
}
if in.PreStop != nil {
in, out := &in.PreStop, &out.PreStop
*out = new(Handler)
*out = new(LifecycleHandler)
(*in).DeepCopyInto(*out)
}
return
@@ -1942,6 +1911,37 @@ func (in *Lifecycle) DeepCopy() *Lifecycle {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LifecycleHandler) DeepCopyInto(out *LifecycleHandler) {
*out = *in
if in.Exec != nil {
in, out := &in.Exec, &out.Exec
*out = new(ExecAction)
(*in).DeepCopyInto(*out)
}
if in.HTTPGet != nil {
in, out := &in.HTTPGet, &out.HTTPGet
*out = new(HTTPGetAction)
(*in).DeepCopyInto(*out)
}
if in.TCPSocket != nil {
in, out := &in.TCPSocket, &out.TCPSocket
*out = new(TCPSocketAction)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LifecycleHandler.
func (in *LifecycleHandler) DeepCopy() *LifecycleHandler {
if in == nil {
return nil
}
out := new(LifecycleHandler)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LimitRange) DeepCopyInto(out *LimitRange) {
*out = *in
@@ -4185,7 +4185,7 @@ func (in *PreferredSchedulingTerm) DeepCopy() *PreferredSchedulingTerm {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Probe) DeepCopyInto(out *Probe) {
*out = *in
in.Handler.DeepCopyInto(&out.Handler)
in.ProbeHandler.DeepCopyInto(&out.ProbeHandler)
if in.TerminationGracePeriodSeconds != nil {
in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds
*out = new(int64)
@@ -4204,6 +4204,37 @@ func (in *Probe) DeepCopy() *Probe {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProbeHandler) DeepCopyInto(out *ProbeHandler) {
*out = *in
if in.Exec != nil {
in, out := &in.Exec, &out.Exec
*out = new(ExecAction)
(*in).DeepCopyInto(*out)
}
if in.HTTPGet != nil {
in, out := &in.HTTPGet, &out.HTTPGet
*out = new(HTTPGetAction)
(*in).DeepCopyInto(*out)
}
if in.TCPSocket != nil {
in, out := &in.TCPSocket, &out.TCPSocket
*out = new(TCPSocketAction)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProbeHandler.
func (in *ProbeHandler) DeepCopy() *ProbeHandler {
if in == nil {
return nil
}
out := new(ProbeHandler)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProjectedVolumeSource) DeepCopyInto(out *ProjectedVolumeSource) {
*out = *in