Admin Token API: Add support for reading Cluster Agent Tokens
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you can request access to GitLab Duo.
What does this MR do and why?
This MR adds support for retrieving information about cluster agent tokens to the Admin Token API. It does not support revoking yet - this will be done in a separate MR to keep things small.
References
- Issue that implements the token information API for the first few token types.
MR acceptance checklist
MR Checklist ( @nwittstruck)
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the javascript style guides -
Conforms to the database guides
How to set up and validate locally
-
You'll need to create two new tokens:
- A
personal access token
withadmin_mode
andapi
capabilities at:Preferences > Access tokens > Add new token
- A
cluster agent token
that you can query:
- If you have configured the GDK with
gitlab_k8s_agent
enabled, you can create a new cluster token atAny Project > Kubernetes clusters > Connect a cluster
. You can now register a new agent. - You can also create a new token with
rails c
. This assumes there is at least project. This example uses the first project, feel free to choose any other project:
agent = Clusters::Agent.new(name: 'test-agent', project: Project.first) agent.save token = Clusters::AgentToken.new(name: 'test-agent-token', agent: agent) # this will print the token: token.ensure_token # don't forget to save the token to be able to retrieve it: token.save
- A
-
Now you can retrieve information about this token:
curl -k --request POST \
--url 'https://gdk.test:3443/api/v4/admin/token' \
--header 'Authorization: Bearer <Admin Token from Step 1.>' \
--header 'Content-Type: application/json' \
--data '{"token": "glagent-token-from-step-1-2"}'
Related to #443597 (closed)
Merge request reports
Activity
added pipelinetier-1 label
added Leading Organization label
- Resolved by Nicholas Wittstruck
Thanks for your contribution to GitLab @nwittstruck!
- If you need help, page a coach by clicking here or come say hi on Discord.
- When you're ready, request a review by clicking here.
- We welcome AI-generated contributions and offer complimentary access to GitLab Duo! Check out the top of the merge request description to learn more about using AI while contributing.
- To add labels to your merge request, comment
@gitlab-bot label ~"label1" ~"label2"
.
This message was generated automatically. Improve it or delete it.
added Community contribution workflowin dev labels
assigned to @nwittstruck
added backend documentation labels
mentioned in issue #443597 (closed)
- Resolved by James Nutt
2 Warnings 401f5a1f: The commit body should not contain more than 72 characters per line. For more information, take a look at our Commit message guidelines. This merge request does not refer to an existing milestone. 1 Message This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is recommended. Reviews can happen after you merge. Documentation review
The following files require a review from a technical writer:
-
doc/api/admin/token.md
(Link to current live version)
The review does not need to block merging this merge request. See the:
-
Metadata for the
*.md
files that you've changed. The first few lines of each*.md
file identify the stage and group most closely associated with your docs change. - The Technical Writer assigned for that stage and group.
- Documentation workflows for information on when to assign a merge request for review.
Reviewer roulette
Category Reviewer Maintainer backend @minahilnichols
(UTC-5)
@jarka
(UTC+5.5)
Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by Danger Bot -
added linked-issue label
mentioned in epic gitlab-org#15777
added workflowready for review label and removed workflowin dev label
requested review from @janis
Hi
@jglassman1
! Please review this documentation merge request. This message was generated automatically. Improve it or delete it.added twtriaged label
requested review from @jglassman1
@janis @jglassman1, this Community contribution is ready for review.
- Do you have capacity and domain expertise to review this? If not, find one or more reviewers and assign to them.
- If you've reviewed it, add the workflowin dev label if these changes need more work before the next review.
- Please ensure the group's Product Manager has validated the linked issue.
This message was generated automatically. Improve it or delete it.
- Resolved by Jon Glassman
- Resolved by Jon Glassman
1 Warning 401f5a1f: The commit body should not contain more than 72 characters per line. For more information, take a look at our Commit message guidelines. 1 Message This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is recommended. Reviews can happen after you merge. Documentation review
The following files require a review from a technical writer:
-
doc/api/admin/token.md
(Link to current live version)
The review does not need to block merging this merge request. See the:
-
Metadata for the
*.md
files that you've changed. The first few lines of each*.md
file identify the stage and group most closely associated with your docs change. - The Technical Writer assigned for that stage and group.
- Documentation workflows for information on when to assign a merge request for review.
Reviewer roulette
Category Reviewer Maintainer backend @missy-gitlab
(UTC-5)
@brytannia
(UTC+1)
Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Danger-
- Resolved by Nicholas Wittstruck
@nwittstruck happy to approve the documentation change. Please take this comment as approval, as I pushed a commit and am unable to select the
Approve
button.Edited by Jon Glassman
removed review request for @jglassman1
- Resolved by James Nutt
@nwittstruck can you please provide directions where to create those tokens as part of the instructions? The links you provided are specific to your own setup, I can update the port, but the second one seems to have some additional issues?
added 1282 commits
-
99cc8455...7187766d - 1281 commits from branch
gitlab-org:master
- 077d4858 - Admin Token API: Cluster Agent Tokens
-
99cc8455...7187766d - 1281 commits from branch
mentioned in issue gitlab-org/quality/triage-reports#20941 (closed)
requested review from @jnutt
added pipeline:mr-approved label
added pipelinetier-3 pipeline:run-e2e-omnibus-once labels and removed pipelinetier-1 label
added Category:System Access label
Before you set this MR to auto-merge
This merge request will progress on pipeline tiers until it reaches the last tier: pipelinetier-3.
Before you set this MR to auto-merge, please check the following:
- You are the last maintainer of this merge request
- The latest pipeline for this merge request is pipelinetier-3 (You can find which tier it is in the pipeline name)
- This pipeline is recent enough (created in the last 8 hours)
If all the criteria above apply, please set auto-merge for this merge request.
See pipeline tiers and merging a merge request for more details.
changed milestone to %17.7
E2E Test Result Summary
allure-report-publisher
generated test report!e2e-test-on-gdk:
test report for 401f5a1fexpand test summary
+------------------------------------------------------------------+ | suites summary | +-------------+--------+--------+---------+-------+-------+--------+ | | passed | failed | skipped | flaky | total | result | +-------------+--------+--------+---------+-------+-------+--------+ | Govern | 75 | 0 | 3 | 0 | 78 | ✅ | | Plan | 76 | 0 | 0 | 0 | 76 | ✅ | | Create | 129 | 0 | 22 | 0 | 151 | ✅ | | Verify | 43 | 0 | 2 | 0 | 45 | ✅ | | Data Stores | 33 | 0 | 1 | 0 | 34 | ✅ | | Manage | 1 | 0 | 1 | 0 | 2 | ✅ | | Release | 5 | 0 | 0 | 0 | 5 | ✅ | | Secure | 4 | 0 | 0 | 0 | 4 | ✅ | | Analytics | 2 | 0 | 0 | 0 | 2 | ✅ | | Monitor | 8 | 0 | 0 | 0 | 8 | ✅ | | Package | 24 | 0 | 11 | 0 | 35 | ✅ | | Ai-powered | 0 | 0 | 1 | 0 | 1 | ➖ | | Fulfillment | 2 | 0 | 0 | 0 | 2 | ✅ | +-------------+--------+--------+---------+-------+-------+--------+ | Total | 402 | 0 | 41 | 0 | 443 | ✅ | +-------------+--------+--------+---------+-------+-------+--------+
e2e-test-on-cng:
test report for 401f5a1fexpand test summary
+------------------------------------------------------------------+ | suites summary | +-------------+--------+--------+---------+-------+-------+--------+ | | passed | failed | skipped | flaky | total | result | +-------------+--------+--------+---------+-------+-------+--------+ | Plan | 86 | 0 | 8 | 0 | 94 | ✅ | | Create | 140 | 0 | 20 | 0 | 160 | ✅ | | Monitor | 8 | 0 | 12 | 0 | 20 | ✅ | | Govern | 84 | 0 | 9 | 1 | 93 | ✅ | | Manage | 1 | 0 | 9 | 0 | 10 | ✅ | | Package | 24 | 0 | 14 | 0 | 38 | ✅ | | Verify | 49 | 0 | 16 | 0 | 65 | ✅ | | Secure | 2 | 0 | 5 | 0 | 7 | ✅ | | Fulfillment | 2 | 0 | 7 | 1 | 9 | ✅ | | Data Stores | 33 | 0 | 10 | 0 | 43 | ✅ | | Analytics | 2 | 0 | 0 | 1 | 2 | ✅ | | Release | 5 | 0 | 1 | 0 | 6 | ✅ | | Configure | 0 | 0 | 3 | 0 | 3 | ➖ | | Ai-powered | 0 | 0 | 2 | 0 | 2 | ➖ | | ModelOps | 0 | 0 | 1 | 0 | 1 | ➖ | | Growth | 0 | 0 | 2 | 0 | 2 | ➖ | +-------------+--------+--------+---------+-------+-------+--------+ | Total | 436 | 0 | 119 | 3 | 555 | ✅ | +-------------+--------+--------+---------+-------+-------+--------+
started a merge train
mentioned in commit 08551959
@nwittstruck, how was your code review experience with this merge request? Please tell us how we can continue to iterate and improve:
- React with a
or a on this comment to describe your experience. - Create a new comment starting with
@gitlab-bot feedback
below, and leave any additional feedback you have for us in the comment.
As a benefit of being a GitLab Community Contributor, you can request access to GitLab Duo. With Code Suggestions, Chat and more AI-powered features, GitLab Duo helps to boost your efficiency and effectiveness by reducing the time required to write and understand code. Visit the Duo access project to request a GitLab Duo license and learn more about the benefits of GitLab Duo.
Subscribe to the GitLab Community Newsletter for contributor-focused content and opportunities to level up.
Thanks for your help!
This message was generated automatically. Improve it or delete it.
- React with a
added workflowstaging-canary label and removed workflowready for review label
added workflowcanary label and removed workflowstaging-canary label
added workflowstaging label and removed workflowcanary label
added workflowproduction label and removed workflowstaging label
added workflowpost-deploy-db-staging label and removed workflowproduction label
added workflowpost-deploy-db-production label and removed workflowpost-deploy-db-staging label
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label