-
Notifications
You must be signed in to change notification settings - Fork 294
Description
Hello,
helm-diff is showing an incomplete diff
... if resources are added via kustomize and the helm chart is local and has dependencies.
helm-diff is behaving correctly
... when not using dependencies and just using a local helm chart with kustomize postRenderer.
Needed resources are provided as code under section resources so it can be reproduced locally.
Versions
# kubectl version with installed kustomize (https://kubectl.docs.kubernetes.io/installation/kustomize/)
Client Version: v1.32.0
Kustomize Version: v5.5.0
# helm version
version.BuildInfo{Version:"v3.16.4", GitCommit:"7877b45b63f95635153b29a42c0c2f4273ec45ca", GitTreeState:"dirty", GoVersion:"go1.23.4"}
# helm diff version
3.9.13
For the sake of this example no complex configuration should be needed as we are just about to throw a diff against a kubernetes cluster and verify if the additional resources come up in the output diff when running helm diff upgrade
command as shown under resources/helm-upgrade-command.
Please note that the vpa subchart in goldlocks is set to enabled: false
to avoid mis-interpretation.
Actual Result
After running the diff command helmChartAfterKustomize.yaml
is showing the VerticalPodAutoscaler
that was added to the manifest via vpa-controller.yaml
where as in the diff_output.txt
or stdout its no where to be found that its to be added.
Expected Result
The diff output should show added resource via postRenderer -> kustomize
Resources
The following instructions under resources should create a directory structure like so
.
├── helm
│ └── Chart.yaml
│ └── values.yaml
├── all.yaml # auto created when helm post-renderer is executed
├── diff_output.txt # auto created when helm diff upgrade is run
├── helmChartAfterKustomize.yaml # auto created when helm post-renderer is executed
├── kustomization.yaml
└── vpa-controller.yaml
helm upgrade command
helm diff upgrade \
--allow-unreleased \
--color \
--post-renderer ./kustomize.sh \
--three-way-merge \
--values values.yaml \
--version "1.0.0" \
goldilocks helm \
| tee >(sed $'s/\033[[][^A-Za-z]*[A-Za-z]//g' > diff_output.txt)
kustomize.sh
#!/usr/bin/env bash
set -euo pipefail
kustomizeInput=$(</dev/stdin)
printf "%s" "${kustomizeInput}" > all.yaml
kustomizeOutput=$(kubectl kustomize .)
# add YAML resource separator at the beginning
kustomizeOutput="---
${kustomizeOutput}"
# create local copy for debugging purpose
printf "%s" "${kustomizeOutput}" | envsubst | tee helmChartAfterKustomize.yaml
create helm/Chart.yaml
---
apiVersion: v2
name: goldilocks-dashboard
description: A Parent Helm chart for our goldilocks dashboard
type: application
version: 1.0.0
dependencies:
- name: goldilocks
repository: "https://charts.fairwinds.com/stable"
version: 9.0.1
- name: oauth2-proxy
alias: proxy-dashboard
repository: https://oauth2-proxy.github.io/manifests
version: 7.8.1
create helm/values.yaml
---
# for a list of all available attributes see
# see https://artifacthub.io/packages/helm/fairwinds-stable/goldilocks?modal=values
goldilocks: {}
# for a list of all available attributes see
# see https://artifacthub.io/packages/helm/oauth2-proxy/oauth2-proxy?modal=values
proxy-dashboard: {}
create values.yaml
---
goldilocks:
vpa:
enabled: false
dashboard:
ingress:
enabled: false
kustomization.yaml
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- all.yaml
- vpa-controller.yaml
vpa-controller.yaml
---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: goldilocks-controller
namespace: goldilocks
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: goldilocks-controller
updatePolicy:
updateMode: Auto