Skip to content

Commit d5d9c3c

Browse files
committed
Set k8s version for helm template
In the `hack/setup*` scripts we use `helm template` indirectly via `kustomize`. The version of Kubernetes in that case is hardcoded to `1.20.x`, which is causing a version check from the ingress chart to fail. This sets the k8s version to the version that is read at runtime from the launched kind cluster.
1 parent 2cf7b42 commit d5d9c3c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hack/helm.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ set -o nounset
2323
set -o errtrace
2424

2525
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
26-
go run -modfile "${ROOT}/tools/go.mod" helm.sh/helm/v3/cmd/helm "$@"
26+
K8_VERSION_MAJOR=$(kubectl version -o json |jq -r .serverVersion.major)
27+
K8_VERSION_MINOR=$(kubectl version -o json |jq -r .serverVersion.minor)
28+
LDFLAGS="-X helm.sh/helm/v3/pkg/chartutil.k8sVersionMajor=${K8_VERSION_MAJOR} -X helm.sh/helm/v3/pkg/chartutil.k8sVersionMinor=${K8_VERSION_MINOR}"
29+
go run -modfile "${ROOT}/tools/go.mod" -ldflags "${LDFLAGS}" helm.sh/helm/v3/cmd/helm --debug "$@"

0 commit comments

Comments
 (0)