`kapp deploy` fails when job sets `ttlSecondsAfterFinished: 0`
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
**What steps did you take:**
Here is the simple step to produce the issue.
#### 1. Create job.yaml
```yaml
cat < job.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
ttlSecondsAfterFinished: 0
template:
spec:
containers:
- name: pi
image: perl
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never
EOF
```
### Run `kapp deploy`
```shell
$ kapp deploy --yes --app serving --file a.yaml
```
**What happened:**
The kapp command above fails due to `jobs.batch "pi"` not found as following:
```shell
$ kapp deploy --yes --app serving --file a.yaml
Target cluster 'https://127.0.0.1:45759' (nodes: kind-control-plane, 1+)
Changes
Namespace Name Kind Conds. Age Op Op st. Wait to Rs Ri
default pi Job - - create - reconcile - -
Op: 1 create, 0 delete, 0 update, 0 noop
Wait to: 1 reconcile, 0 delete, 0 noop
8:51:56PM: ---- applying 1 changes [0/1 done] ----
8:51:56PM: create job/pi (batch/v1) namespace: default
8:51:56PM: ---- waiting on 1 changes [0/1 done] ----
8:51:56PM: ongoing: reconcile job/pi (batch/v1) namespace: default
8:51:56PM: ^ Waiting to complete (0 active, 0 failed, 0 succeeded)
8:51:56PM: L ongoing: waiting on pod/pi-6q462 (v1) namespace: default
8:51:56PM: ^ Pending
8:51:57PM: ongoing: reconcile job/pi (batch/v1) namespace: default
8:51:57PM: ^ Waiting to complete (1 active, 0 failed, 0 succeeded)
8:51:57PM: L ongoing: waiting on pod/pi-6q462 (v1) namespace: default
8:51:57PM: ^ Pending: ContainerCreating
8:52:00PM: ongoing: reconcile job/pi (batch/v1) namespace: default
8:52:00PM: ^ Waiting to complete (1 active, 0 failed, 0 succeeded)
8:52:00PM: L ok: waiting on pod/pi-6q462 (v1) namespace: default
8:52:04PM: error: reconcile job/pi (batch/v1) namespace: default
kapp: Error: waiting on reconcile job/pi (batch/v1) namespace: default:
Errored:
Getting resource job/pi (batch/v1) namespace: default: jobs.batch "pi" not found (reason: NotFound)
```
**What did you expect:**
- I know that the root cause is `ttlSecondsAfterFinished: 0` which cleans up the job.
- So the issue has a workaround by setting `ttlSecondsAfterFinished` to non-`0`.
- But released manifest has `0` e.g. contour https://github.com/projectcontour/contour/blob/552498a85a294a7080acdb8e20a5b70f67c4fd6b/examples/contour/02-job-certgen.yaml#L42 so I would like `kapp` to handle it by some option. (Otherwise, we need to modify contour's release yaml.)
Contributor guide
Assessment
This issue has not been assessed yet.