diff options
Diffstat (limited to 'lib/api/internal/kubernetes.rb')
-rw-r--r-- | lib/api/internal/kubernetes.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/api/internal/kubernetes.rb b/lib/api/internal/kubernetes.rb index d340e097700..5592207c4b5 100644 --- a/lib/api/internal/kubernetes.rb +++ b/lib/api/internal/kubernetes.rb @@ -69,7 +69,7 @@ module API end def increment_count_events - events = params[:counters]&.slice(:gitops_sync, :k8s_api_proxy_request) + events = params[:counters]&.slice(:gitops_sync, :k8s_api_proxy_request, :flux_git_push_notifications_total) Gitlab::UsageDataCounters::KubernetesAgentCounter.increment_event_counts(events) end @@ -121,6 +121,18 @@ module API default_branch: project.default_branch_or_main } end + + desc 'Verify agent access to a project' do + detail 'Verifies if the agent (owning the token) is authorized to access the given project' + end + route_setting :authentication, cluster_agent_token_allowed: true + get '/verify_project_access', feature_category: :deployment_management, urgency: :low do + project = find_project(params[:id]) + + not_found! unless agent_has_access_to_project?(project) + + status 204 + end end namespace 'kubernetes/agent_configuration' do @@ -190,6 +202,7 @@ module API optional :counters, type: Hash do optional :gitops_sync, type: Integer, desc: 'The count to increment the gitops_sync metric by' optional :k8s_api_proxy_request, type: Integer, desc: 'The count to increment the k8s_api_proxy_request metric by' + optional :flux_git_push_notifications_total, type: Integer, desc: 'The count to increment the flux_git_push_notifications_total metrics by' end optional :unique_counters, type: Hash do |