1
0
mirror of https://github.com/ubuntu/microk8s.git synced 2021-05-23 02:23:41 +03:00

Add Helm 3 wrapper (#882)

* Add Helm 3 wrapper

* Update wrappers

* Minor fixes after testing the PR

* Update snapcraft.yaml

* Wrappers should be executable. Or else the snap will not build.

Co-authored-by: Konstantinos Tsakalozos <kos.tsakalozos@canonical.com>
This commit is contained in:
Ivan
2020-01-10 14:54:19 +00:00
committed by Konstantinos Tsakalozos
parent 8fe9334bb8
commit 3c7aa52f43
5 changed files with 60 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e
source $SNAP/actions/common/utils.sh
echo "Disabling Helm 3"
if [ -f "${SNAP_DATA}/bin/helm3" ]
then
sudo rm -f "$SNAP_DATA/bin/helm3"
fi

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e
source $SNAP/actions/common/utils.sh
CA_CERT=/snap/core/current/etc/ssl/certs/ca-certificates.crt
echo "Enabling Helm 3"
if [ ! -f "${SNAP_DATA}/bin/helm3" ]
then
SOURCE_URI="https://get.helm.sh"
HELM_VERSION="v3.0.2"
echo "Fetching helm version $HELM_VERSION."
run_with_sudo mkdir -p "${SNAP_DATA}/tmp/helm"
(cd "${SNAP_DATA}/tmp/helm"
run_with_sudo "${SNAP}/usr/bin/curl" --cacert $CA_CERT -L $SOURCE_URI/helm-$HELM_VERSION-linux-$(arch).tar.gz -o "$SNAP_DATA/tmp/helm/helm.tar.gz"
run_with_sudo gzip -f -d "$SNAP_DATA/tmp/helm/helm.tar.gz"
run_with_sudo tar -xf "$SNAP_DATA/tmp/helm/helm.tar")
run_with_sudo mkdir -p "$SNAP_DATA/bin/"
run_with_sudo mv "$SNAP_DATA/tmp/helm/linux-$(arch)/helm" "$SNAP_DATA/bin/helm3"
run_with_sudo chmod +x "$SNAP_DATA/bin/"
run_with_sudo chmod +x "$SNAP_DATA/bin/helm3"
run_with_sudo rm -rf "$SNAP_DATA/tmp/helm"
fi
echo "Helm 3 is enabled"

View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -eu
export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
ARCH="$($SNAP/bin/uname -m)"
export LD_LIBRARY_PATH="$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/$ARCH-linux-gnu:$SNAP/usr/lib/$ARCH-linux-gnu"
if [ ! -f "${SNAP_DATA}/bin/helm3" ]; then
echo "Helm 3 not available, try enabling it with 'microk8s.enable helm3'" >&2
exit 0
fi
source $SNAP/actions/common/utils.sh
"${SNAP_DATA}/bin/helm3" --kubeconfig="${SNAP_DATA}"/credentials/client.config "$@"

View File

@@ -34,6 +34,7 @@ addon[jaeger]="pod/jaeger-operator"
addon[linkerd]="pod/linkerd-controller"
addon[cilium]="pod/cilium"
addon[helm]="${SNAP_DATA}/bin/helm"
addon[helm3]="${SNAP_DATA}/bin/helm3"
addon[juju]="${SNAP_DATA}/bin/juju"
addon[kubeflow]="pod/ambassador-operator-0 "
addon[metallb]="pod/speaker"

View File

@@ -81,6 +81,8 @@ apps:
command: microk8s-linkerd.wrapper
helm:
command: microk8s-helm.wrapper
helm3:
command: microk8s-helm3.wrapper
cilium:
command: microk8s-cilium.wrapper
juju: