Skip to content

Instantly share code, notes, and snippets.

@rm-rf-etc
Created August 8, 2018 02:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rm-rf-etc/6d949f2f52e6bbf87a9a2483c7b6f27d to your computer and use it in GitHub Desktop.
Save rm-rf-etc/6d949f2f52e6bbf87a9a2483c7b6f27d to your computer and use it in GitHub Desktop.
Install the ArangoDB Operator into a Kubernetes cluster
#!/bin/bash
# Installs the ArangoDB Operator into a Kubernetes cluster
LOCAL_STORAGE_YAML="\
apiVersion: storage.arangodb.com/v1alpha
kind: ArangoLocalStorage
metadata:
name: example-arangodb-storage
spec:
storageClass:
name: my-local-ssd
isDefault: true
localPath:
- /mnt/big-ssd-disk"
LOCAL_DEPLOYMENT_YAML="\
apiVersion: database.arangodb.com/v1alpha
kind: ArangoDeployment
metadata:
name: cluster
spec:
mode: Cluster"
VERSION=0.2.2
BASEURL=https://raw.githubusercontent.com/arangodb/kube-arangodb/$VERSION/manifests
function install () {
# This line fails if the ArangoLocalStorage exists, just comment it out
echo "$LOCAL_STORAGE_YAML" | kubectl apply -f - && \
kubectl apply -f $BASEURL/crd.yaml
kubectl apply -f $BASEURL/arango-deployment.yaml
kubectl apply -f $BASEURL/arango-storage.yaml
kubectl apply -f $BASEURL/arango-deployment-replication.yaml
# kubectl apply -f $BASEURL/arango-test.yaml
echo "$LOCAL_DEPLOYMENT_YAML" | kubectl apply -f -
}
function uninstall () {
echo "$LOCAL_DEPLOYMENT_YAML" | kubectl delete -f -
kubectl delete deploy arango-deployment-operator
kubectl delete deploy arango-storage-operator -n kube-system
kubectl delete deploy arango-deployment-replication-operator
kubectl delete po -l app=arangodb --force=true
# kubectl delete -f $BASEURL/crd.yaml
# kubectl delete -f $BASEURL/arango-deployment.yaml
# kubectl delete -f $BASEURL/arango-deployment-replication.yaml
# kubectl delete -f $BASEURL/arango-storage.yaml
# kubectl delete -f $BASEURL/arango-test.yaml
echo "$LOCAL_STORAGE_YAML" | kubectl delete -f -
}
case "$1" in
up)
install
;;
down)
uninstall
;;
*)
echo Must specify up or down
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment