carvel-dev / carvel-dev/kbld

Support resourceMatchers in searchRules

Open
#182 1 comment 5 reactions 0 assignees View on GitHub
carvel accepted enhancement
Dominant language
Go
Stars
329
Forks
52
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem/challenge you have**

The existing [key matcher](https://carvel.dev/kbld/docs/latest/config/#key-matcher) and [value matcher](https://carvel.dev/kbld/docs/latest/config/#value-matcher) are quite limited.

For example, let's say I have a `ConfigMap` with an `image` field:
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: image-config
data:
image: foo
```

You could use a key matcher to `name: image` and `path: [data]`, but that would potentially catch other resources (ConfigMaps or otherwise) that you didn't mean to include.

Alternatively, you could use a value matcher, but that can also suffer from false positives and requires knowing the image name and/or repo ahead of time.

**Describe the solution you'd like**

Support resourceMatchers, similar to what kapp does: https://carvel.dev/kapp/docs/latest/config/#resource-matchers. This would allow targeting specific kinds (ConfigMap) and names.

Once the resource matcher filters down to the resource(s), I think you'd still need the ability to specify paths *inside* the resource though.

**Anything else you would like to add:**
https://kubernetes.slack.com/archives/CH8KCCKA5/p1635201137105000?thread_ts=1635197514.098700&cid=CH8KCCKA5

---
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 by tracing the searchRules configuration and the existing key matcher and value matcher behavior, then compare the requested resourceMatchers semantics with kapp's resource-matchers documentation. Done should include targeting resources by kind and name while still allowing paths inside the selected resource, with coverage for the ConfigMap image example.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
cli, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.