Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a84ea9

Browse files
committed
Added examples for Jobs and Hooks
1 parent 7616bdd commit 3a84ea9

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

examples/create_job.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
image="nginx:1.7.9",
1919
image_pull_policy="IfNotPresent",
2020
ports=[client.V1ContainerPort(container_port=80)],
21-
volume_mounts=[client.V1VolumeMount(name=volume.name, mount_path="/kube-example")]
21+
volume_mounts=[
22+
client.V1VolumeMount(
23+
name=volume.name, mount_path="/kube-example"
24+
)
25+
]
2226
)
2327

2428
# Init-Container
@@ -29,13 +33,19 @@
2933
command=[
3034
"touch kube-test.txt"
3135
],
32-
volume_mounts=[client.V1VolumeMount(name=volume.name, mount_path="/kube-example")]
36+
volume_mounts=[client.V1VolumeMount(
37+
name=volume.name,
38+
mount_path="/kube-example")]
3339
)
3440

3541
# Template
3642
template = client.V1PodTemplateSpec(
3743
metadata=client.V1ObjectMeta(labels={"app": "jobtest"}),
38-
spec=client.V1PodSpec(init_containers=[init_container], containers=[container], volumes=[volume], restart_policy="Never")
44+
spec=client.V1PodSpec(
45+
init_containers=[init_container],
46+
containers=[container],
47+
volumes=[volume],
48+
restart_policy="Never")
3949
)
4050

4151
# Spec
@@ -52,5 +62,3 @@
5262
)
5363

5464
extension.create_namespaced_job(namespace="kube-client", body=job)
55-
56-
File renamed without changes.

0 commit comments

Comments
 (0)