Last active
May 21, 2019 08:19
-
-
Save jdolitsky/28dbc0fd57f5d8662dff2959c1390ca3 to your computer and use it in GitHub Desktop.
Installing Redis with Helm 3 (Note: this will also bootstrap Helm 3 on Mac)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
# | |
# Magic Helm 3.0.0-alpha1 macOS install script here: | |
# https://gist.github.com/jdolitsky/0ec804b09f24a24b05acb681f01903c9 | |
# ---> | |
GIST_ID="${GIST_SLUG:-jdolitsky/0ec804b09f24a24b05acb681f01903c9}" | |
GIST_FILE="${GIST_FILE:-install_helm3alpha1_mac.sh}" | |
GIST_URL="https://gist.githubusercontent.com/${GIST_ID}/raw/${GIST_FILE}" | |
# | |
# Helm chart we want to install - ex.) Bitnami Redis hosted on bundle.bar | |
# ---> | |
CHART_REF="${CHART_REF:-bundle.bar/helm/hub/bitnami/redis:7.1.1-alpha1}" | |
CHART_DIR="$(echo "${CHART_REF}"| awk -F: '{ print $1 }' | xargs basename)" | |
# | |
# Helm release name and namespace | |
# ---> | |
RELEASE_NAME="${RELEASE_NAME:-testredis}" | |
RELEASE_NAMESPACE="${RELEASE_NAMESPACE:-default}" | |
# | |
# Install Helm 3 to /tmp/helm3/bin/helm if not exists (and ask for permission) | |
# ---> | |
if [[ ! -x "/tmp/helm3/bin/helm" ]]; then | |
set +x | |
echo "Helm 3 not installed to /tmp/helm3/bin/helm." | |
if [[ "$(uname)" != "Darwin" ]]; then | |
echo "Please see latest release: https://github.com/helm/helm/releases/tag/v3.0.0-alpha.1" | |
exit 1 | |
fi | |
echo -en "Going to download and execute ${GIST_URL}\nThis ok? (type \"yes\"): " | |
read answer | |
if [[ "$answer" != "yes" ]]; then | |
exit 1 | |
fi | |
curl "${GIST_URL}" | bash | |
set -x | |
fi | |
# | |
# Activate Helm 3 | |
# ---> | |
export HELM_HOME="/tmp/helm3" | |
export PATH="${HELM_HOME}/bin:${PATH}" | |
# | |
# Download remote chart | |
# ---> | |
helm chart pull "${CHART_REF}" | |
# | |
# List all charts in cache | |
# ---> | |
helm chart list | |
# | |
# Export chart to local directory | |
# ---> | |
rm -rf "${CHART_DIR}" | |
helm chart export "${CHART_REF}" | |
# | |
# Install chart into namespace | |
# ---> | |
helm upgrade --install --namespace="${RELEASE_NAMESPACE}" "${RELEASE_NAME}" "${CHART_DIR}" | |
# | |
# List all releases in namespace | |
# ---> | |
helm list --namespace="${RELEASE_NAMESPACE}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One-liner to run this: