diff --git a/deploy/dev/k8s/kube_templates/aisproxy_deployment.yml b/deploy/dev/k8s/kube_templates/aisproxy_deployment.yml index 45ac2fe015..309db13eed 100644 --- a/deploy/dev/k8s/kube_templates/aisproxy_deployment.yml +++ b/deploy/dev/k8s/kube_templates/aisproxy_deployment.yml @@ -50,6 +50,8 @@ spec: export AIS_LOCAL_CONF_FILE=/etc/ais/ais_local.json && export STATSD_CONF_FILE="/etc/ais/statsd.conf" && export COLLECTD_CONF_FILE="/etc/ais/collectd.conf" && + export INSTANCE=${INSTANCE} && + export AIS_LOG_DIR=${AIS_LOG_DIR} && source /etc/ais/aisnode_config.sh && aisnode -config=/etc/ais/ais.json -local_config=/etc/ais/ais_local.json -role=proxy -ntargets=${TARGET_CNT}; volumes: diff --git a/deploy/dev/k8s/kube_templates/aistarget_deployment.yml b/deploy/dev/k8s/kube_templates/aistarget_deployment.yml index b35d93f901..6a7df763e2 100644 --- a/deploy/dev/k8s/kube_templates/aistarget_deployment.yml +++ b/deploy/dev/k8s/kube_templates/aistarget_deployment.yml @@ -37,10 +37,10 @@ spec: volumeMounts: - name: aws-credentials mountPath: /root/.aws/ - - name: ais-fs + - name: ais-persistent-fs mountPath: /usr/nvidia/data - - name: ais-log - mountPath: /tmp/ + - name: ais-fs + mountPath: /tmp/ais ports: - containerPort: ${PORT} protocol: TCP @@ -59,6 +59,8 @@ spec: export AIS_LOCAL_CONF_FILE=/etc/ais/ais_local.json && export STATSD_CONF_FILE="/etc/ais/statsd.conf" && export COLLECTD_CONF_FILE="/etc/ais/collectd.conf" && + export INSTANCE=${INSTANCE} && + export AIS_LOG_DIR=${AIS_LOG_DIR} && source /etc/ais/aisnode_config.sh && aisnode -config=/etc/ais/ais.json -local_config=/etc/ais/ais_local.json -role=target; volumes: @@ -66,11 +68,11 @@ spec: secret: secretName: aws-credentials optional: true - - name: ais-fs + - name: ais-persistent-fs hostPath: - path: /tmp/ais-k8s + path: /tmp/ais type: Directory - - name: ais-log + - name: ais-fs hostPath: - path: /tmp/${TARGET_POS_NUM} + path: /tmp/ais type: Directory diff --git a/deploy/dev/k8s/minimal.sh b/deploy/dev/k8s/minimal.sh index f4ab873c66..7d4a79cb7c 100755 --- a/deploy/dev/k8s/minimal.sh +++ b/deploy/dev/k8s/minimal.sh @@ -21,6 +21,10 @@ export TARGET_CNT=1 export POD_NAME="ais-proxy-0" export PORT=$PRIMARY_PORT export AIS_IS_PRIMARY=true +export INSTANCE=0 + +export AIS_LOG_DIR="/tmp/ais/${INSTANCE}/log" +(minikube ssh "sudo mkdir -p ${AIS_LOG_DIR}") ([[ $(kubectl get pods | grep -c "${POD_NAME}") -gt 0 ]] && kubectl delete pods ${POD_NAME}) || true envsubst < kube_templates/aisproxy_deployment.yml | kubectl apply -f - @@ -35,8 +39,10 @@ export PORT=9090 export PORT_INTRA_CONTROL=9080 export PORT_INTRA_DATA=10080 export TARGET_POS_NUM=1 +export INSTANCE=1 -(minikube ssh "sudo mkdir -p /tmp/${TARGET_POS_NUM}") +export AIS_LOG_DIR="/tmp/ais/${INSTANCE}/log" +(minikube ssh "sudo mkdir -p ${AIS_LOG_DIR}") # Delete and apply target deployment ([[ $(kubectl get pods | grep -c "${POD_NAME}") -gt 0 ]] && kubectl delete pods ${POD_NAME}) || true diff --git a/deploy/dev/k8s/utils/ais_minikube_setup.sh b/deploy/dev/k8s/utils/ais_minikube_setup.sh index 3b34356fa9..5e68ec49e4 100755 --- a/deploy/dev/k8s/utils/ais_minikube_setup.sh +++ b/deploy/dev/k8s/utils/ais_minikube_setup.sh @@ -15,7 +15,4 @@ minikube addons enable metrics-server (minikube ssh -- 'sudo mkdir -p /var/lib/minikube/ais') # Mount binding /tmp to a persistent path -(minikube ssh -- 'sudo mount --bind /var/lib/minikube/ais /tmp') - -# Create directory for ais-fs -(minikube ssh -- 'sudo mkdir -p /tmp/ais-k8s') +(minikube ssh -- 'sudo mount --bind /var/lib/minikube/ais /tmp') \ No newline at end of file diff --git a/deploy/dev/k8s/utils/deploy_ais.sh b/deploy/dev/k8s/utils/deploy_ais.sh index 46175101f0..1a2b5ed984 100755 --- a/deploy/dev/k8s/utils/deploy_ais.sh +++ b/deploy/dev/k8s/utils/deploy_ais.sh @@ -36,6 +36,7 @@ export AIS_PRIMARY_URL=$HOST_URL export HOSTNAME_LIST="$(minikube ip)" export AIS_BACKEND_PROVIDERS=${AIS_BACKEND_PROVIDERS} export TARGET_CNT=${TARGET_CNT} +INSTANCE=0 # Deploying kubernetes cluster echo "Starting kubernetes deployment..." @@ -49,8 +50,13 @@ for i in $(seq 0 $((PROXY_CNT-1))); do else export AIS_IS_PRIMARY=false fi + + export INSTANCE=${INSTANCE} + export AIS_LOG_DIR="/tmp/ais/${INSTANCE}/log" + (minikube ssh "sudo mkdir -p ${AIS_LOG_DIR}") ([[ $(kubectl get pods | grep -c "${POD_NAME}") -gt 0 ]] && kubectl delete pods ${POD_NAME}) || true envsubst < kube_templates/aisproxy_deployment.yml | kubectl apply -f - + INSTANCE=$((INSTANCE+1)) done echo "Waiting for the primary proxy to be ready..." @@ -64,11 +70,14 @@ for i in $(seq 0 $((TARGET_CNT-1))); do export PORT_INTRA_CONTROL=$((9080+i)) export PORT_INTRA_DATA=$((10080+i)) export TARGET_POS_NUM=$i - # Prepare directory for target's hostpath - (minikube ssh "sudo mkdir -p /tmp/${TARGET_POS_NUM}") + export INSTANCE=${INSTANCE} + export AIS_LOG_DIR="/tmp/ais/${INSTANCE}/log" + (minikube ssh "sudo mkdir -p ${AIS_LOG_DIR}") + ([[ $(kubectl get pods | grep -c "${POD_NAME}") -gt 0 ]] && kubectl delete pods ${POD_NAME}) || true envsubst < kube_templates/aistarget_deployment.yml | kubectl create -f - + INSTANCE=$((INSTANCE+1)) done echo "Waiting for the targets to be ready..."