Skip to content

Commit

Permalink
Adds definition of helmops metrics port (#3189)
Browse files Browse the repository at this point in the history
This is added to be able to define the port used when setting up the metrics service for helmops
Helps also to be able to run e2e tests in conjunction with an external ip (and to run e2e test on Mac OS)

Signed-off-by: Xavi Garcia <[email protected]>
  • Loading branch information
0xavi0 authored Jan 21, 2025
1 parent cf013e5 commit 1fa0160
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dev/setup-k3d
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ unique_api_port=${unique_api_port-36443}
unique_tls_port=${unique_tls_port-443}
METRICS_GITJOB_PORT=${METRICS_GITJOB_PORT-}
METRICS_CONTROLLER_PORT=${METRICS_CONTROLLER_PORT-}
METRICS_HELMOPS_PORT=${METRICS_HELMOPS_PORT-}

name=${1-upstream}
offs=${2-0}
Expand All @@ -25,6 +26,10 @@ if [ -n "$METRICS_GITJOB_PORT" ]; then
args="$args -p "${METRICS_GITJOB_PORT}:${METRICS_GITJOB_PORT}@server:0""
fi

if [ -n "$METRICS_HELMOPS_PORT" ]; then
args="$args -p "${METRICS_HELMOPS_PORT}:${METRICS_HELMOPS_PORT}@server:0""
fi

if [ -n "$docker_mirror" ]; then
TMP_CONFIG="$(mktemp)"
trap "rm -f $TMP_CONFIG" EXIT
Expand Down
6 changes: 6 additions & 0 deletions e2e/metrics/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ func getMetricsPort(app string) int64 {
Expect(err).ToNot(HaveOccurred())
return i
}
case "helmops":
if port := os.Getenv("METRICS_HELMOPS_PORT"); port != "" {
i, err := strconv.ParseInt(port, 10, 64)
Expect(err).ToNot(HaveOccurred())
return i
}
}
rs := rand.NewSource(time.Now().UnixNano())
return rs.Int63()%1000 + 30000
Expand Down

0 comments on commit 1fa0160

Please sign in to comment.