Add initial lifecycle and hooks into kubelet.

Hrm, I think I disagree that its part of the API.  I think it's a function
of the management system.  The management system should know how long it
can afford to wait.  I don't think the script needs to know (or really
cares)

I suppose you could pass it down as a matter of information to the script,
but I don't see most script writers doing very much with it.

I see it as being much more of an exception style rather than a big part of
the API.

Thoughts?



On Mon, Aug 25, 2014 at 8:44 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
>
> My suggestion is to add a timeout to the function calls, with the
> expectation that after that time the functions will return with an error.
> I'm being picky about this because you really need to pass the timeout down
> into the script you're calling as a parameter. I don't care if you
> implement in another PR, but I think the timeout really deserves to make it
> into the interface for the first cut, because it's really very important.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/1028/files#r16694540>
> .
>