Commit e7a5fd1b authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'remove_clusters_cte_feature_flag' into 'master'

Remove clusters cte feature flag

See merge request gitlab-org/gitlab-ee!14715
parents 1957d258 70893418
......@@ -12,19 +12,10 @@ module DeploymentPlatform
private
def find_deployment_platform(environment)
find_platform_kubernetes(environment) ||
find_platform_kubernetes_with_cte(environment) ||
find_instance_cluster_platform_kubernetes(environment: environment)
end
def find_platform_kubernetes(environment)
if Feature.enabled?(:clusters_cte)
find_platform_kubernetes_with_cte(environment)
else
find_cluster_platform_kubernetes(environment: environment) ||
find_group_cluster_platform_kubernetes(environment: environment)
end
end
# EE would override this and utilize environment argument
def find_platform_kubernetes_with_cte(_environment)
Clusters::ClustersHierarchy.new(self).base_and_ancestors
......@@ -32,18 +23,6 @@ module DeploymentPlatform
.first&.platform_kubernetes
end
# EE would override this and utilize environment argument
def find_cluster_platform_kubernetes(environment: nil)
clusters.enabled.default_environment
.last&.platform_kubernetes
end
# EE would override this and utilize environment argument
def find_group_cluster_platform_kubernetes(environment: nil)
Clusters::Cluster.enabled.default_environment.ancestor_clusters_for_clusterable(self)
.first&.platform_kubernetes
end
# EE would override this and utilize environment argument
def find_instance_cluster_platform_kubernetes(environment: nil)
Clusters::Instance.new.clusters.enabled.default_environment
......
......@@ -14,29 +14,6 @@ module EE
.first&.platform_kubernetes
end
override :find_cluster_platform_kubernetes
def find_cluster_platform_kubernetes(environment: nil)
return super unless environment && feature_available?(:multiple_clusters)
clusters.enabled
.on_environment(environment)
.last&.platform_kubernetes
end
override :find_group_cluster_platform_kubernetes
def find_group_cluster_platform_kubernetes(environment: nil)
return super unless environment && feature_available?(:multiple_clusters)
# With relevant_only: true
# on_environment use CASE which returns numbers in ascending order
# So we can use `hierarchy_order: :asc` + first
::Clusters::Cluster
.enabled
.on_environment(environment, relevant_only: true)
.ancestor_clusters_for_clusterable(self, hierarchy_order: :asc)
.first&.platform_kubernetes
end
override :find_instance_cluster_platform_kubernetes
def find_instance_cluster_platform_kubernetes(environment: nil)
return super unless environment && feature_available?(:multiple_clusters)
......
require 'rails_helper'
describe EE::DeploymentPlatform do
shared_examples '#deployment_platform' do
describe '#deployment_platform' do
let(:group) { create(:group) }
let(:project) { create(:project, group: group) }
......@@ -265,20 +265,4 @@ describe EE::DeploymentPlatform do
end
end
end
context 'legacy implementation' do
before do
stub_feature_flags(clusters_cte: false)
end
include_examples '#deployment_platform'
end
context 'CTE implementation' do
before do
stub_feature_flags(clusters_cte: true)
end
include_examples '#deployment_platform'
end
end
......@@ -5,7 +5,7 @@ require 'rails_helper'
describe DeploymentPlatform do
let(:project) { create(:project) }
shared_examples '#deployment_platform' do
describe '#deployment_platform' do
subject { project.deployment_platform }
context 'with no Kubernetes configuration on CI/CD, no Kubernetes Service' do
......@@ -84,20 +84,4 @@ describe DeploymentPlatform do
end
end
end
context 'legacy implementation' do
before do
stub_feature_flags(clusters_cte: false)
end
include_examples '#deployment_platform'
end
context 'CTE implementation' do
before do
stub_feature_flags(clusters_cte: true)
end
include_examples '#deployment_platform'
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