Commit 3f759e16 authored by Thong Kuah's avatar Thong Kuah

Remove group_clusters feature flag

Now we have terminals for instance and group clusters we can remove the
FF now. Deploying to group clusters has been working without complaints
too.
parent 47089be0
...@@ -4,7 +4,6 @@ class Groups::ClustersController < Clusters::ClustersController ...@@ -4,7 +4,6 @@ class Groups::ClustersController < Clusters::ClustersController
include ControllerWithCrossProjectAccessCheck include ControllerWithCrossProjectAccessCheck
prepend_before_action :group prepend_before_action :group
prepend_before_action :check_group_clusters_feature_flag!
requires_cross_project_access requires_cross_project_access
layout 'group' layout 'group'
...@@ -18,12 +17,4 @@ class Groups::ClustersController < Clusters::ClustersController ...@@ -18,12 +17,4 @@ class Groups::ClustersController < Clusters::ClustersController
def group def group
@group ||= find_routable!(Group, params[:group_id] || params[:id]) @group ||= find_routable!(Group, params[:group_id] || params[:id])
end end
def check_group_clusters_feature_flag!
render_404 unless group_clusters_enabled?
end
def group_clusters_enabled?
group.group_clusters_enabled?
end
end end
...@@ -142,7 +142,7 @@ module GroupsHelper ...@@ -142,7 +142,7 @@ module GroupsHelper
can?(current_user, "read_group_#{resource}".to_sym, @group) can?(current_user, "read_group_#{resource}".to_sym, @group)
end end
if can?(current_user, :read_cluster, @group) && @group.group_clusters_enabled? if can?(current_user, :read_cluster, @group)
links << :kubernetes links << :kubernetes
end end
......
...@@ -13,7 +13,7 @@ module DeploymentPlatform ...@@ -13,7 +13,7 @@ module DeploymentPlatform
def find_deployment_platform(environment) def find_deployment_platform(environment)
find_cluster_platform_kubernetes(environment: environment) || find_cluster_platform_kubernetes(environment: environment) ||
find_group_cluster_platform_kubernetes_with_feature_guard(environment: environment) || find_group_cluster_platform_kubernetes(environment: environment) ||
find_instance_cluster_platform_kubernetes_with_feature_guard(environment: environment) find_instance_cluster_platform_kubernetes_with_feature_guard(environment: environment)
end end
...@@ -23,12 +23,6 @@ module DeploymentPlatform ...@@ -23,12 +23,6 @@ module DeploymentPlatform
.last&.platform_kubernetes .last&.platform_kubernetes
end end
def find_group_cluster_platform_kubernetes_with_feature_guard(environment: nil)
return unless group_clusters_enabled?
find_group_cluster_platform_kubernetes(environment: environment)
end
# EE would override this and utilize environment argument # EE would override this and utilize environment argument
def find_group_cluster_platform_kubernetes(environment: nil) def find_group_cluster_platform_kubernetes(environment: nil)
Clusters::Cluster.enabled.default_environment.ancestor_clusters_for_clusterable(self) Clusters::Cluster.enabled.default_environment.ancestor_clusters_for_clusterable(self)
......
...@@ -410,10 +410,6 @@ class Group < Namespace ...@@ -410,10 +410,6 @@ class Group < Namespace
ensure_runners_token! ensure_runners_token!
end end
def group_clusters_enabled?
Feature.enabled?(:group_clusters, root_ancestor, default_enabled: true)
end
def project_creation_level def project_creation_level
super || ::Gitlab::CurrentSettings.default_project_creation super || ::Gitlab::CurrentSettings.default_project_creation
end end
......
...@@ -306,7 +306,6 @@ class Project < ApplicationRecord ...@@ -306,7 +306,6 @@ class Project < ApplicationRecord
delegate :add_guest, :add_reporter, :add_developer, :add_maintainer, :add_role, to: :team delegate :add_guest, :add_reporter, :add_developer, :add_maintainer, :add_role, to: :team
delegate :add_master, to: :team # @deprecated delegate :add_master, to: :team # @deprecated
delegate :group_runners_enabled, :group_runners_enabled=, :group_runners_enabled?, to: :ci_cd_settings delegate :group_runners_enabled, :group_runners_enabled=, :group_runners_enabled?, to: :ci_cd_settings
delegate :group_clusters_enabled?, to: :group, allow_nil: true
delegate :root_ancestor, to: :namespace, allow_nil: true delegate :root_ancestor, to: :namespace, allow_nil: true
delegate :last_pipeline, to: :commit, allow_nil: true delegate :last_pipeline, to: :commit, allow_nil: true
delegate :external_dashboard_url, to: :metrics_setting, allow_nil: true, prefix: true delegate :external_dashboard_url, to: :metrics_setting, allow_nil: true, prefix: true
......
...@@ -20,70 +20,52 @@ describe Groups::ClustersController do ...@@ -20,70 +20,52 @@ describe Groups::ClustersController do
get :index, params: params.reverse_merge(group_id: group) get :index, params: params.reverse_merge(group_id: group)
end end
context 'when feature flag is not enabled' do describe 'functionality' do
before do context 'when group has one or more clusters' do
stub_feature_flags(group_clusters: false) let(:group) { create(:group) }
end
it 'renders 404' do let!(:enabled_cluster) do
go create(:cluster, :provided_by_gcp, cluster_type: :group_type, groups: [group])
end
expect(response).to have_gitlab_http_status(404) let!(:disabled_cluster) do
end create(:cluster, :disabled, :provided_by_gcp, :production_environment, cluster_type: :group_type, groups: [group])
end end
context 'when feature flag is enabled' do it 'lists available clusters' do
before do go
stub_feature_flags(group_clusters: true)
end
describe 'functionality' do expect(response).to have_gitlab_http_status(:ok)
context 'when group has one or more clusters' do expect(response).to render_template(:index)
let(:group) { create(:group) } expect(assigns(:clusters)).to match_array([enabled_cluster, disabled_cluster])
end
let!(:enabled_cluster) do context 'when page is specified' do
create(:cluster, :provided_by_gcp, cluster_type: :group_type, groups: [group]) let(:last_page) { group.clusters.page.total_pages }
end
let!(:disabled_cluster) do before do
create(:cluster, :disabled, :provided_by_gcp, :production_environment, cluster_type: :group_type, groups: [group]) allow(Clusters::Cluster).to receive(:paginates_per).and_return(1)
create_list(:cluster, 2, :provided_by_gcp, :production_environment, cluster_type: :group_type, groups: [group])
end end
it 'lists available clusters' do it 'redirects to the page' do
go go(page: last_page)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index) expect(assigns(:clusters).current_page).to eq(last_page)
expect(assigns(:clusters)).to match_array([enabled_cluster, disabled_cluster])
end
context 'when page is specified' do
let(:last_page) { group.clusters.page.total_pages }
before do
allow(Clusters::Cluster).to receive(:paginates_per).and_return(1)
create_list(:cluster, 2, :provided_by_gcp, :production_environment, cluster_type: :group_type, groups: [group])
end
it 'redirects to the page' do
go(page: last_page)
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:clusters).current_page).to eq(last_page)
end
end end
end end
end
context 'when group does not have a cluster' do context 'when group does not have a cluster' do
let(:group) { create(:group) } let(:group) { create(:group) }
it 'returns an empty state page' do it 'returns an empty state page' do
go go
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index, partial: :empty_state) expect(response).to render_template(:index, partial: :empty_state)
expect(assigns(:clusters)).to eq([]) expect(assigns(:clusters)).to eq([])
end
end end
end end
end end
......
...@@ -82,16 +82,6 @@ describe DeploymentPlatform do ...@@ -82,16 +82,6 @@ describe DeploymentPlatform do
end end
end end
end end
context 'feature flag disabled' do
before do
stub_feature_flags(group_clusters: false)
end
it 'returns nil' do
is_expected.to be_nil
end
end
end end
end end
end end
...@@ -866,35 +866,6 @@ describe Group do ...@@ -866,35 +866,6 @@ describe Group do
end end
end end
describe '#group_clusters_enabled?' do
before do
# Override global stub in spec/spec_helper.rb
expect(Feature).to receive(:enabled?).and_call_original
end
subject { group.group_clusters_enabled? }
it { is_expected.to be_truthy }
context 'explicitly disabled for root ancestor' do
before do
feature = Feature.get(:group_clusters)
feature.disable(group.root_ancestor)
end
it { is_expected.to be_falsey }
end
context 'explicitly disabled for root ancestor' do
before do
feature = Feature.get(:group_clusters)
feature.enable(group.root_ancestor)
end
it { is_expected.to be_truthy }
end
end
describe '#first_auto_devops_config' do describe '#first_auto_devops_config' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
......
...@@ -497,7 +497,6 @@ describe Project do ...@@ -497,7 +497,6 @@ describe Project do
it { is_expected.to delegate_method(:members).to(:team).with_prefix(true) } it { is_expected.to delegate_method(:members).to(:team).with_prefix(true) }
it { is_expected.to delegate_method(:name).to(:owner).with_prefix(true).with_arguments(allow_nil: true) } it { is_expected.to delegate_method(:name).to(:owner).with_prefix(true).with_arguments(allow_nil: true) }
it { is_expected.to delegate_method(:group_clusters_enabled?).to(:group).with_arguments(allow_nil: true) }
it { is_expected.to delegate_method(:root_ancestor).to(:namespace).with_arguments(allow_nil: true) } it { is_expected.to delegate_method(:root_ancestor).to(:namespace).with_arguments(allow_nil: true) }
it { is_expected.to delegate_method(:last_pipeline).to(:commit).with_arguments(allow_nil: true) } it { is_expected.to delegate_method(:last_pipeline).to(:commit).with_arguments(allow_nil: true) }
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