Commit 54c85615 authored by Jasper Koehorst's avatar Jasper Koehorst
Browse files

sync setup function added

parent 4ca9d67b
......@@ -8,9 +8,9 @@
#============================================================================
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
usage() { echo "Usage: $0 [-c|--cwl] [-r|--references] [-i|--infrastructure] [-a|--all]" 1>&2; exit 1; }
usage() { echo "Usage: $0 [-c|--cwl] [-r|--references] [-i|--infrastructure] [-s|--setup] [-a|--all]" 1>&2; exit 1; }
vars=$(getopt -o c:r:i:a: --long cwl:,references:,infrastructure:,all:)
vars=$(getopt -o c:r:i:s:a: --long cwl:,references:,infrastructure:,setup:,all:)
#============================================================================
# KUBERNETES
......@@ -36,12 +36,14 @@ if $runall; then
sed "s/HOSTNAME/$node/g" $DIR/template_sync_cwl.yaml > $DIR/$node\_cwl.yaml
sed "s/HOSTNAME/$node/g" $DIR/template_sync_infrastructure.yaml > $DIR/$node\_infrastructure.yaml
sed "s/HOSTNAME/$node/g" $DIR/template_sync_references.yaml > $DIR/$node\_references.yaml
sed "s/HOSTNAME/$node/g" $DIR/template_sync_install.yaml > $DIR/$node\_install.yaml
kubectl apply -f $DIR/$node\_cwl.yaml
kubectl apply -f $DIR/$node\_infrastructure.yaml
kubectl apply -f $DIR/$node\_references.yaml
kubectl apply -f $DIR/$node\_install.yaml
# Cleanup
rm $DIR/$node\_cwl.yaml $DIR/$node\_infrastructure.yaml $DIR/$node\_references.yaml
rm $DIR/$node\_cwl.yaml $DIR/$node\_infrastructure.yaml $DIR/$node\_references.yaml $DIR/$node\_install.yaml
done < $DIR/nodes.txt
......@@ -80,6 +82,16 @@ for opt; do
rm $DIR/$node\_infrastructure.yaml
done < $DIR/nodes.txt
;;
-s|--setup)
while read node; do
sed "s/HOSTNAME/$node/g" $DIR/template_sync_setup.yaml > $DIR/$node\_setup.yaml
kubectl apply -f $DIR/$node\_setup.yaml
# Cleanup
rm $DIR/$node\_setup.yaml
done < $DIR/nodes.txt
;;
*)
usage
......
apiVersion: v1
kind: Pod
metadata:
name: munlock-sync-setup-HOSTNAME
namespace: unlock
labels:
purpose: sync-folder-to-local-node
spec:
containers:
- name: munlock-sync-HOSTNAME
image: docker-registry.wur.nl/unlock/docker:kubernetes
command: ["/bin/sh","-c"]
args: ["\
echo starting;\
chmod +x /unlock/infrastructure/binaries/scripts/setup.sh;\
bash -e /unlock/infrastructure/binaries/scripts/setup.sh;\
echo finished;\
"]
volumeMounts:
- mountPath: /unlock
name: unlock
restartPolicy: OnFailure
volumes:
- name: unlock
persistentVolumeClaim:
claimName: unlock
nodeSelector:
kubernetes.io/hostname: HOSTNAME
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment