Commit 188dece9 authored by Thong Kuah's avatar Thong Kuah

Show cluster agents UI only when enabled on GitLab.com

No change for self-managed
parent a853e5ad
---
name: cluster_agent_list
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42115
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/249596
milestone: '13.5'
type: development
group: group::configure
default_enabled: true
...@@ -6,9 +6,13 @@ module EE ...@@ -6,9 +6,13 @@ module EE
override :display_cluster_agents? override :display_cluster_agents?
def display_cluster_agents?(clusterable) def display_cluster_agents?(clusterable)
return unless ::Feature.enabled?(:cluster_agent_list, default_enabled: true) clusterable.is_a?(Project) && clusterable.feature_available?(:cluster_agents) && included_in_gitlab_com_rollout?(clusterable)
end
private
clusterable.is_a?(Project) && clusterable.feature_available?(:cluster_agents) def included_in_gitlab_com_rollout?(project)
::Gitlab::Kas.included_in_gitlab_com_rollout?(project)
end end
end end
end end
---
title: Hide cluster agent UI if not enabled on GitLab.com
merge_request: 57668
author:
type: changed
...@@ -16,6 +16,8 @@ RSpec.describe ClustersHelper do ...@@ -16,6 +16,8 @@ RSpec.describe ClustersHelper do
context 'with premium license' do context 'with premium license' do
before do before do
allow(Gitlab).to receive(:com?).and_return(false)
stub_licensed_features(cluster_agents: true) stub_licensed_features(cluster_agents: true)
end end
...@@ -33,13 +35,29 @@ RSpec.describe ClustersHelper do ...@@ -33,13 +35,29 @@ RSpec.describe ClustersHelper do
end end
end end
context 'when cluster_agent_list feature flag is disabled' do context 'GitLab.com' do
before do before do
stub_feature_flags(cluster_agent_list: false) allow(Gitlab).to receive(:com?).and_return(true)
end end
it 'does not allows agents to display' do context 'when kubernetes_agent_on_gitlab_com feature flag is disabled' do
expect(subject).to be_falsey before do
stub_feature_flags(kubernetes_agent_on_gitlab_com: false)
end
it 'does not allows agents to display' do
expect(subject).to be_falsey
end
end
context 'kubernetes_agent_on_gitlab_com feature flag enabled' do
before do
stub_feature_flags(kubernetes_agent_on_gitlab_com: clusterable)
end
it 'allows agents to display' do
expect(subject).to be_truthy
end
end end
end end
end end
......
...@@ -27,7 +27,7 @@ module Gitlab ...@@ -27,7 +27,7 @@ module Gitlab
def included_in_gitlab_com_rollout?(project) def included_in_gitlab_com_rollout?(project)
return true unless ::Gitlab.com? return true unless ::Gitlab.com?
Feature.enabled?(:kubernetes_agent_on_gitlab_com, project) Feature.enabled?(:kubernetes_agent_on_gitlab_com, project, default_enabled: :yaml)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment