Fully working oc-k8s

This commit is contained in:
mr
2026-02-05 08:43:21 +01:00
parent 5acf96919c
commit 7fb81e9829
16 changed files with 253 additions and 163 deletions

View File

@@ -71,11 +71,9 @@ func Create_DB(filePath *string, release string, namespace string, dbName string
}
for _, fileName := range getFileNames(*filePath) {
fmt.Println("ADD file " + fileName + " in collection")
fmt.Println("kubectl cp -n " + namespace + " " + *filePath + "/" + fileName + " \"" + podName + ":/tmp/" + fileName + "\"")
if err := utils.Exec("kubectl cp -n " + namespace + " " + *filePath + "/" + fileName + " \"" + podName + ":/tmp/" + fileName + "\""); err != nil {
return err
}
fmt.Println("kubectl exec -n " + namespace + " " + podName + " -- mongoimport --db " + dbName + " --collection " + strings.ReplaceAll(fileName, ".json", "") + " --file /tmp/" + fileName + " --jsonArray -u " + adminUsr + " -p " + adminPsw +" --authenticationDatabase admin")
if err := utils.Exec("kubectl exec -n " + namespace + " " + podName + " -- mongoimport --db " + dbName + " --collection " + strings.ReplaceAll(fileName, ".json", "") + " --file /tmp/" + fileName + " --jsonArray -u " + adminUsr + " -p " + adminPsw +" --authenticationDatabase admin"); err != nil {
return err
}