Fix chartify regression of missing chart dependencies (#1869)

* Fix chartify regression of missing chart dependencies

Fixes https://github.com/roboll/helmfile/issues/1867

* Add integration test cases for issues #1857 and #1867
This commit is contained in:
Yusuke Kuoka 2021-06-08 13:06:26 +09:00 committed by GitHub
parent 0d4adfedab
commit 72e71608b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 1 deletions

2
go.mod
View File

@ -28,7 +28,7 @@ require (
github.com/spf13/cobra v1.1.1
github.com/tatsushid/go-prettytable v0.0.0-20141013043238-ed2d14c29939
github.com/urfave/cli v1.22.5
github.com/variantdev/chartify v0.8.6
github.com/variantdev/chartify v0.8.9
github.com/variantdev/dag v1.0.0
github.com/variantdev/vals v0.14.0
go.uber.org/multierr v1.6.0

4
go.sum
View File

@ -630,6 +630,10 @@ github.com/variantdev/chartify v0.8.5 h1:yAw2+IxftPDR5A2/vr97Y6DR1U/2lJCHxfp40DB
github.com/variantdev/chartify v0.8.5/go.mod h1:qF4XzQlkfH/6k2jAi1hLas+lK4zSCa8kY+r5JdmLA68=
github.com/variantdev/chartify v0.8.6 h1:8WIJ/79qHg4cobFhZsA7VDyvLp0+W3O9SI31LlDnyOM=
github.com/variantdev/chartify v0.8.6/go.mod h1:qF4XzQlkfH/6k2jAi1hLas+lK4zSCa8kY+r5JdmLA68=
github.com/variantdev/chartify v0.8.8 h1:dsQyEfoSexCOPmGTSHIWYUuGkArN53B+43qTMfE7xU0=
github.com/variantdev/chartify v0.8.8/go.mod h1:qF4XzQlkfH/6k2jAi1hLas+lK4zSCa8kY+r5JdmLA68=
github.com/variantdev/chartify v0.8.9 h1:kECyWario6UOShilDThKfuvk+FhXWjlFod/Cg/wTmVs=
github.com/variantdev/chartify v0.8.9/go.mod h1:qF4XzQlkfH/6k2jAi1hLas+lK4zSCa8kY+r5JdmLA68=
github.com/variantdev/dag v0.0.0-20191028002400-bb0b3c785363 h1:KrfQBEUn+wEOQ/6UIfoqRDvn+Q/wZridQ7t0G1vQqKE=
github.com/variantdev/dag v0.0.0-20191028002400-bb0b3c785363/go.mod h1:pH1TQsNSLj2uxMo9NNl9zdGy01Wtn+/2MT96BrKmVyE=
github.com/variantdev/dag v1.0.0 h1:7SFjATxHtrYV20P3tx53yNDBMegz6RT4jv8JPHqAHdM=

View File

@ -0,0 +1,22 @@
repositories:
- name: prometheus-community
url: https://prometheus-community.github.io/helm-charts
releases:
- name: prometheus-operator-k8s-test
chart: prometheus-community/kube-prometheus-stack
namespace: monitoring
forceNamespace: monitoring
version: 15.4.6
labels:
component: test-upg
values:
- nameOverride: k8s
fullnameOverride: prometheus-k8s
global:
imagePullSecrets:
- name: regsecret
alertmanager:
enabled: false
grafana:
enabled: {{ .Values.grafanaEnabled }}

View File

@ -0,0 +1,18 @@
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
releases:
- name: elasticsearch
chart: bitnami/elasticsearch
version: 15.2.2
jsonPatches:
- target:
version: v1
kind: StatefulSet
name: elasticsearch-master
patch:
- op: add
path: /spec/template/spec/containers/0/volumeMounts/0/subPathExpr
value: elasticsearch/$(MY_POD_NAME)

View File

@ -150,6 +150,21 @@ info "Ensuring \"helmfile template\" output does contain only YAML docs"
test_pass "happypath"
test_start "regression tests"
if [[ helm_major_version -eq 3 ]]; then
info "https://github.com/roboll/helmfile/issues/1857"
(${helmfile} -f ${dir}/issue.1857.yaml --state-values-set grafanaEnabled=true template | grep grafana 1>/dev/null) || fail "\"helmfile template\" shouldn't include grafana"
! (${helmfile} -f ${dir}/issue.1857.yaml --state-values-set grafanaEnabled=false template | grep grafana) || fail "\"helmfile template\" shouldn't include grafana"
info "https://github.com/roboll/helmfile/issues/1867"
(${helmfile} -f ${dir}/issue.1867.yaml template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail"
else
info "There are no regression tests for helm 2 because all the target charts have dropped helm 2 support."
fi
test_pass "regression tests"
if [[ helm_major_version -eq 3 ]]; then
export VAULT_ADDR=http://127.0.0.1:8200
export VAULT_TOKEN=toor