Give ticketing admins the admin role
After the route cutover, admins log in to the new admin (spatio) but see not org admin. This page
fixes that: make AuthAPI reach CoreAPI, sync every user into CoreAPI, then promote the admins to ORG_ADMIN.
Before you start¶
- Shell access to
ticket-node-1. Runkubectlandpsqlthere. - Never print secrets. The internal token (
COREAPI_AUTHAPI_PSK) stays inside the pod: the commands below read it there.
Why admins see "not org admin"¶
- Login only creates the user in AuthAPI. CoreAPI gets a user only from admin-create, an invite or the reconcile
job, and always as
ORG_MEMBER. - At login, AuthAPI asks CoreAPI for the user's role. If that call fails, AuthAPI logs
could not fetch CoreAPI roles ... defaulting to member. On the ticketing cluster the cause was a wrong address:COREAPI_BASE_URLpointed atcoreapiinstead ofcoreapi-service. - The role is stored in the token at login, so a role change shows only after the person logs out and in again.
1. Fix the AuthAPI to CoreAPI address¶
The fix is in ticket-iac commit 2553762: overlays/prod/authapi-stg/secret.yml sets
- Check that Argo CD synced it:
kubectl get application -n argocdshows the appSynced. -
Restart AuthAPI so it reads the value (logins in progress may fail for a few seconds):
-
Check the value in the pod:
Expected:
http://coreapi-service.production.svc.cluster.local:3000.
2. Sync users with reconcile¶
Reconcile makes Zitadel the source of truth for who exists. For each Zitadel user it makes sure an AuthAPI row and a
CoreAPI ORG_MEMBER row exist. It never sets a role above ORG_MEMBER, never deletes anything, and is safe to run
again. It also registers any Zitadel organization AuthAPI doesn't know, so read the dry run first.
-
Dry run (changes nothing):
kubectl exec -n production deploy/authapi-stg -- sh -c \ 'wget -qO- --header="X-Internal-Token: $COREAPI_AUTHAPI_PSK" --post-data="" \ "http://127.0.0.1:3002/api/v1/internal/platform/reconcile?dry_run=true"'Use
127.0.0.1, notlocalhost: inside the podlocalhostresolves to IPv6 and the connection is refused. Expected: one organization, no new organizations,failure_count: 0. Stop if it wants to create organizations. 2. Real run: the same command without?dry_run=true.Expected:
createdorsyncedfor each user. 3. If CoreAPI showsfailedfor users, the address fix (step 1) isn't live yet.
3. Promote the admins¶
The old admin table is johorzoo.admin in the coreapi database. Its zitadel_id column matches zitadel_user_id
in AuthAPI. Don't SELECT * from it: it holds password hashes.
-
List the users and their roles:
PRIMARY=$(kubectl get pod -n db -l cnpg.io/cluster=postgres-cluster,cnpg.io/instanceRole=primary -o name) kubectl exec -n db $PRIMARY -c postgres -- psql -U postgres -d authapi \ -c "SELECT id, email, zitadel_user_id FROM users ORDER BY created_at;" kubectl exec -n db $PRIMARY -c postgres -- psql -U postgres -d coreapi \ -c "SELECT u.id, u.email, m.role FROM users u LEFT JOIN organization_members m ON m.user_id = u.id::text ORDER BY m.role;"organization_members.user_idis text andusers.idis a UUID, so the castu.id::textis needed. 2. Promote them in one transaction:kubectl exec -i -n db $PRIMARY -c postgres -- psql -U postgres -d coreapi -v ON_ERROR_STOP=1 <<'SQL' BEGIN; UPDATE organization_members SET role = 'ORG_ADMIN', role_id = 'ORG_ADMIN' WHERE organization_id = '00000000-0000-0000-0000-000000000001' AND user_id IN ('<USER_ID_1>', '<USER_ID_2>'); SELECT u.email, m.role FROM users u JOIN organization_members m ON m.user_id = u.id::text ORDER BY m.role, u.email; COMMIT; SQL<USER_ID_n>are the CoreAPIusers.idvalues from step 1. Expected:UPDATE <n>, then the list shows those users asORG_ADMIN. 3. Ask each promoted person to log out and log in again.
To undo a promotion, run the same transaction with SET role = 'ORG_MEMBER', role_id = 'ORG_MEMBER' for those
users.
Mapping used on 2026-11-24:
| Old role | New role |
|---|---|
SYSADMIN |
ORG_ADMIN |
ADMIN (test, johndoe) |
stays ORG_MEMBER |
don123 (no Zitadel account) |
skipped |
psql meta-commands (\c, \d) start with a backslash and must be on their own line.
If someone still sees "not org admin"¶
A match means AuthAPI still can't reach CoreAPI: go back to step 1. No match means the person hasn't logged in again since the promotion.
Until the new admin has a Members screen, roles are changed only with the SQL above (Go-live checks).