48 lines
1.3 KiB
CUE
48 lines
1.3 KiB
CUE
|
package helm
|
||
|
|
||
|
#code: #"""
|
||
|
# Install Helm
|
||
|
curl -sfL -S https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz | \
|
||
|
tar -zx -C /tmp && \
|
||
|
mv /tmp/linux-amd64/helm /usr/local/bin && \
|
||
|
chmod +x /usr/local/bin/helm
|
||
|
|
||
|
# Add the repository
|
||
|
helm repo add repository "${HELM_REPO}"
|
||
|
helm repo update
|
||
|
|
||
|
# If the chart is a file, then it's the chart name
|
||
|
# If it's a directly, then it's the contents of the cart
|
||
|
if [ -f "/helm/chart" ]; then
|
||
|
HELM_CHART="repository/$(cat /helm/chart)"
|
||
|
else
|
||
|
HELM_CHART="/helm/chart"
|
||
|
fi
|
||
|
|
||
|
OPTS=""
|
||
|
OPTS="$OPTS --timeout "$HELM_TIMEOUT""
|
||
|
OPTS="$OPTS --namespace "$KUBE_NAMESPACE""
|
||
|
[ "$HELM_WAIT" = "true" ] && OPTS="$OPTS --wait"
|
||
|
[ "$HELM_ATOMIC" = "true" ] && OPTS="$OPTS --atomic"
|
||
|
[ -f "/helm/values.yaml" ] && OPTS="$OPTS -f /helm/values.yaml"
|
||
|
|
||
|
# Select the namespace
|
||
|
kubectl create namespace "$KUBE_NAMESPACE" || true
|
||
|
|
||
|
case "$HELM_ACTION" in
|
||
|
install)
|
||
|
helm install $OPTS "$HELM_NAME" "$HELM_CHART"
|
||
|
;;
|
||
|
upgrade)
|
||
|
helm upgrade $OPTS "$HELM_NAME" "$HELM_CHART"
|
||
|
;;
|
||
|
installOrUpgrade)
|
||
|
helm upgrade $OPTS --install "$HELM_NAME" "$HELM_CHART"
|
||
|
;;
|
||
|
*)
|
||
|
echo unsupported helm action "$HELM_ACTION"
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
"""#
|