Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hasAnnotationMatcher not working #963

Closed
antwacky opened this issue May 29, 2024 · 2 comments
Closed

hasAnnotationMatcher not working #963

antwacky opened this issue May 29, 2024 · 2 comments
Labels
discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution

Comments

@antwacky
Copy link

What steps did you take:

I have the below kapp config, which I expect to ignore changed to the labels field on all resources with the kapp.k14s.io/change-group.app annotation:

diffAgainstLastAppliedFieldExclusionRules:
- path: [metadata, labels]
  resourceMatchers:
    - hasAnnotationMatcher:
        keys:
        - "kapp.k14s.io/change-group.app"

What happened:

Kapp still detects changed to the labels for those resources with the given annotation.

What did you expect:

Kapp to ignore changes to those labels for resources with the given annotation.

Environment:

  • kapp version (use kapp --version):
kapp version 0.62.0
  • OS (e.g. from /etc/os-release):
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
  • Kubernetes version (use kubectl version)
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.16", GitCommit:"c5f43560a4f98f2af3743a59299fb79f07924373", GitTreeState:"clean", BuildDate:"2023-11-15T22:39:12Z", GoVersion:"go1.20.10", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.17+k3s1", GitCommit:"026bb0ec396744e93f870b624b6871de85de0ff9", GitTreeState:"clean", BuildDate:"2023-09-05T20:48:24Z", GoVersion:"go1.20.7", Compiler:"gc", Platform:"linux/amd64"}
@antwacky antwacky added bug This issue describes a defect or unexpected behavior carvel triage This issue has not yet been reviewed for validity labels May 29, 2024
@praveenrewar
Copy link
Member

Hey @antwacky!
If your intention is to not update certain fields, then I would recommend using the rebase rules. So for your use case, you can have something like:

rebaseRules:
- path: [metadata, labels]
  type: copy
  sources: [existing]
  resourceMatchers:
    - hasAnnotationMatcher:
        keys:
        - "kapp.k14s.io/change-group.app"

The LastApplied in diffAgainstLastAppliedFieldExclusionRules is something that kapp uses to do a "smart diff", so diffAgainstLast... is generally helpful for scenarios where something is not tracked in LastApplied. The matcher should be working fine, you can try using the - allMatcher: {} instead of it and I am sure that it would have the same result with diffAgainstLast....

@praveenrewar praveenrewar added discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution and removed bug This issue describes a defect or unexpected behavior labels May 30, 2024
@antwacky
Copy link
Author

That works, thanks :)

@github-project-automation github-project-automation bot moved this to Closed in Carvel May 30, 2024
@github-actions github-actions bot removed the carvel triage This issue has not yet been reviewed for validity label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This issue is not a bug or feature and a conversation is needed to find an appropriate resolution
Projects
Archived in project
Development

No branches or pull requests

2 participants