Skip to content

Update revert-user-token script#180

Open
hippogr wants to merge 3 commits into
devfrom
ruigao/update-token-script
Open

Update revert-user-token script#180
hippogr wants to merge 3 commits into
devfrom
ruigao/update-token-script

Conversation

@hippogr
Copy link
Copy Markdown
Contributor

@hippogr hippogr commented May 18, 2026

Update revert-user-token script to use rest server API instead of cleaning K8S secrets directly so that the cache tokens can be also updated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the revokeUserTokens.py operator tool to revoke user tokens through the rest-server REST API (DELETE /api/v1/token) instead of directly deleting Kubernetes secrets in the pai-user-token namespace. This ensures the rest-server's in-memory token cache is also invalidated, fixing the issue where stale cached tokens could still be accepted after a manual secret cleanup. The alert-manager application token is still restored afterwards via the existing Kubernetes secret path.

Changes:

  • Added revoke_all_tokens_via_api() that calls the rest-server token DELETE endpoint with an admin bearer token.
  • Removed the delete_all_token_secrets() function that deleted secrets directly via the Kubernetes API.
  • Added interactive prompts for cluster name and admin bearer token, and simplified default-argument call sites for get_application_token / add_token_to_k8s_secret.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/revokeUserTokens.py Outdated
Comment thread tools/revokeUserTokens.py
Comment thread tools/revokeUserTokens.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants