carvel-dev / carvel-dev/ytt

Add a handy matcher that allows to check for just key existence

Open
#465 8 comments 4 reactions 0 assignees View on GitHub
enhancement priority/unprioritized-backlog
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem/challenge you have**
I want to create an overlay that identifies an array entry by its key and appends to that array entry. This occurs in kapp-controller with the following:

```
apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: simple-app
namespace: default
spec:
serviceAccountName: default-ns-sa
fetch:
# I want to append "subPath: config-step-2-template" to the end of the git option.
- git:
url: https://github.com/vmware-tanzu/carvel-simple-app-on-kubernetes
ref: origin/develop
template:
- ytt: {}
deploy:
- kapp: {}
```

This is currently achieved with the following:
```
#@overlay/match by=lambda _,l,r: "git" in l
```

Full example in the ytt playground:
https://carvel.dev/ytt/#gist:https://gist.github.com/voor/02c1d2e2d3c08fe42fd2df7659bc386a

**Describe the solution you'd like**
I think this is a use case that might come up often enough to justify looking at either adding this to a FAQ or creating a corresponding matcher.

**Anything else you would like to add:**
I never would have figured this out without phoning a friend.

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

Start with the linked ytt playground example and compare the existing overlay/match lambda behavior with the requested key-existence check. Decide whether the completed issue is a documented FAQ entry or a corresponding matcher, and verify the example works with the chosen approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.