tool: download helm CLI

Updates tailscale/tailscale#9222

Signed-off-by: Irbe Krumina <[email protected]>
This commit is contained in:
Irbe Krumina committed 2023-10-30 13:59:46 +00:00
1 parent ced02933b7
commit 715ccc72b8
5 files changed
+97 -18

No files matched your search

+17 -15
View File
@@ -4,24 +4,26 @@
apiVersion: v1
name: tailscale-operator
description: A Helm chart for Tailscale Kubernetes operator
home: https://github.com/tailscale/tailscale
keywords:
- "tailscale"
- "vpn"
- "ingress"
- "egress"
- "wireguard"
sources:
- https://github.com/tailscale/tailscale
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
maintainers:
- name: tailscale-maintainers
url: https://tailscale.com/
# version will be set to Tailscale repo tag (without 'v') at release time.
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
# appVersion will be set to Tailscale repo tag at release time.
appVersion: "unstable"
@@ -45,7 +45,8 @@ spec:
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
image: {{ .Values.operatorConfig.image.repo }}:{{ .Values.operatorConfig.image.tag | default .Chart.AppVersion }}
{{- $operatorTag:= printf ":%s" ( .Values.operatorConfig.image.tag | default .Chart.AppVersion )}}
image: {{ .Values.operatorConfig.image.repo }}{{- if .Values.operatorConfig.image.digest -}}{{ printf "@%s" .Values.operatorConfig.image.digest}}{{- else -}}{{ printf "%s" $operatorTag }}{{- end }}
imagePullPolicy: {{ .Values.operatorConfig.image.pullPolicy }}
env:
- name: OPERATOR_HOSTNAME
@@ -62,8 +63,9 @@ spec:
value: /oauth/client_id
- name: CLIENT_SECRET_FILE
value: /oauth/client_secret
{{- $proxyTag := printf ":%s" ( .Values.proxyConfig.image.tag | default .Chart.AppVersion )}}
- name: PROXY_IMAGE
value: {{ .Values.proxyConfig.image.repo }}:{{ .Values.proxyConfig.image.tag | default .Chart.AppVersion }}
value: {{ .Values.proxyConfig.image.repo }}{{- if .Values.proxyConfig.image.digest -}}{{ printf "@%s" .Values.proxyConfig.image.digest}}{{- else -}}{{ printf "%s" $proxyTag }}{{- end }}
- name: PROXY_TAGS
value: {{ .Values.proxyConfig.defaultTags }}
- name: APISERVER_PROXY
+6 -1
View File
@@ -11,8 +11,10 @@
operatorConfig:
image:
repo: tailscale/k8s-operator
# Overrides the image tag whose default is the chart appVersion.
# Digest will be prioritized over tag. If neither are set appVersion will be
# used.
tag: ""
digest: ""
logging: "info"
hostname: "tailscale-operator"
nodeSelector:
@@ -26,7 +28,10 @@ operatorConfig:
proxyConfig:
image:
repo: tailscale/tailscale
# Digest will be prioritized over tag. If neither are set appVersion will be
# used.
tag: ""
digest: ""
# ACL tag that operator will tag proxies with. Operator must be made owner of
# these tags
# https://tailscale.com/kb/1236/kubernetes-operator/?q=operator#setting-up-the-kubernetes-operator
Executable
+69
View File
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
# installs $(cat ./helm.rev) version of helm as $HOME/.cache/tailscale-helm
set -euo pipefail
if [[ "${CI:-}" == "true" ]]; then
set -x
fi
(
if [[ "${CI:-}" == "true" ]]; then
set -x
fi
repo_root="${BASH_SOURCE%/*}/../"
cd "$repo_root"
cachedir="$HOME/.cache/tailscale-helm"
tarball="${cachedir}.tar.gz"
read -r want_rev < "$(dirname "$0")/helm.rev"
got_rev=""
if [[ -x "${cachedir}/helm" ]]; then
got_rev=$("${cachedir}/helm" version --short)
got_rev="${got_rev#v}" # trim the leading 'v'
got_rev="${got_rev%+*}" # trim the trailing '+" followed by a commit SHA'
fi
if [[ "$want_rev" != "$got_rev" ]]; then
rm -rf "$cachedir" "$tarball"
if [[ -n "${IN_NIX_SHELL:-}" ]]; then
nix_helm="$(which -a helm | grep /nix/store | head -1)"
nix_helm="${nix_helm%/helm}"
nix_helm_rev="${nix_helm##*-}"
if [[ "$nix_helm_rev" != "$want_rev" ]]; then
echo "Wrong helm version in Nix, got $nix_helm_rev want $want_rev" >&2
exit 1
fi
ln -sf "$nix_helm" "$cachedir"
else
# works for linux and darwin
# https://github.com/helm/helm/releases
OS=$(uname -s | tr A-Z a-z)
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH="amd64"
fi
if [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
fi
mkdir -p "$cachedir"
# When running on GitHub in CI, the below curl sometimes fails with
# INTERNAL_ERROR after finishing the download. The most common cause
# of INTERNAL_ERROR is glitches in intermediate hosts handling of
# HTTP/2 forwarding, so forcing HTTP 1.1 often fixes the issue. See
# https://github.com/tailscale/tailscale/issues/8988
curl -f -L --http1.1 -o "$tarball" -sSL "https://get.helm.sh/helm-v${want_rev}-${OS}-${ARCH}.tar.gz"
(cd "$cachedir" && tar --strip-components=1 -xf "$tarball")
rm -f "$tarball"
fi
fi
)
export PATH="$HOME/.cache/tailscale-helm:$PATH"
exec "$HOME/.cache/tailscale-helm/helm" "$@"
+1
View File
@@ -0,0 +1 @@
3.13.1