carvel-dev / carvel-dev/kapp

Add `app-change describe` command to allow the user to view diffs for deployed changes

Open
#338 1 comment 2 reactions 1 assignee Claimed by @100mik View on GitHub
carvel accepted enhancement
Dominant language
Go
Stars
1.1k
Forks
134
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem/challenge you have**
As of today, `kapp app-change list -a app_name` lists the duration of changes deployed for an application and displays a summary of the operations performed. This feature could be extended to provide the user more insight by making the text diff for each change available.

**Describe the solution you'd like**
The config maps used to track app-changes can be used to store text diffs as well. And these can be exposed to the user through an `app-change describe` command.

The end result might be similar to this:
```zsh
❯ kapp app-change list -a test ─╯
Target cluster 'https://127.0.0.1:57406' (nodes: minikube)

App changes

Name Started At Finished At Successful Description
test-change-vx7z5 2021-10-06T09:12:36Z 2021-10-06T09:12:36Z true update: Op: 1 create, 0 delete, 1 update, 0 noop / Wait to: 2 reconcile, 0 delete, 0 noop
test-change-hcwrt 2021-10-06T09:11:56Z 2021-10-06T09:11:56Z true update: Op: 2 create, 0 delete, 0 update, 0 noop / Wait to: 2 reconcile, 0 delete, 0 noop

2 app changes

Succeeded

❯ kapp app-change describe -a test --app-change test-change-vx7z5

@@ create configmap/config-1-ver-2 (v1) namespace: default @@
...
1, 1 data:
2 - foo1: bar
2 + foo: bar
3, 3 kind: ConfigMap
4, 4 metadata:
@@ update configmap/config-2 (v1) namespace: default @@
...
8, 8 kind: ConfigMap
9 - name: config-1-ver-1
9 + name: config-1-ver-2
10, 10 creationTimestamp: "2021-10-06T09:11:56Z"
11, 11 labels:
```

**Acceptance Criteria**

- [x] Text diffs for app changes should be serialised and stored in app-change config maps in addition to any other information that might add value.
- [x] Expose command `app-change describe app_change_name` which presents the information for that particular change in an intuitive view.
- [ ] Make a flag `--app-change-diff` available, which can let the user to specify that they do not want to store the diff for a particular change.

**Checks needed**

- [x] Text diffs should be truncated if greater than 0.5 MB in size keeping in mind `etcd` [limitations](https://github.com/kubernetes/kubernetes/issues/19781).
- [ ] Consider special cases that might cause noisy diffs. (Like resources with `update-strategy: skip`)

**Anything else you would like to add:**

This will provide much needed observability into changes being applied by kapp in scenarios where a `kapp deploy` is automatically triggered periodically or due to an action.

---
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

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.