Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Fix installer #107

Merged
merged 1 commit into from Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions docs/setup/install.md
Expand Up @@ -32,21 +32,18 @@ swift.sh [options]
options:
-h, --help show brief help
-n, --namespace=NAMESPACE specify namespace (default: kube-system)
--rbac create RBAC roles and bindings
--rbac create RBAC roles and bindings (default: true)
--docker-registry docker registry used to pull swift images (default: appscode)
--image-pull-secret name of secret used to pull swift operator images
--run-on-master run swift operator on master
--uninstall uninstall swift

# install without RBAC roles
$ curl -fsSL https://raw.githubusercontent.com/appscode/swift/0.7.2/hack/deploy/swift.sh \
| bash

# Install with RBAC roles
$ curl -fsSL https://raw.githubusercontent.com/appscode/swift/0.7.2/hack/deploy/swift.sh \
| bash -s -- --rbac
```

### Customizing Installer

If you would like to run Swift operator pod in `master` instances, pass the `--run-on-master` flag:

```console
Expand Down
69 changes: 40 additions & 29 deletions hack/deploy/swift.sh
Expand Up @@ -5,29 +5,34 @@ echo "checking kubeconfig context"
kubectl config current-context || { echo "Set a context (kubectl use-context <context>) out of the following:"; echo; kubectl config get-contexts; exit 1; }
echo ""

# ref: https://stackoverflow.com/a/27776822/244009
case "$(uname -s)" in
Darwin)
curl -fsSL -o onessl https://github.com/kubepack/onessl/releases/download/0.1.0/onessl-darwin-amd64
chmod +x onessl
export ONESSL=./onessl
;;

Linux)
curl -fsSL -o onessl https://github.com/kubepack/onessl/releases/download/0.1.0/onessl-linux-amd64
chmod +x onessl
export ONESSL=./onessl
;;

CYGWIN*|MINGW32*|MSYS*)
curl -fsSL -o onessl.exe https://github.com/kubepack/onessl/releases/download/0.1.0/onessl-windows-amd64.exe
chmod +x onessl.exe
export ONESSL=./onessl.exe
;;
*)
echo 'other OS'
;;
esac
# https://stackoverflow.com/a/677212/244009
if [ -x "$(command -v onessl >/dev/null 2>&1)" ]; then
export ONESSL=onessl
else
# ref: https://stackoverflow.com/a/27776822/244009
case "$(uname -s)" in
Darwin)
curl -fsSL -o onessl https://github.com/kubepack/onessl/releases/download/0.1.0/onessl-darwin-amd64
chmod +x onessl
export ONESSL=./onessl
;;

Linux)
curl -fsSL -o onessl https://github.com/kubepack/onessl/releases/download/0.1.0/onessl-linux-amd64
chmod +x onessl
export ONESSL=./onessl
;;

CYGWIN*|MINGW32*|MSYS*)
curl -fsSL -o onessl.exe https://github.com/kubepack/onessl/releases/download/0.1.0/onessl-windows-amd64.exe
chmod +x onessl.exe
export ONESSL=./onessl.exe
;;
*)
echo 'other OS'
;;
esac
fi

# http://redsymbol.net/articles/bash-exit-traps/
function cleanup {
Expand All @@ -40,8 +45,8 @@ trap cleanup EXIT
# ref: http://tldp.org/LDP/abs/html/comparison-ops.html

export SWIFT_NAMESPACE=kube-system
export SWIFT_SERVICE_ACCOUNT=default
export SWIFT_ENABLE_RBAC=false
export SWIFT_SERVICE_ACCOUNT=swift
export SWIFT_ENABLE_RBAC=true
export SWIFT_RUN_ON_MASTER=0
export SWIFT_DOCKER_REGISTRY=appscode
export SWIFT_IMAGE_PULL_SECRET=
Expand All @@ -55,7 +60,7 @@ show_help() {
echo "options:"
echo "-h, --help show brief help"
echo "-n, --namespace=NAMESPACE specify namespace (default: kube-system)"
echo " --rbac create RBAC roles and bindings"
echo " --rbac create RBAC roles and bindings (default: true)"
echo " --docker-registry docker registry used to pull swift images (default: appscode)"
echo " --image-pull-secret name of secret used to pull swift docker images"
echo " --run-on-master run swift operator on master"
Expand Down Expand Up @@ -91,9 +96,12 @@ while test $# -gt 0; do
export SWIFT_IMAGE_PULL_SECRET="name: '$secret'"
shift
;;
--rbac)
export SWIFT_SERVICE_ACCOUNT=swift
export SWIFT_ENABLE_RBAC=true
--rbac*)
val=`echo $1 | sed -e 's/^[^=]*=//g'`
if [ "$val" = "false" ]; then
export SWIFT_SERVICE_ACCOUNT=default
export SWIFT_ENABLE_RBAC=false
fi
shift
;;
--run-on-master)
Expand Down Expand Up @@ -138,3 +146,6 @@ if [ "$SWIFT_RUN_ON_MASTER" -eq 1 ]; then
kubectl patch deploy swift -n $SWIFT_NAMESPACE \
--patch="$(curl -fsSL https://raw.githubusercontent.com/appscode/swift/0.7.2/hack/deploy/run-on-master.yaml)"
fi

echo
echo "Successfully installed Swift!"