forked from LaconicNetwork/kompose
Add Labels for CronJob https://github.com/kubernetes/kompose/issues/1795
This commit is contained in:
@@ -204,6 +204,14 @@ ocp_output="$KOMPOSE_ROOT/script/test/fixtures/statefulset/output-os.yaml"
|
||||
convert::expect_success "$k8s_cmd" "$k8s_output" || exit 1
|
||||
convert::expect_success "$ocp_cmd" "$ocp_output" || exit 1
|
||||
|
||||
# test cronjob
|
||||
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/cronjob/docker-compose.yaml convert --stdout --with-kompose-annotation=false"
|
||||
ocp_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/cronjob/docker-compose.yaml convert --stdout --with-kompose-annotation=false"
|
||||
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/cronjob/output-k8s.yaml"
|
||||
ocp_output="$KOMPOSE_ROOT/script/test/fixtures/cronjob/output-os.yaml"
|
||||
convert::expect_success "$k8s_cmd" "$k8s_output" || exit 1
|
||||
convert::expect_success "$ocp_cmd" "$ocp_output" || exit 1
|
||||
|
||||
# test specifying volume type using service label
|
||||
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/docker-compose.yaml convert --stdout --with-kompose-annotation=false"
|
||||
os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-type-volumes/docker-compose.yaml convert --stdout --with-kompose-annotation=false"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
challenge:
|
||||
image: busybox:stable-glibc
|
||||
labels:
|
||||
kompose.cronjob.schedule: "* * * * *"
|
||||
kompose.cronjob.concurrency_policy: "Forbid"
|
||||
kompose.cronjob.backoff_limit: "0"
|
||||
command:
|
||||
- "bash"
|
||||
- "-c"
|
||||
- "echo hello from cron"
|
||||
restart: "no"
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: challenge
|
||||
name: challenge
|
||||
spec:
|
||||
concurrencyPolicy: Forbid
|
||||
jobTemplate:
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.network/cronjob-default: "true"
|
||||
io.kompose.service: challenge
|
||||
spec:
|
||||
containers:
|
||||
- args:
|
||||
- bash
|
||||
- -c
|
||||
- echo hello from cron
|
||||
image: busybox:stable-glibc
|
||||
name: challenge
|
||||
restartPolicy: Never
|
||||
schedule: '* * * * *'
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: challenge
|
||||
name: challenge
|
||||
spec:
|
||||
concurrencyPolicy: Forbid
|
||||
jobTemplate:
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.network/cronjob-default: "true"
|
||||
io.kompose.service: challenge
|
||||
spec:
|
||||
containers:
|
||||
- args:
|
||||
- bash
|
||||
- -c
|
||||
- echo hello from cron
|
||||
image: busybox:stable-glibc
|
||||
name: challenge
|
||||
restartPolicy: Never
|
||||
schedule: '* * * * *'
|
||||
Reference in New Issue
Block a user