Skip to content

Commit

Permalink
updating fspath config for minikube ais deployments
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishek Gaikwad <[email protected]>
  • Loading branch information
gaikwadabhishek committed Aug 30, 2023
1 parent 227313c commit 4cdcb4f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
2 changes: 2 additions & 0 deletions deploy/dev/k8s/kube_templates/aisproxy_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 9 additions & 7 deletions deploy/dev/k8s/kube_templates/aistarget_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -59,18 +59,20 @@ 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:
- name: aws-credentials
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
8 changes: 7 additions & 1 deletion deploy/dev/k8s/minimal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions deploy/dev/k8s/utils/ais_minikube_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
13 changes: 11 additions & 2 deletions deploy/dev/k8s/utils/deploy_ais.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand All @@ -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..."
Expand All @@ -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..."
Expand Down

0 comments on commit 4cdcb4f

Please sign in to comment.