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

@@ -6003,24 +6003,6 @@
],
"type": "object"
},
"io.k8s.api.core.v1.Handler": {
"description": "Handler defines a specific action that should be taken",
"properties": {
"exec": {
"$ref": "#/definitions/io.k8s.api.core.v1.ExecAction",
"description": "One and only one of the following should be specified. Exec specifies the action to take."
},
"httpGet": {
"$ref": "#/definitions/io.k8s.api.core.v1.HTTPGetAction",
"description": "HTTPGet specifies the http request to perform."
},
"tcpSocket": {
"$ref": "#/definitions/io.k8s.api.core.v1.TCPSocketAction",
"description": "TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported"
}
},
"type": "object"
},
"io.k8s.api.core.v1.HostAlias": {
"description": "HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.",
"properties": {
@@ -6200,16 +6182,34 @@
"description": "Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.",
"properties": {
"postStart": {
"$ref": "#/definitions/io.k8s.api.core.v1.Handler",
"$ref": "#/definitions/io.k8s.api.core.v1.LifecycleHandler",
"description": "PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"
},
"preStop": {
"$ref": "#/definitions/io.k8s.api.core.v1.Handler",
"$ref": "#/definitions/io.k8s.api.core.v1.LifecycleHandler",
"description": "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 container crashes or exits. The reason for termination is passed to the handler. The Pod's termination grace period countdown begins before the PreStop hooked is executed. Regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period. Other management of the container blocks until the hook completes or until the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"
}
},
"type": "object"
},
"io.k8s.api.core.v1.LifecycleHandler": {
"description": "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.",
"properties": {
"exec": {
"$ref": "#/definitions/io.k8s.api.core.v1.ExecAction",
"description": "One and only one of the following should be specified. Exec specifies the action to take."
},
"httpGet": {
"$ref": "#/definitions/io.k8s.api.core.v1.HTTPGetAction",
"description": "HTTPGet specifies the http request to perform."
},
"tcpSocket": {
"$ref": "#/definitions/io.k8s.api.core.v1.TCPSocketAction",
"description": "TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported"
}
},
"type": "object"
},
"io.k8s.api.core.v1.LimitRange": {
"description": "LimitRange sets resource usage limits for each kind of resource in a Namespace.",
"properties": {