Skip to content

fix: strip fluxcd managed labels - #1065

Merged
yxxhero merged 3 commits into
databus23:masterfrom
jkroepke:patch-1
Sep 9, 2026
Merged

yxxhero merged 3 commits into
databus23:masterfrom
jkroepke:patch-1

Conversation

@jkroepke

@jkroepke jkroepke commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

running helm diff against fluxcd managed helm release also shows a diff in terms of labels.


The current workaround is using

      --suppress-output-line-regex="helm.toolkit.fluxcd.io/name:" \
      --suppress-output-line-regex="helm.toolkit.fluxcd.io/namespace:" \

However, each single resource is present in the output with a suppressed notice.

An alternative approach would be:

      --strip-output-line-regex="helm.toolkit.fluxcd.io/name:" \
      --strip-output-line-regex="helm.toolkit.fluxcd.io/namespace:" \

The strip-output-lines is executed on source and target, before diff. Without any notice on the diff output.

@yxxhero

yxxhero commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

@jkroepke lint issue.

@yxxhero

yxxhero commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Error: manifest/util.go:33:1: File is not properly formatted (gci)
pruneNestedMap(metadata, "labels",
^
1 issues:

  • gci: 1

Error: issues found
Ran golangci-lint in 22762ms

Comment thread manifest/util.go Outdated
@yxxhero

yxxhero commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Error: manifest/util.go:34:1: File is not properly formatted (gci)
pruneNestedMap(metadata, "labels",
^
1 issues:

  • gci: 1

Error: issues found
Ran golangci-lint in 3195ms

@jkroepke

jkroepke commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@yxxhero this PR does not close #1064

@yxxhero
yxxhero merged commit 39b9ebc into databus23:master Sep 9, 2026
25 checks passed
@jkroepke
jkroepke deleted the patch-1 branch September 9, 2026 09:32
yxxhero added a commit that referenced this pull request Sep 25, 2026
Resolve conflicts between the three-way merge for unstructured objects
(PR #923) and the changes that landed on master since, most notably:

- #1063 restructured createPatch to return a *resourcePatch and moved
  patch application into applyPatch with the client-side fallback. The
  three-way merge for unstructured objects (CRDs, CRs) now produces the
  current->merged patch as patch.data with patchType MergePatchType, so
  it flows through both the server dry-run and the local merge path.
- #1068/#1065/#1044 rewrote the metadata tidy logic with
  pruneNestedMap. Keep that implementation (a superset of the annotation
  cleanup this PR inlined) together with the null-input and type-safety
  hardening of deleteStatusAndTidyMetadata.
- generate_test.go was created independently on both sides; keep
  master's local-merge tests and re-add this PR's unstructured/CRD
  tests, adapted to the new createPatch signature.

Signed-off-by: yxxhero <yxxhero@users.noreply.github.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: helm-diff shows - labels, if resource contains only app.kubernetes.io/managed-by label

2 participants