Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement oc set container-hook. #17489

Open
GrahamDumpleton opened this issue Nov 28, 2017 · 3 comments
Open

Implement oc set container-hook. #17489

GrahamDumpleton opened this issue Nov 28, 2017 · 3 comments
Labels
component/cli kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/P2

Comments

@GrahamDumpleton
Copy link

GrahamDumpleton commented Nov 28, 2017

The idea of implementing oc set container-hook was mentioned in #9040 but it appears it was never implemented even though oc set probe and oc set deployment-hook were.

$ oc explain dc.spec.template.spec.containers.lifecycle
RESOURCE: lifecycle <Object>

DESCRIPTION:
     Actions that the management system should take in response to container
     lifecycle events. Cannot be updated.

    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.

FIELDS:
   postStart	<Object>
     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:
     http://kubernetes.io/docs/user-guide/container-environment#hook-details

   preStop	<Object>
     PreStop is called immediately before a container is terminated. The
     container is terminated after the handler completes. The reason for
     termination is passed to the handler. Regardless of the outcome of the
     handler, the container is eventually terminated. Other management of the
     container blocks until the hook completes. More info:
     http://kubernetes.io/docs/user-guide/container-environment#hook-details

The command would need to support --post-start and --pre-stop options, along with similar options to oc set probe for --open-tcp, --get-url and -- options. Would also need a --container option to specify in which container when there is more than one in the pod and using -- to execute a command.

$ oc explain dc.spec.template.spec.containers.lifecycle.postStart
RESOURCE: postStart <Object>

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:
     http://kubernetes.io/docs/user-guide/container-environment#hook-details

    Handler defines a specific action that should be taken

FIELDS:
   exec	<Object>
     One and only one of the following should be specified. Exec specifies the
     action to take.

   httpGet	<Object>
     HTTPGet specifies the http request to perform.

   tcpSocket	<Object>
     TCPSocket specifies an action involving a TCP port. TCP hooks not yet
     supported

Only way to set these from the command line involves using oc edit or oc patch making them not as accessible as probes and deployment hooks.

@GrahamDumpleton
Copy link
Author

Not sure if means tcpSocket is not supported, but the Kubernetes docs don't mention it for these.

@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 28, 2018
@GrahamDumpleton
Copy link
Author

/lifecycle frozen

@openshift-ci-robot openshift-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Feb 28, 2018
@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/cli kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/P2
Projects
None yet
Development

No branches or pull requests

5 participants