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:
@@ -100,7 +100,7 @@ func TestGetURLParts(t *testing.T) {
|
||||
container := v1.Container{
|
||||
Ports: []v1.ContainerPort{{Name: "found", ContainerPort: 93}},
|
||||
LivenessProbe: &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
HTTPGet: test.probe,
|
||||
},
|
||||
},
|
||||
@@ -153,7 +153,7 @@ func TestGetTCPAddrParts(t *testing.T) {
|
||||
container := v1.Container{
|
||||
Ports: []v1.ContainerPort{{Name: "found", ContainerPort: 93}},
|
||||
LivenessProbe: &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
TCPSocket: test.probe,
|
||||
},
|
||||
},
|
||||
@@ -204,7 +204,7 @@ func TestProbe(t *testing.T) {
|
||||
containerID := kubecontainer.ContainerID{Type: "test", ID: "foobar"}
|
||||
|
||||
execProbe := &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
Exec: &v1.ExecAction{},
|
||||
},
|
||||
}
|
||||
@@ -255,7 +255,7 @@ func TestProbe(t *testing.T) {
|
||||
},
|
||||
{ // Probe arguments are passed through
|
||||
probe: &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
Exec: &v1.ExecAction{
|
||||
Command: []string{"/bin/bash", "-c", "some script"},
|
||||
},
|
||||
@@ -267,7 +267,7 @@ func TestProbe(t *testing.T) {
|
||||
},
|
||||
{ // Probe arguments are passed through
|
||||
probe: &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
ProbeHandler: v1.ProbeHandler{
|
||||
Exec: &v1.ExecAction{
|
||||
Command: []string{"/bin/bash", "-c", "some $(A) $(B)"},
|
||||
},
|
||||
|
Reference in New Issue
Block a user