File size: 950 Bytes
dcb9011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

# Runs rsync to transfer model data from the current directory to an OpenShift volume
# that is attached to a pod which is running Annif. The instance
# {api-annif-org,ai-finto-fi, etc.} to transfer to is given as the argument.
# You need to be logged to the cluster with the oc tool.

set -e

if [ $# -ne 1 ]
  then
    echo "Not enough arguments; argument 1: destination_instance"
    exit 1
fi

pod=$(oc get pods -l app.kubernetes.io/instance=$1,app.kubernetes.io/name=annif -o name)

if [[ $pod = *[[:space:]]* ]]
  then
    echo "Multiple pod exists; using first"
    pod=(${pod//$'\n'/ })
fi
echo "Target is "$pod
pod=${pod#pod/}
if [ -z "${pod}" ]
  then
    echo "No target pod found"
    exit 1
fi

rsync --rsh='oc rsh' -avrL --exclude="*train*" --exclude="*zip" --inplace projects.d $pod:/annif-projects
rsync --rsh='oc rsh' -avrL --exclude="*train*" --exclude="*zip" --inplace data/{projects,vocabs} $pod:/annif-projects/data