carvel-dev / carvel-dev/kapp

kapp unblocks dependent changes if the changes which are depended upon already exists

Open
#729 2 comments 0 reactions 0 assignees View on GitHub
bug carvel accepted priority/important-soon
Dominant language
Go
Stars
1.1k
Forks
134
PR merge metrics
No merged PRs in 30d

Description

**What steps did you take:**
`jobs.yaml`
```yaml
apiVersion: batch/v1
kind: Job
metadata:
name: successful-job-1
annotations:
kapp.k14s.io/change-rule: "upsert after upserting abc"
spec:
template:
metadata:
name: successful-job-1
spec:
containers:
- name: successful-job-1
image: busybox
command: ["/bin/sh", "-c", "sleep 10"]
restartPolicy: Never
---
apiVersion: batch/v1
kind: Job
metadata:
name: successful-job-2
annotations:
kapp.k14s.io/change-group: "abc"
spec:
template:
metadata:
name: successful-job-2
spec:
containers:
- name: successful-job-2
image: busybox
command: ["/bin/sh", "-c", "sleep 10"]
restartPolicy: Never
```
Deployed these jobs and stopped in between to create only job 1 without waiting for it.
```bash
kapp deploy -a order -f order.yaml
Target cluster 'https://192.168.64.12:8443' (nodes: minikube)

Changes

Namespace Name Kind Age Op Op st. Wait to Rs Ri
default successful-job-1 Job - create - reconcile - -
^ successful-job-2 Job - create - reconcile - -

Op: 2 create, 0 delete, 0 update, 0 noop, 0 exists
Wait to: 2 reconcile, 0 delete, 0 noop

Continue? [yN]: y

6:28:20PM: ---- applying 1 changes [0/2 done] ----
6:28:20PM: create job/successful-job-2 (batch/v1) namespace: default
6:28:20PM: ---- waiting on 1 changes [0/2 done] ----
6:28:20PM: ongoing: reconcile job/successful-job-2 (batch/v1) namespace: default
6:28:20PM: ^ Waiting to complete (0 active, 0 failed, 0 succeeded)
6:28:20PM: L ongoing: waiting on pod/successful-job-2-jlwbz (v1) namespace: default
6:28:20PM: ^ Pending: ContainerCreating
^C
```
Deploy the jobs again
```bash
kapp deploy -a order -f order.yaml
Target cluster 'https://192.168.64.12:8443' (nodes: minikube)

Changes

Namespace Name Kind Age Op Op st. Wait to Rs Ri
default successful-job-1 Job - create - reconcile - -
^ successful-job-2 Job 5s - - reconcile ongoing Waiting to complete (1 active, 0
failed, 0 succeeded)

Op: 1 create, 0 delete, 0 update, 1 noop, 0 exists
Wait to: 2 reconcile, 0 delete, 0 noop

Continue? [yN]: y

6:28:27PM: ---- applying 2 changes [0/2 done] ----
6:28:27PM: noop job/successful-job-2 (batch/v1) namespace: default
6:28:27PM: create job/successful-job-1 (batch/v1) namespace: default
6:28:27PM: ---- waiting on 2 changes [0/2 done] ----
6:28:27PM: ongoing: reconcile job/successful-job-2 (batch/v1) namespace: default
... snip ...
6:28:48PM: ^ Completed
6:28:48PM: ---- applying complete [2/2 done] ----
6:28:48PM: ---- waiting complete [2/2 done] ----

Succeeded
```

**What happened:**
Even though `successful-job-1` depends on `successful-job-2` kapp tried to create `successful-job-1` before waiting for `successful-job-2` if the operation is `noop` for it.

**What did you expect:**
kapp should have waited for `successful-job-2` to be created successfully before deploying `successful-job-1`.

**Environment:**

- kapp version (use `kapp --version`):
- OS (e.g. from `/etc/os-release`):
- Kubernetes version (use `kubectl version`)

---
Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior with the provided jobs.yaml and kapp deploy commands, stopping after the first deployment and redeploying. Trace how kapp handles change-rule and change-group dependencies when an existing resource is a noop. Done means successful-job-1 is not created until successful-job-2 has completed its required wait.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.