From cd2c0b44095cb7b64381a9787ab394210df40299 Mon Sep 17 00:00:00 2001 From: Timothy Middelkoop Date: Tue, 22 Jun 2021 17:22:33 -0500 Subject: [PATCH] Deploy BayesWaves on Kubernetes from a registry --- .gitignore | 2 ++ ReadMe.md | 34 ++++++++++++++++++++++++++++++++- bayeswave.yaml | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 bayeswave.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0bc7ca7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +config +token diff --git a/ReadMe.md b/ReadMe.md index 5e215d2..2ae34c6 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -26,7 +26,7 @@ docker run -it --rm bayeswave:latest -- BayesWave \ --Niter 500 --outputDir master-test ``` -Run example inside container (incomplete/fails) +Run example workflow inside container (incomplete/fails), skip this. ```bash docker run -it --rm bayeswave:latest -- /bin/bash install -dv /data ; cd /data @@ -38,3 +38,35 @@ sed -i -e 's|BAYESWAVE_PREFIX|/opt/bayeswave|g' LDG-GW150914.ini bash makework-LDG-GW150914.sh ``` +Setup login credentials using a "personal access token" stored in the file `token` in the following form: +```bash +REGISTRY_NAME="registry DNS name e.g. ghcr.io" +REGISTRY_TOKEN="personal access token" +REGISTRY_USER="user" +``` + +```bash +. ./token +echo $REGISTRY_TOKEN | docker login $REGISTRY_NAME -u $REGISTRY_USER --password-stdin +``` + +Push container to the registry. +```bash +. ./token +docker tag conda-env:latest $REGISTRY_NAME/$REGISTRY_USER/conda-env:latest +docker push $REGISTRY_NAME/$REGISTRY_USER/conda-env:latest +docker tag bayeswave:latest $REGISTRY_NAME/$REGISTRY_USER/bayeswave:latest +docker push $REGISTRY_NAME/$REGISTRY_USER/bayeswave:latest +``` + +Store token in Kubernetes cluster +```bash +kubectl create secret docker-registry registry-secret --docker-server="$REGISTRY_NAME" --docker-username="$REGISTRY_USER" --docker-password="$REGISTRY_TOKEN" +``` + +Deploy container as a Job. Assumes working kubectl and a default namespace. Note the evnsubst replaces the envrionment variables with their values. +```bash +. ./token +export REGISTRY_NAME REGISTRY_USER +cat bayeswave.yaml | envsubst | kubectl apply -f - +``` diff --git a/bayeswave.yaml b/bayeswave.yaml new file mode 100644 index 0000000..61d9410 --- /dev/null +++ b/bayeswave.yaml @@ -0,0 +1,51 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: bayeswave-job +spec: + template: + spec: + containers: + - name: bayeswave + resources: + requests: + memory: 500Mi + cpu: 250m + limits: + memory: 500Mi + cpu: 250m + image: $REGISTRY_URL/$REGISTRY_USER/bayeswave:latest + command: + - BayesWave + args: + - --ifo + - "H1" + - --H1-flow + - "32" + - --H1-cache + - "LALSimAdLIGO" + - --H1-channel + - "LALSimAdLIGO" + - --trigtime + - "900000000.00" + - --srate + - "512" + - --seglen + - "4" + - --PSDstart + - "900000000" + - --PSDlength + - "1024" + - --NCmin + - "2" + - --NCmax + - "2" + - --dataseed + - "1234" + - --Niter + - "500" + - --outputDir + - "master-test" + imagePullSecrets: + - name: registry-secret + restartPolicy: Never