Skip to content

Commit 2b31903

Browse files
committed
Changed priority on load balancer
1 parent f41f728 commit 2b31903

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/deploy-pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ jobs:
130130
# Remove existing route rules for the PR service
131131
yq -i '.pathMatchers[] |= (.routeRules |= map(select((.routeAction.weightedBackendServices // []) | length == 0 or .routeAction.weightedBackendServices[0].backendService != env(PR_SERVICE))))' config.yml
132132
# Add new route rules for the PR service
133-
export MAX_PRIORITY=$(yq '[.pathMatchers[] | select(.name == "all-paths") | .routeRules[]?.priority] | max // 0' config.yml)
134-
export NEXT_PRIORITY=$((MAX_PRIORITY + 1))
133+
export MIN_PRIORITY=$(yq '[.pathMatchers[] | select(.name == "all-paths") | .routeRules[]?.priority] | min // 0' config.yml)
134+
export NEXT_PRIORITY=$((MIN_PRIORITY - 1))
135135
LABELS_JSON=$(echo "$LABELS" | jq -c '[.[] | select(.name | test("\\.ghost\\.is$")) | .name]')
136136
for LABEL in $(echo "$LABELS_JSON" | jq -r '.[]'); do
137137
echo "Adding route for label: $LABEL"
138-
yq -i '.pathMatchers[0].routeRules += [{"priority": '$NEXT_PRIORITY', "matchRules": [{"prefixMatch": "/", "headerMatches": [{ "headerName": "X-Forwarded-Host", "exactMatch": "'$LABEL'" }]}], "routeAction": {"weightedBackendServices": [ { "backendService": "'$PR_SERVICE'", "weight": 100 } ] }, "headerAction": { "requestHeadersToAdd": [ { "headerName": "X-ActivityPub-PR", "headerValue": "${{ github.event.pull_request.number }}" }, { "headerName": "X-ActivityPub-Commit", "headerValue": "${{ github.event.pull_request.head.sha }}" } ] } }]' config.yml
138+
yq -i '.pathMatchers[0].routeRules = [{"priority": env(NEXT_PRIORITY), "matchRules": [{"prefixMatch": "/", "headerMatches": [{"headerName": "X-Forwarded-Host", "exactMatch": env(LABEL)}]}], "routeAction": {"weightedBackendServices": [{"backendService": env(PR_SERVICE), "weight": 100}]}, "headerAction": {"requestHeadersToAdd": [{"headerName": "X-ActivityPub-PR", "headerValue": "${{ github.event.pull_request.number }}"}, {"headerName": "X-ActivityPub-Commit", "headerValue": "${{ github.event.pull_request.head.sha }}"}]}}] + .pathMatchers[0].routeRules' config.yml
139139
export NEXT_PRIORITY=$((NEXT_PRIORITY + 1))
140140
done
141141
echo "Updating url map with:"

0 commit comments

Comments
 (0)