Commit 8152efbe authored by Thong Kuah's avatar Thong Kuah

Remove instance_clusters feature_flag

Now we have terminals for instance and group clusters we can remove the
FF now. Deploying to instance clusters has been working without
complaints too.
parent 3f759e16
...@@ -9,9 +9,5 @@ module Clusters ...@@ -9,9 +9,5 @@ module Clusters
def feature_available?(feature) def feature_available?(feature)
::Feature.enabled?(feature, default_enabled: true) ::Feature.enabled?(feature, default_enabled: true)
end end
def self.enabled?
::Feature.enabled?(:instance_clusters, default_enabled: true)
end
end end
end end
...@@ -14,7 +14,7 @@ module DeploymentPlatform ...@@ -14,7 +14,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(environment: environment) || find_group_cluster_platform_kubernetes(environment: environment) ||
find_instance_cluster_platform_kubernetes_with_feature_guard(environment: environment) find_instance_cluster_platform_kubernetes(environment: environment)
end end
# EE would override this and utilize environment argument # EE would override this and utilize environment argument
...@@ -29,12 +29,6 @@ module DeploymentPlatform ...@@ -29,12 +29,6 @@ module DeploymentPlatform
.first&.platform_kubernetes .first&.platform_kubernetes
end end
def find_instance_cluster_platform_kubernetes_with_feature_guard(environment: nil)
return unless Clusters::Instance.enabled?
find_instance_cluster_platform_kubernetes(environment: environment)
end
# EE would override this and utilize environment argument # EE would override this and utilize environment argument
def find_instance_cluster_platform_kubernetes(environment: nil) def find_instance_cluster_platform_kubernetes(environment: nil)
Clusters::Instance.new.clusters.enabled.default_environment Clusters::Instance.new.clusters.enabled.default_environment
......
...@@ -6,9 +6,8 @@ module Clusters ...@@ -6,9 +6,8 @@ module Clusters
condition(:has_clusters, scope: :subject) { clusterable_has_clusters? } condition(:has_clusters, scope: :subject) { clusterable_has_clusters? }
condition(:can_have_multiple_clusters) { multiple_clusters_available? } condition(:can_have_multiple_clusters) { multiple_clusters_available? }
condition(:instance_clusters_enabled) { Instance.enabled? }
rule { admin & instance_clusters_enabled }.policy do rule { admin }.policy do
enable :read_cluster enable :read_cluster
enable :add_cluster enable :add_cluster
enable :create_cluster enable :create_cluster
......
---
title: Remove group and instance clusters feature flag
merge_request: 30124
author:
type: changed
...@@ -13,16 +13,6 @@ describe Admin::Clusters::ApplicationsController do ...@@ -13,16 +13,6 @@ describe Admin::Clusters::ApplicationsController do
it { expect { subject }.to be_allowed_for(:admin) } it { expect { subject }.to be_allowed_for(:admin) }
it { expect { subject }.to be_denied_for(:user) } it { expect { subject }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { subject }.to be_denied_for(:external) }
context 'when instance clusters are disabled' do
before do
stub_feature_flags(instance_clusters: false)
end
it 'returns 404' do
is_expected.to have_http_status(:not_found)
end
end
end end
let(:cluster) { create(:cluster, :instance, :provided_by_gcp) } let(:cluster) { create(:cluster, :instance, :provided_by_gcp) }
......
...@@ -17,66 +17,48 @@ describe Admin::ClustersController do ...@@ -17,66 +17,48 @@ describe Admin::ClustersController do
get :index, params: params get :index, params: params
end end
context 'when feature flag is not enabled' do describe 'functionality' do
before do context 'when instance has one or more clusters' do
stub_feature_flags(instance_clusters: false) let!(:enabled_cluster) do
end create(:cluster, :provided_by_gcp, :instance)
end
it 'responds with not found' do let!(:disabled_cluster) do
get_index create(:cluster, :disabled, :provided_by_gcp, :production_environment, :instance)
end
expect(response).to have_gitlab_http_status(404) it 'lists available clusters' do
end get_index
end
context 'when feature flag is enabled' do expect(response).to have_gitlab_http_status(:ok)
before do expect(response).to render_template(:index)
stub_feature_flags(instance_clusters: true) expect(assigns(:clusters)).to match_array([enabled_cluster, disabled_cluster])
end end
describe 'functionality' do context 'when page is specified' do
context 'when instance has one or more clusters' do let(:last_page) { Clusters::Cluster.instance_type.page.total_pages }
let!(:enabled_cluster) do
create(:cluster, :provided_by_gcp, :instance)
end
let!(:disabled_cluster) do before do
create(:cluster, :disabled, :provided_by_gcp, :production_environment, :instance) allow(Clusters::Cluster).to receive(:paginates_per).and_return(1)
create_list(:cluster, 2, :provided_by_gcp, :production_environment, :instance)
end end
it 'lists available clusters' do it 'redirects to the page' do
get_index get_index(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) { Clusters::Cluster.instance_type.page.total_pages }
before do
allow(Clusters::Cluster).to receive(:paginates_per).and_return(1)
create_list(:cluster, 2, :provided_by_gcp, :production_environment, :instance)
end
it 'redirects to the page' do
get_index(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 instance does not have a cluster' do context 'when instance does not have a cluster' do
it 'returns an empty state page' do it 'returns an empty state page' do
get_index get_index
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
......
...@@ -16,21 +16,9 @@ describe Clusters::InstancePolicy do ...@@ -16,21 +16,9 @@ describe Clusters::InstancePolicy do
context 'when admin' do context 'when admin' do
let(:user) { create(:admin) } let(:user) { create(:admin) }
context 'with instance_level_clusters enabled' do it { expect(policy).to be_allowed :read_cluster }
it { expect(policy).to be_allowed :read_cluster } it { expect(policy).to be_allowed :update_cluster }
it { expect(policy).to be_allowed :update_cluster } it { expect(policy).to be_allowed :admin_cluster }
it { expect(policy).to be_allowed :admin_cluster }
end
context 'with instance_level_clusters disabled' do
before do
stub_feature_flags(instance_clusters: false)
end
it { expect(policy).to be_disallowed :read_cluster }
it { expect(policy).to be_disallowed :update_cluster }
it { expect(policy).to be_disallowed :admin_cluster }
end
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