This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
export KUBECONFIG=/home/chpark/.kube/config
|
||||
SUDO_PASS="${SUDO_PASS:-qlalfqjsgh11}"
|
||||
export KUBECONFIG="${KUBECONFIG:-/home/chpark/.kube/config}"
|
||||
|
||||
sudo_run() {
|
||||
echo "$SUDO_PASS" | sudo -S bash -c "$1"
|
||||
}
|
||||
# root 실행 시엔 sudo 생략, 일반 유저면 비번으로 sudo
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
sudo_run() { bash -c "$1"; }
|
||||
else
|
||||
SUDO_PASS="${SUDO_PASS:-qlalfqjsgh11}"
|
||||
sudo_run() { echo "$SUDO_PASS" | sudo -S bash -c "$1"; }
|
||||
fi
|
||||
|
||||
# CI(root) 환경에서 kubeconfig 없으면 k3s 것으로 대체
|
||||
if [ ! -r "$KUBECONFIG" ]; then
|
||||
if [ -r /etc/rancher/k3s/k3s.yaml ]; then
|
||||
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
||||
fi
|
||||
fi
|
||||
|
||||
cd /home/chpark
|
||||
if [ -d insurance/.git ]; then
|
||||
@@ -37,7 +47,7 @@ echo "[*] Applying Kubernetes manifests"
|
||||
kubectl apply -f deploy/k8s/namespace.yaml
|
||||
|
||||
SECRETS_FILE=/home/chpark/.insurance-secrets
|
||||
if [ -f "$SECRETS_FILE" ]; then
|
||||
if [ -r "$SECRETS_FILE" ]; then
|
||||
set -a; source "$SECRETS_FILE"; set +a
|
||||
fi
|
||||
POSTGRES_PASSWORD="${POSTGRES_PASSWORD:-$(openssl rand -hex 24)}"
|
||||
|
||||
Reference in New Issue
Block a user