Support for ignore generated labels and annotations in diff
onedr0p opened this issue · 5 comments
It would be great if there was a way to remove the auto generated helm labels from the diff, see below for an example.
onedr0p/home-ops#5393 (comment)
I was doing something like this on my hacked xz version but you probably have more control here to omit certain labels and annotation (like helm.sh/chart
and checksum/config
) instead of all of them.
https://github.com/onedr0p/home-ops/blob/main/.github/scripts/helmReleaseDiff.mjs#L73-L81
Yes, good idea. My only previous idea for this was that maybe setting DIFF to dyff would make them tolerable.
Does helm know about these or is it safe to assume something w.r.t. their format (even if brittle.may be ok)? I want sure if this is a standard/convention or a variety of conventions based on chart author.
The helm one is definitely generated by helm automatically. I think it's safe to ignore the helm labels by default and give people the option to ignore others via jmespath or whatever.
Also I do like diff over dyff because dyff is awful at showing changes in multiline configmaps or container args.
Yeah there is already some code to strip kustomize annotations and we can add some configuration options to add more:
flux-local/flux_local/tool/visitor.py
Lines 22 to 25 in 0933c1e
My thought is to add a command line flag then add these as defaults in the diff action.
Before:
--- clusters/prod HelmRelease: metallb/metallb DaemonSet: metallb/metallb-speaker
+++ clusters/prod HelmRelease: metallb/metallb DaemonSet: metallb/metallb-speaker
@@ -3,13 +3,13 @@
kind: DaemonSet
metadata:
name: metallb-speaker
namespace: metallb
labels:
app.kubernetes.io/name: metallb
- helm.sh/chart: metallb-4.4.2
+ helm.sh/chart: metallb-4.5.1
app.kubernetes.io/instance: metallb
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: speaker
spec:
updateStrategy:
type: RollingUpdate
@@ -19,13 +19,13 @@
app.kubernetes.io/instance: metallb
app.kubernetes.io/component: speaker
template:
metadata:
labels:
app.kubernetes.io/name: metallb
- helm.sh/chart: metallb-4.4.2
+ helm.sh/chart: metallb-4.5.1
app.kubernetes.io/instance: metallb
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: speaker
spec:
serviceAccountName: metallb-speaker
affinity:
@@ -46,13 +46,13 @@
hostNetwork: true
securityContext:
fsGroup: 0
terminationGracePeriodSeconds: 2
containers:
- name: metallb-speaker
- image: docker.io/bitnami/metallb-speaker:0.13.9-debian-11-r24
+ image: docker.io/bitnami/metallb-speaker:0.13.9-debian-11-r27
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_ADMIN
After:
--- clusters/prod HelmRelease: metallb/metallb DaemonSet: metallb/metallb-speaker
+++ clusters/prod HelmRelease: metallb/metallb DaemonSet: metallb/metallb-speaker
@@ -44,13 +44,13 @@
hostNetwork: true
securityContext:
fsGroup: 0
terminationGracePeriodSeconds: 2
containers:
- name: metallb-speaker
- image: docker.io/bitnami/metallb-speaker:0.13.9-debian-11-r24
+ image: docker.io/bitnami/metallb-speaker:0.13.9-debian-11-r27
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_ADMIN
Nice work, thanks! I'll give it a shot later today