openshift-cli-set-deployment-hook man page

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

Synopsis

openshift cli set deployment-hook [Options]

Description

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.

Options

--all=false
Select all deployment configs in the namespace
-c, --container=""
The name of the container in the selected deployment config to use for the deployment hook
-e, --environment=[]
Environment variables to use in the deployment hook pod
--failure-policy="ignore"
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.
--mid=false
Set or remove a mid deployment hook
--no-headers=false
When using the default output, don't print headers.
-o, --output=""
Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [ ⟨http://golang.org/pkg/text/template/#pk…⟩] and jsonpath template [ ⟨http://releases.k8s.io/release-1.3/docs…⟩].
--output-version=""
Output the formatted object with the given group version (for ex: 'extensions/v1beta1').
--post=false
Set or remove a post deployment hook
--pre=false
Set or remove a pre deployment hook
--remove=false
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.)
--show-labels=false
When printing, show all labels as the last column (default hide labels column)
--sort-by=""
If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
--template=""
Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [ ⟨http://golang.org/pkg/text/template/#pk…⟩].
-v, --volumes=[]
Volumes from the pod template to use in the deployment hook pod

Options Inherited from Parent Commands

--api-version=""
DEPRECATED: The API version to use when talking to the server

--as=""
Username to impersonate for the operation.

--certificate-authority=""
Path to a cert. file for the certificate authority.

--client-certificate=""
Path to a client certificate file for TLS.

--client-key=""
Path to a client key file for TLS.

--cluster=""
The name of the kubeconfig cluster to use

--config=""
Path to the config file to use for CLI requests.

--context=""
The name of the kubeconfig context to use

--google-json-key=""
The Google Cloud Platform Service Account JSON Key to use for authentication.

--insecure-skip-tls-verify=false
If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.

--log-flush-frequency=0
Maximum number of seconds between log flushes

--match-server-version=false
Require server version to match client version

-n, --namespace=""
If present, the namespace scope for this CLI request.

--server=""
The address and port of the Kubernetes API server

--token=""
Bearer token for authentication to the API server.

--user=""
The name of the kubeconfig user to use

Example

# 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/migrate-db.sh

# 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/prepare-deploy.sh

See Also

openshift-cli-set(1),

History

June 2016, Ported from the Kubernetes man-doc generator

Referenced By

openshift-cli-set(1).

Openshift CLI User Manuals Openshift June 2016