diff options
Diffstat (limited to 'lib/api/internal/kubernetes.rb')
-rw-r--r-- | lib/api/internal/kubernetes.rb | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/lib/api/internal/kubernetes.rb b/lib/api/internal/kubernetes.rb index 5592207c4b5..8783a8dd57c 100644 --- a/lib/api/internal/kubernetes.rb +++ b/lib/api/internal/kubernetes.rb @@ -29,21 +29,13 @@ module API end def gitaly_info(project) - shard = repo_type.repository_for(project).shard - { - address: Gitlab::GitalyClient.address(shard), - token: Gitlab::GitalyClient.token(shard), - features: Feature::Gitaly.server_feature_flags - } + gitaly_features = Feature::Gitaly.server_feature_flags + + Gitlab::GitalyClient.connection_data(project.repository_storage).merge(features: gitaly_features) end def gitaly_repository(project) - { - storage_name: project.repository_storage, - relative_path: project.disk_path + '.git', - gl_repository: repo_type.identifier_for_container(project), - gl_project_path: repo_type.repository_for(project).full_path - } + project.repository.gitaly_repository.to_h end def check_feature_enabled @@ -61,7 +53,12 @@ module API end def increment_unique_events - events = params[:unique_counters]&.slice(:agent_users_using_ci_tunnel) + events = params[:unique_counters]&.slice( + :agent_users_using_ci_tunnel, + :k8s_api_proxy_requests_unique_users_via_ci_access, :k8s_api_proxy_requests_unique_agents_via_ci_access, + :k8s_api_proxy_requests_unique_users_via_user_access, :k8s_api_proxy_requests_unique_agents_via_user_access, + :flux_git_push_notified_unique_projects + ) events&.each do |event, entity_ids| increment_unique_values(event, entity_ids) @@ -69,7 +66,10 @@ module API end def increment_count_events - events = params[:counters]&.slice(:gitops_sync, :k8s_api_proxy_request, :flux_git_push_notifications_total) + events = params[:counters]&.slice( + :gitops_sync, :k8s_api_proxy_request, :flux_git_push_notifications_total, + :k8s_api_proxy_requests_via_ci_access, :k8s_api_proxy_requests_via_user_access + ) Gitlab::UsageDataCounters::KubernetesAgentCounter.increment_event_counts(events) end @@ -185,7 +185,7 @@ module API # Load agent agent = ::Clusters::Agent.find(params[:agent_id]) - unauthorized!('Feature disabled for agent') unless ::Gitlab::Kas::UserAccess.enabled_for?(agent) + unauthorized!('Feature disabled for agent') unless ::Gitlab::Kas::UserAccess.enabled? service_response = ::Clusters::Agents::AuthorizeProxyUserService.new(user, agent).execute render_api_error!(service_response[:message], service_response[:reason]) unless service_response.success? @@ -203,10 +203,17 @@ module API 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' + optional :k8s_api_proxy_requests_via_ci_access, type: Integer, desc: 'The count to increment the k8s_api_proxy_requests_via_ci_access metric by' + optional :k8s_api_proxy_requests_via_user_access, type: Integer, desc: 'The count to increment the k8s_api_proxy_requests_via_user_access metric by' end optional :unique_counters, type: Hash do optional :agent_users_using_ci_tunnel, type: Array[Integer], desc: 'An array of user ids that have interacted with CI Tunnel' + optional :k8s_api_proxy_requests_unique_users_via_ci_access, type: Array[Integer], desc: 'An array of users that have interacted with the CI tunnel via `ci_access`' + optional :k8s_api_proxy_requests_unique_agents_via_ci_access, type: Array[Integer], desc: 'An array of agents that have interacted with the CI tunnel via `ci_access`' + optional :k8s_api_proxy_requests_unique_users_via_user_access, type: Array[Integer], desc: 'An array of users that have interacted with the CI tunnel via `user_access`' + optional :k8s_api_proxy_requests_unique_agents_via_user_access, type: Array[Integer], desc: 'An array of agents that have interacted with the CI tunnel via `user_access`' + optional :flux_git_push_notified_unique_projects, type: Array[Integer], desc: 'An array of projects that have been notified to reconcile their Flux workloads' end end post '/', feature_category: :deployment_management do |