Add import datas for K8s
This commit is contained in:
12
import_datas.sh
Executable file
12
import_datas.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
FILES=$(ls $1 | grep .json)
|
||||
BRANCH=${2:-dev}
|
||||
|
||||
export KUBECONFIG=$(realpath ./deployed_config)
|
||||
|
||||
POD_NAME=$(kubectl get pods --all-namespaces -o=name | grep dev-mongodb-*)
|
||||
for file in "${FILES[@]}"; do
|
||||
echo "ADD file $file in collection ${file/.json/} : ${POD_NAME/pod\//}"
|
||||
kubectl cp $file ${POD_NAME/pod\//}:/tmp/$file
|
||||
kubectl exec ${POD_NAME/pod\//}: -- mongoimport --db DC_myDC --collection ${file/.json/} --file /tmp/$file --jsonArray
|
||||
done
|
||||
Reference in New Issue
Block a user