From 7ff41553188847100f3970db7f4653ab887a3a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jerome=20K=C3=BCttner?= Date: Tue, 2 Jun 2020 15:08:06 +0200 Subject: [PATCH] Add support for yaml-anchors in chart ChartSpec.ValuesYaml yaml.v3 unmarshals to map[interface{}]interface{} if using yaml-anchors. Because helm converts yaml to json we have to unmarshal to map[string]interface{} instead of map[interface{}]interface{}. To achieve this we simply replace the yaml provider "gopkg.in/yaml.v3" with "sigs.k8s.io/yaml". For more details see https://github.com/go-yaml/yaml/issues/139 --- go.mod | 2 +- go.sum | 2 -- spec.go | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 2f6a8bd4..85517a06 100644 --- a/go.mod +++ b/go.mod @@ -6,11 +6,11 @@ require ( github.com/golang/mock v1.4.3 github.com/spf13/pflag v1.0.5 golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c helm.sh/helm/v3 v3.1.2 k8s.io/apiextensions-apiserver v0.17.2 k8s.io/apimachinery v0.17.2 k8s.io/cli-runtime v0.17.2 k8s.io/client-go v0.17.2 rsc.io/letsencrypt v0.0.3 // indirect + sigs.k8s.io/yaml v1.1.0 ) diff --git a/go.sum b/go.sum index b14e2401..a8c11c3d 100644 --- a/go.sum +++ b/go.sum @@ -661,8 +661,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= helm.sh/helm/v3 v3.1.2 h1:VpNzaNv2DX4aRnOCcV7v5Of+XT2SZrJ8iOQ25AGKOos= diff --git a/spec.go b/spec.go index 1682756d..4c122da7 100644 --- a/spec.go +++ b/spec.go @@ -1,7 +1,7 @@ package helmclient import ( - "gopkg.in/yaml.v3" + "sigs.k8s.io/yaml" ) // GetValuesMap returns the mapped out values of a chart