Reputation: 186
In the create_namespaced_job
method there is no parameter that exists to define preStop
and postStart
handlers.
V1Job create_namespaced_job(namespace, body, pretty=pretty, dry_run=dry_run, field_manager=field_manager)
So, how to add these life-cycle handlers to a job or pod by Python Kubernetes?
Upvotes: 2
Views: 631
Reputation: 128995
In the create_namespaced_job method there is no parameter that exists to define preStop and postStart handlers.
The preStop
and postStart
handlers exists on the containers. You linked to the documentation for create_namespaced_job and the parameter body
is a V1Job, and the spec
of that has a template
, that has a spec
of type V1PodSpec and there you find a field container[list]
and there you find a field lifecycle
of type V1Lifecylce that has the preStop
and postStart
-handlers.
The documentation can also be navigated with kubectl explain
, e.g:
kubectl explain podTemplate.template.spec.containers.lifecycle
Upvotes: 1