command
This commit is contained in:
17
oc-k8s.sh
17
oc-k8s.sh
@@ -31,7 +31,7 @@ main_delete_db() {
|
||||
|
||||
|
||||
POD_NAME=$(kubectl get pods --all-namespaces -o=name | grep $RELEASE-mongodb-*)
|
||||
kubectl exec ${POD_NAME/pod\//}: -- mongosh --eval "db.getSiblingDB('$DB_NAME').dropDatabase()"
|
||||
kubectl exec /pod\//}: -- mongosh --eval "db.getSiblingDB('$DB_NAME').dropDatabase()"
|
||||
}
|
||||
|
||||
main_install_db() {
|
||||
@@ -161,6 +161,7 @@ build_service() {
|
||||
local repo_url="https://cloud.o-forge.io/core/$1.git"
|
||||
local branch=${2:-main}
|
||||
local target=${3:-all}
|
||||
local hostname=${4:-beta.opencloud.com}
|
||||
local repo_name=$(basename "$repo_url" .git)
|
||||
|
||||
server=$(grep 'server:' ~/.kube/config | awk '{print $2}')
|
||||
@@ -185,7 +186,7 @@ build_service() {
|
||||
cd "$repo_name" && git checkout $branch && git pull
|
||||
|
||||
echo "Running 'make $target' in $repo_name"
|
||||
export HOST="${2:-http://beta.opencloud.com/}" && export KUBERNETES_SERVICE_HOST=$host && export KUBERNETES_SERVICE_PORT=$port \
|
||||
export HOST="$hostname" && export KUBERNETES_SERVICE_HOST=$host && export KUBERNETES_SERVICE_PORT=$port \
|
||||
&& export KUBE_CA=$ca && export KUBE_CERT=$cert && export KUBE_DATA=$key && make "$target"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: make $target failed in $dir"
|
||||
@@ -195,13 +196,15 @@ build_service() {
|
||||
}
|
||||
|
||||
main_build_services() {
|
||||
branch=${1:-main}
|
||||
target=${2:-all}
|
||||
local env=${1:-dev}
|
||||
local branch=${2:-main}
|
||||
local target=${3:-all}
|
||||
local hostname=$(grep 'host:' ./opencloud/values/$env-values.yaml | awk '{print $2}')
|
||||
# docker system prune -af
|
||||
cd ..
|
||||
# Iterate through each repository in the list
|
||||
for repo in "${REPOS[@]}"; do
|
||||
build_service "$repo" "$branch" "$target"
|
||||
build_service "$repo" "$branch" "$target" "$hostname"
|
||||
done
|
||||
echo "All repositories processed successfully."
|
||||
}
|
||||
@@ -386,7 +389,7 @@ Usage:
|
||||
oc-k8s install [arch] [version]
|
||||
arch - Arch of OS (required)
|
||||
kind_version - version of kind (required)
|
||||
oc-k8s start [env] [branch] [target]
|
||||
oc-k8s start [env] [branch] [target] [hostname]
|
||||
env - environnement selected (default: dev)
|
||||
branch - Git branch to build (default: main)
|
||||
target - make target (default: all)
|
||||
@@ -406,7 +409,7 @@ main_start() {
|
||||
sudo /etc/init.d/apache2 stop
|
||||
sudo nginx -s stop
|
||||
main_create_cluster
|
||||
main_build_services "${@:2}"
|
||||
main_build_services "${@:1}"
|
||||
cd ./oc-k8s
|
||||
main_create_helm $1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user