diff options
Diffstat (limited to 'app/controllers/clusters/clusters_controller.rb')
-rw-r--r-- | app/controllers/clusters/clusters_controller.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/controllers/clusters/clusters_controller.rb b/app/controllers/clusters/clusters_controller.rb index 46dec5f3287..2e8b3d764ca 100644 --- a/app/controllers/clusters/clusters_controller.rb +++ b/app/controllers/clusters/clusters_controller.rb @@ -2,6 +2,8 @@ class Clusters::ClustersController < Clusters::BaseController include RoutableActions + include Metrics::Dashboard::PrometheusApiProxy + include MetricsDashboard before_action :cluster, only: [:cluster_status, :show, :update, :destroy, :clear_cache] before_action :generate_gcp_authorize_url, only: [:new] @@ -290,6 +292,29 @@ class Clusters::ClustersController < Clusters::BaseController @gcp_cluster = cluster.present(current_user: current_user) end + def proxyable + cluster.cluster + end + + # During first iteration of dashboard variables implementation + # cluster health case was omitted. Existing service for now is tied to + # environment, which is not always present for cluster health dashboard. + # It is planned to break coupling to environment https://gitlab.com/gitlab-org/gitlab/-/issues/213833. + # It is also planned to move cluster health to metrics dashboard section https://gitlab.com/gitlab-org/gitlab/-/issues/220214 + # but for now I've used dummy class to stub variable substitution service, as there are no variables + # in cluster health dashboard + def proxy_variable_substitution_service + @empty_service ||= Class.new(BaseService) do + def initialize(proxyable, params) + @proxyable, @params = proxyable, params + end + + def execute + success(params: @params) + end + end + end + def user_cluster cluster = Clusters::BuildService.new(clusterable.subject).execute cluster.build_platform_kubernetes |