-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `upgrade` command to upgrade a release to a new version of the chart from GitHub
- Loading branch information
Showing
5 changed files
with
71 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
repos | ||
.idea | ||
helm-github.iml | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
# helm-github | ||
|
||
This is a helm plugin that installs raw helm charts from github. | ||
A Helm plugin that installs or upgrades raw Helm charts from GitHub | ||
|
||
* https://docs.helm.sh/helm/#helm-install | ||
* https://docs.helm.sh/helm/#helm-upgrade | ||
|
||
|
||
# Installation | ||
* `helm plugin install --version master https://github.com/sagansystems/helm-github.git` | ||
* `helm github --help` | ||
|
||
![image](https://user-images.githubusercontent.com/52489/33590100-fa79e052-d931-11e7-9879-b0fd7db7d09a.png) | ||
|
||
# Updates | ||
|
||
# `helm-github` plugin updates | ||
|
||
### Automatically | ||
* `helm github --update` | ||
|
||
### Manually | ||
* `cd $HELM_HOME/plugins/` | ||
* `git pull` | ||
|
||
|
||
|
||
# Usage | ||
* `helm github install --repo [email protected]:kubernetes/charts.git --path stable/external-dns/` | ||
|
||
### Install a chart from a GitHub repo | ||
|
||
* `helm github install --repo [email protected]:kubernetes/charts.git --path stable/external-dns` | ||
* `helm github install --repo [email protected]:coreos/alb-ingress-controller.git --ref 6d64984 --path alb-ingress-controller-helm` | ||
* `helm github install --repo [email protected]:coreos/alb-ingress-controller.git --ref master --path alb-ingress-controller-helm --namespace kube-system --name alb-ingress-ctlr-1 -f alb-ingress-controller/values.yml --version 0.0.6` | ||
|
||
### Upgrade the `happy-panda` release to a new version of the chart from a GitHub repo | ||
|
||
* `helm github upgrade happy-panda --repo [email protected]:kubernetes/charts.git --path stable/external-dns` | ||
* `helm github upgrade happy-panda --repo [email protected]:coreos/alb-ingress-controller.git --ref 6d64984 --path alb-ingress-controller-helm` | ||
* `helm github upgrade happy-panda --repo [email protected]:coreos/alb-ingress-controller.git --ref master --path alb-ingress-controller-helm -f alb-ingress-controller/values.yml --version 0.0.6` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,32 +3,35 @@ set -e | |
|
||
usage() { | ||
cat << EOF | ||
Install Helm charts from Github | ||
This is a helm plugin that installs raw helm charts from github. | ||
Example Usage: | ||
helm github install --repo [email protected]:coreos/alb-ingress-controller.git --ref master --path alb-ingress-controller-helm | ||
Install or upgrade Helm charts from Github | ||
https://docs.helm.sh/helm/#helm-install | ||
https://docs.helm.sh/helm/#helm-upgrade | ||
Available Commands: | ||
helm github install Install a Helm chart from Github | ||
helm github install Install a Helm chart from Github | ||
helm github upgrade <release> Upgrades the release to a new version of the Helm chart from Github | ||
Available Flags: | ||
--repo, -r (Required) Specify the repo to install | ||
--ref, -b (Optional) Specify the branch, commit, or reference to checkout before installing | ||
--path, -p (Optional) Specify a path within repo where helm chart is stored. Must be relative to base of repo. | ||
--path, -p (Optional) Specify a path within repo where helm chart is stored. Must be relative to base of repo | ||
--debug (Optional) Verbosity intensifies... ... | ||
--help (Optional) This text. | ||
--update, -u (Optional) Update this plugin to latest master. | ||
--update, -u (Optional) Update this plugin to the latest version from the master branch | ||
Example Usage: | ||
helm github install --repo [email protected]:coreos/alb-ingress-controller.git --ref master --path alb-ingress-controller-helm | ||
helm github upgrade happy-panda --repo [email protected]:kubernetes/charts.git --path stable/external-dns | ||
EOF | ||
} | ||
|
||
# Lets create the passthru array | ||
# Create the passthru array | ||
PASSTHRU=() | ||
while [[ $# -gt 0 ]] | ||
do | ||
key="$1" | ||
|
||
# Arg Parse | ||
# Parse arguments | ||
case $key in | ||
-r|--repo) | ||
REPO="$2" | ||
|
@@ -69,22 +72,22 @@ set -- "${PASSTHRU[@]}" | |
|
||
# Show help if flagged | ||
if [ "$HELP" == "TRUE" ]; then | ||
usage | ||
exit 1 | ||
usage | ||
exit 0 | ||
fi | ||
|
||
# Update plugin | ||
# Update this Helm plugin | ||
if [ "$UPDATE" == "TRUE" ]; then | ||
cd "$HELM_HOME/plugins/helm-github" | ||
git pull | ||
PLUGIN_VERSION=$(git log --pretty=format:'%h' -n 1) | ||
cd - | ||
echo "Success! Updated this plugin to: $PLUGIN_VERSION" | ||
exit 1 | ||
cd "$HELM_HOME/plugins/helm-github" | ||
git pull | ||
PLUGIN_VERSION=$(git log --pretty=format:'%h' -n 1) | ||
cd - | ||
echo "Success! Updated this plugin to: $PLUGIN_VERSION" | ||
exit 0 | ||
fi | ||
|
||
if [ -z "$REPO" ]; then | ||
echo "Error: No Repo provided. Please provide --repo flag." | ||
echo "Error: No Repo provided. Please provide --repo flag" | ||
usage | ||
exit 1 | ||
fi | ||
|
@@ -118,7 +121,7 @@ fi | |
if [ -d "${REPO_LOCATION}" ]; then | ||
cd $REPO_LOCATION | ||
git checkout master; | ||
git pull; | ||
git pull; | ||
else | ||
git clone $REPO $REPO_LOCATION; | ||
cd $REPO_LOCATION; | ||
|
@@ -130,6 +133,22 @@ git checkout $BRANCH | |
# Exit the repo | ||
cd - | ||
|
||
# Install it! | ||
# Take out the first variable in passthru (install) so that helm install works | ||
helm install $REPO_LOCATION/$CHARTPATH "${PASSTHRU[@]:1}" | ||
# COMMAND must be either 'install' or 'upgrade' | ||
COMMAND=${PASSTHRU[0]} | ||
|
||
if [ "$COMMAND" == "install" ]; then | ||
echo "Installing the Helm chart from the GitHub repo" | ||
# Take out the first variable in passthru (install) so that helm install works | ||
helm install "${PASSTHRU[@]:1}" $REPO_LOCATION/$CHARTPATH | ||
exit 0 | ||
elif [ "$COMMAND" == "upgrade" ]; then | ||
RELEASE=${PASSTHRU[1]} | ||
echo "Upgrading ${RELEASE} release to a new version of the chart from the GitHub repo" | ||
# Take out the first two variables in passthru (install <release>) so that helm upgrade works | ||
helm upgrade "${PASSTHRU[@]:2}" $RELEASE $REPO_LOCATION/$CHARTPATH | ||
exit 0 | ||
else | ||
echo "Error: Invalid command, must be one of 'install' or 'upgrade'" | ||
usage | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: "github" | ||
version: "0.1.0" | ||
usage: "Install helm charts from github repos" | ||
version: "0.2.0" | ||
usage: "Install or upgrade Helm charts from GitHub repos" | ||
description: |- | ||
This plugin installs raw Helm charts from Github. | ||
command: "$HELM_PLUGIN_DIR/github-install.sh" | ||
This plugin installs or upgrades raw Helm charts from Github | ||
command: "$HELM_PLUGIN_DIR/github.sh" |