carvel-dev / carvel-dev/kapp

Crash when attempting to rebase an object from an array

Open
#191 1 comment 0 reactions 0 assignees View on GitHub
bug carvel accepted
Dominant language
Go
Stars
1.1k
Forks
134
PR merge metrics
No merged PRs in 30d

Description

**What steps did you take:**
1. Deploy the following resource:

```yaml
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cc-kpack-registry-service-account
namespace: cf-workloads-staging
secrets:
- name: cc-kpack-registry-auth-secret
- name: another-name-created-in-cluster
imagePullSecrets:
- name: cc-kpack-registry-auth-secret
```

2. Try a rebase rule to ignore the second item from changes done in the cluster

```yaml
- paths:
- [secrets, {index: 1}]
type: copy
sources: [existing, new]
resourceMatchers:
- kindNamespaceNameMatcher:
kind: ServiceAccount
name: cc-kpack-registry-service-account
namespace: cf-workloads-staging
```

**NOTE** using the path `[secrets, {index: 1}, name]` is not sufficient here. Kapp leaves behind an empty object `{}` at index position 1 which means it will always appear in the diff.

3. Deploy and notice kapp crashes.

**What happened:**
Kapp paniced and crashed when attempting to handle this rebase.

**What did you expect:**
The rebase should use the object that is in array index 1 on the cluster. Which is an object of the structure `{ name: another-name-created-in-cluster }`

**Anything else you would like to add:**
Kapp should support rebasing whole objects from an array. If it does not then noise is created in diffs when a controller adds an object to the resources array.

This is important to us in our automated deployments as this noise cannot be removed from kapp which makes it hard to reason about actual changes being made to the cluster.

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.