Skip to content

Commit 09084e5

Browse files
authored
fix: add istio job exit and url encode (#183)
1 parent 424ab2c commit 09084e5

File tree

5 files changed

+44
-12
lines changed

5 files changed

+44
-12
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.2-dev
1+
2.2.2

deployment/charts/cluster-manager/Chart.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ type: application
1616
# This is the chart version. This version number should be incremented each time you make changes
1717
# to the chart and its templates, including the app version.
1818
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19-
version: 2.2.2-dev
20-
appVersion: 2.2.2-dev
19+
version: 2.2.2
20+
appVersion: 2.2.2
2121
annotations:
22-
revision: 0cd3c01663a670be5a52130d1a85d83cb1ec2241
23-
created: "2025-10-17T20:42:42Z"
22+
revision: 078544072892ea57ccedc87830ef319e2308ae60
23+
created: "2025-10-20T18:20:56Z"

deployment/charts/cluster-manager/templates/configmap-m2m-credentials.yaml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,33 @@ data:
3333
cleanup_sensitive_vars() {
3434
unset root_token VAULT_TOKEN ADMIN_PASS KC_ADMIN_TOKEN CLIENT_SECRET SA_TOKEN 2>/dev/null || true
3535
}
36-
trap cleanup_sensitive_vars EXIT
36+
37+
wait_for_istio_sidecar() {
38+
local max_wait=60
39+
local wait_time=0
40+
log "Waiting for Istio sidecar to be ready..."
41+
while [ $wait_time -lt $max_wait ]; do
42+
if curl -s -f http://127.0.0.1:15021/healthz/ready >/dev/null 2>&1; then
43+
log "Istio sidecar is ready"
44+
return 0
45+
fi
46+
log "Waiting for Istio sidecar... ($wait_time/$max_wait seconds)"
47+
sleep 2
48+
wait_time=$((wait_time + 2))
49+
done
50+
log "WARNING: Istio sidecar not ready after ${max_wait}s, continuing anyway"
51+
return 1
52+
}
53+
54+
# Istio sidecar shutdown function
55+
shutdown_istio_sidecar() {
56+
if curl -s -f http://127.0.0.1:15020/healthz/ready >/dev/null 2>&1; then
57+
log "Shutting down Istio sidecar..."
58+
curl -s -X POST http://127.0.0.1:15000/quitquitquit >/dev/null 2>&1 || true
59+
fi
60+
}
61+
62+
trap 'cleanup_sensitive_vars; shutdown_istio_sidecar' EXIT
3763
3864
log() {
3965
echo "[$(date -Iseconds)] $*" >&2
@@ -205,10 +231,13 @@ data:
205231
fi
206232
207233
local token_response=$(retry_with_backoff "getting keycloak admin token" sh -c "
208-
echo 'grant_type=password&client_id=admin-cli&username=$admin_user&password=$ADMIN_PASS' | curl -s -f \
234+
curl -s -f \
209235
--request POST \
210236
--header 'Content-Type: application/x-www-form-urlencoded' \
211-
--data @- \
237+
--data-urlencode 'grant_type=password' \
238+
--data-urlencode 'client_id=admin-cli' \
239+
--data-urlencode 'username=$admin_user' \
240+
--data-urlencode 'password=$ADMIN_PASS' \
212241
'$KEYCLOAK_URL/realms/master/protocol/openid-connect/token'
213242
")
214243
@@ -309,6 +338,8 @@ data:
309338
}
310339
311340
main() {
341+
wait_for_istio_sidecar
342+
312343
if ! ensure_vault_role_and_policy; then
313344
log "WARNING: failed to ensure vault role/policy, continuing anyway"
314345
fi

deployment/charts/cluster-manager/templates/job-m2m-credentials.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ spec:
2121
app.kubernetes.io/component: credentials-m2m
2222
spec:
2323
serviceAccountName: {{ include "cluster-manager.serviceAccountName" . }}
24+
terminationGracePeriodSeconds: {{ .Values.credentialsM2M.job.terminationGracePeriodSeconds | default 30 }}
2425
restartPolicy: Never
2526
securityContext:
2627
runAsNonRoot: true

deployment/charts/cluster-template-crd/Chart.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ apiVersion: v2
66
name: cluster-template-crd
77
description: A Helm chart for the ClusterTemplate CRD
88
type: application
9-
version: 2.2.2-dev
10-
appVersion: 2.2.2-dev
9+
version: 2.2.2
10+
appVersion: 2.2.2
1111
annotations:
12-
revision: 0cd3c01663a670be5a52130d1a85d83cb1ec2241
13-
created: "2025-10-17T20:42:42Z"
12+
revision: 078544072892ea57ccedc87830ef319e2308ae60
13+
created: "2025-10-20T18:20:56Z"

0 commit comments

Comments
 (0)