Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port_forwarding: Forward prometheus port for each replica #17

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions local-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function upgrade() {
kubectl wait sts/weaviate -n weaviate --for jsonpath='{.status.readyReplicas}'=${REPLICAS} --timeout=${TIMEOUT}
echo_green "upgrade # Waiting for rollout upgrade to be over"
kubectl -n weaviate rollout status statefulset weaviate
port_forward_to_weaviate
port_forward_to_weaviate $REPLICAS
wait_weaviate
wait_for_other_services

Expand Down Expand Up @@ -180,7 +180,7 @@ EOF
TIMEOUT=$(get_timeout)
echo_green "setup # Waiting (with timeout=$TIMEOUT) for Weaviate $REPLICAS node cluster to be ready"
kubectl wait sts/weaviate -n weaviate --for jsonpath='{.status.readyReplicas}'=${REPLICAS} --timeout=${TIMEOUT}
port_forward_to_weaviate
port_forward_to_weaviate $REPLICAS
wait_weaviate
wait_for_other_services

Expand Down
6 changes: 6 additions & 0 deletions utilities/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function wait_for_raft_sync() {
}

function port_forward_to_weaviate() {
replicas=$1
echo_green "Port-forwarding to Weaviate cluster"
# Install kube-relay tool to perform port-forwarding
# Check if kubectl-relay binary is available
Expand Down Expand Up @@ -197,6 +198,11 @@ function port_forward_to_weaviate() {

/tmp/kubectl-relay sts/weaviate -n weaviate ${WEAVIATE_METRICS}:2112 &> /tmp/weaviate_metrics_frwd.log &

# Loop over replicas and port-forward to each node to port ${WEAVIATE_METRICS} + i
for i in $(seq 0 $((replicas-1))); do
/tmp/kubectl-relay pod/weaviate-$i -n weaviate $((WEAVIATE_METRICS+1+i)):2112 &> /tmp/weaviate_metrics_frwd_${i}.log &
done

if [[ $OBSERVABILITY == "true" ]]; then
/tmp/kubectl-relay svc/prometheus-grafana -n monitoring ${GRAFANA_PORT}:80 &> /tmp/grafana_frwd.log &

Expand Down
Loading