openshift-cli-set-deployment-hook man page

openshift cli set deployment-hook — Update a deployment hook on a deployment config


openshift cli set deployment-hook [Options]


Set or remove a deployment hook on a deployment config

Deployment configs allow hooks to execute at different points in the lifecycle of the deployment, depending on the deployment strategy.

For deployments with a Recreate strategy, a Pre, Mid, and Post hook can be specified. The Pre hook will execute before the deployment starts. The Mid hook will execute once the previous deployment has been scaled down to 0, but before the new one ramps up. The Post hook will execute once the deployment has completed.

For deployments with a Rolling strategy, a Pre and Post hook can be specified. The Pre hook will execute before the deployment starts and the Post hook will execute once the deployment has completed.

For each hook, a new pod will be started using one of the containers in the deployment's pod template with a specific command to execute. Additional environment variables may be specified for the hook, as well as which volumes from the pod template will be mounted on the hook pod.

Each hook can have its own cancellation policy. One of: abort, retry, or ignore. Not all cancellation policies can be set on all hooks. For example, a Post hook on a rolling strategy does not support the abort policy, because at that point the deployment has already happened.



If true, select all deployment configs in the namespace


If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.

-c, --container=""

The name of the container in the selected deployment config to use for the deployment hook


If true, only print the object that would be sent, without sending it.

-e, --environment=[]

Environment variable to use in the deployment hook pod


The failure policy for the deployment hook. Valid values are: abort,retry,ignore

-f, --filename=[]

Filename, directory, or URL to file to use to edit the resource.


If true, set deployment hook will NOT contact api-server but run locally.


Set or remove a mid deployment hook


When using the default or custom-column output format, don't print headers (default print headers).

-o, --output=""

Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [ ⟨⟩], golang template [ ⟨⟩] and jsonpath template [ ⟨⟩].


Set or remove a post deployment hook


Set or remove a pre deployment hook


If true, remove the specified deployment hook(s).

-l, --selector=""

Selector (label query) to filter deployment configs

-a, --show-all=true

When printing, show all resources (false means hide terminated pods.)


When printing, show all labels as the last column (default hide labels column)


If non-empty, sort list types using this field specification.  The field specification is expressed as a JSONPath expression (e.g. '{}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.


Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [ ⟨⟩].

-v, --volumes=[]

Volumes from the pod template to use in the deployment hook pod

Options Inherited from Parent Commands


DEPRECATED: The API version to use when talking to the server


Username to impersonate for the operation


Path to the file container Azure container registry configuration information.


Path to a cert. file for the certificate authority


Path to a client certificate file for TLS


Path to a client key file for TLS


The name of the kubeconfig cluster to use


Path to the config file to use for CLI requests.


The name of the kubeconfig context to use


The Google Cloud Platform Service Account JSON Key to use for authentication.


If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure


Maximum number of seconds between log flushes


Require server version to match client version

-n, --namespace=""

If present, the namespace scope for this CLI request


The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.


The address and port of the Kubernetes API server


Bearer token for authentication to the API server


The name of the kubeconfig user to use


  # Clear pre and post hooks on a deployment config
  openshift cli set deployment-hook dc/myapp --remove --pre --post
  # Set the pre deployment hook to execute a db migration command for an application
  # using the data volume from the application
  openshift cli set deployment-hook dc/myapp --pre -v data -- /var/lib/
  # Set a mid deployment hook along with additional environment variables
  openshift cli set deployment-hook dc/myapp --mid -v data -e VAR1=value1 -e VAR2=value2 -- /var/lib/

See Also



June 2016, Ported from the Kubernetes man-doc generator

Referenced By


Openshift CLI User Manuals June 2016