Add internal Kubernetes Agent API
Creates an experimental, internal Kubernetes Agent API. Part of &3329
Feature flag: kubernetes_agent_internal_api
Also creates the necessary tables and models to support the API
-
create agents table -
create agent_tokens table -
Use agent token to authenticate to this new API ( Authorization: Bearer TOKEN
) -
If token is invalid, respond with 403 Forbidden - [-] If token is has been revoked, respond with 403 Forbidden. Will follow-up in new issue
In response we also need:
-
agent_id
-
agent_name
-
project_id
(can be added later, not urgent) - [-]
cluster_id
(can be added later, not urgent) Will follow-up in new issue
Related issue: gitlab-org/cluster-integration/gitlab-agent#1 (moved)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
Notes for anyone who wants to try the branch:
-
gdk update
and switch to the branch -
run
bundle exec rails db:migrate RAILS_ENV=development
-
In Rails console (
bundle exec rails console
):Feature.enable(:kubernetes_agent_internal_api) p = Project.find(<id>) agent = Clusters::Agent.create!(project: p, name: "my-agent") token = Clusters::AgentToken.create!(agent: agent) puts token.token # this is the token for the agent
Edited by Mayra Cabrera