Skip to content

Commit

Permalink
improved run-local port-forward management (#239)
Browse files Browse the repository at this point in the history
Co-authored-by: Herve Nicol <[email protected]>
  • Loading branch information
hervenicol and hervenicol authored Feb 3, 2025
1 parent 2931aab commit b2342db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- improved run-local port-forward management

### Removed

- Remove turtle related Alertmanager configuration
Expand Down
14 changes: 11 additions & 3 deletions hack/bin/run-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,32 @@ function setEnvFromSecrets {

# Port-forward the Grafana service
function grafanaPortForward {
kubectl port-forward -n "$NAMESPACE" svc/grafana 3000:80 &>/dev/null &
while true; do
kubectl port-forward -n "$NAMESPACE" svc/grafana 3000:80 &>/dev/null || true
done &
GRAFANAPORTFORWARDPID="$!"
}

# Stop the Grafana service port-forward
function stopGrafanaPortForward {
childpids=$(ps -o pid= --ppid "$GRAFANAPORTFORWARDPID")
kill "$GRAFANAPORTFORWARDPID" || true
kill $childpids || true
}

# Port-forward the mimir service
function mimirPortForward {
kubectl port-forward -n mimir svc/mimir-gateway 8180:80 &>/dev/null &
while true; do
kubectl port-forward -n mimir svc/mimir-gateway 8180:80 &>/dev/null || true
done &
MIMIRPORTFORWARDPID="$!"
}

# Stop the Grafana service port-forward
function stopMimirPortForward {
childpids=$(ps -o pid= --ppid "$MIMIRPORTFORWARDPID")
kill "$MIMIRPORTFORWARDPID" || true
kill $childpids || true
}

# Pause the in-cluster operator
Expand Down Expand Up @@ -90,7 +98,7 @@ function main {
pauseInClusterOperator

echo "### Running operator"
go run . "${OLLYOPARGS[@]}" -grafana-url http://localhost:3000 -monitoring-metrics-query-url http://localhost:8180
go run . "${OLLYOPARGS[@]}" -grafana-url http://localhost:3000 -monitoring-metrics-query-url http://localhost:8180/prometheus

echo "### Cleanup"
}
Expand Down

0 comments on commit b2342db

Please sign in to comment.