Add initial lifecycle and hooks into kubelet.

I guess my point is that I think that model is broken.  The management
system shouldn't give you a quota of time and hope you can deal with it.
 It should stick around for as long as it possibly can, and then treat your
container as broken (similar to failing health checks) if you fail to
respond within the maximum time it can allot to lifecycle events, it seems
subtle, but I think it's a really important difference.

In one model, the container and management system are partners, in the
other, the management system is in charge, and simply notifying containers
"this is the way it is"

I too am being detailed here, because I think it's really important.  The
"notification" style approach leads to a style of lifecycle that is much
more advisorial, than contract driven, and that's precisely what I'm trying
to avoid.

--brendan


On Mon, Aug 25, 2014 at 9:12 PM, Daniel Smith <notifications@github.com>
wrote:

> In pkg/kubelet/lifecycle.go:
>
> > +See the License for the specific language governing permissions and
> > +limitations under the License.
> > +*/
> > +
> > +package kubelet
> > +
> > +// LifecycleOutput is the output from a lifecycle event
> > +type LifecycleOutput struct {
> > +	Details string
> > +}
> > +
> > +// Lifecycle is an interface implemented by things that handle lifecycle events
> > +type Lifecycle interface {
> > +	// OnStart is called after a container is started.  The management system blocks until it returns
> > +	OnStart(containerID string) (LifecycleOutput, error)
> > +	// OnStop is called before a container is stopped.  The management system blocks until it returns
>
> People internally use shutdown notification to do important cleanup, I
> think fairly commonly. We have a configurable time limit. I'm not saying
> you should make it configurable with this change, but I think it's very
> important that the scripts know what their time limit is.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/1028/files#r16695049>
> .
>