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

Merge branch 'jcunha/adds-cert-based-cluster-ff' into 'master'

Add feature flag to toggle cert-based clusters features

See merge request gitlab-org/gitlab!81054
parents 24233a3c 564b6a24
......@@ -3,6 +3,8 @@
module DeploymentPlatform
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def deployment_platform(environment: nil)
return if Feature.disabled?(:certificate_based_clusters, default_enabled: :yaml, type: :ops)
@deployment_platform ||= {}
@deployment_platform[environment] ||= find_deployment_platform(environment)
......
---
name: certificate_based_clusters
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81054
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/353410
milestone: '14.9'
type: ops
group: group::configure
default_enabled: true
......@@ -238,14 +238,34 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do
end
it_behaves_like 'pipeline with Kubernetes jobs'
context 'when certificate_based_clusters FF is disabled' do
before do
stub_feature_flags(certificate_based_clusters: false)
end
it 'does not include production job' do
expect(build_names).not_to include('production')
end
end
end
context 'when project has an Agent is present' do
context 'when project has an Agent' do
before do
create(:cluster_agent, project: project)
end
it_behaves_like 'pipeline with Kubernetes jobs'
context 'when certificate_based_clusters FF is disabled' do
before do
stub_feature_flags(certificate_based_clusters: false)
end
it 'includes production job' do
expect(build_names).to include('production')
end
end
end
end
......
......@@ -12,16 +12,28 @@ RSpec.describe DeploymentPlatform do
let(:group) { create(:group) }
let(:project) { create(:project, group: group) }
shared_examples 'certificate_based_clusters is disabled' do
before do
stub_feature_flags(certificate_based_clusters: false)
end
it { is_expected.to be_nil }
end
shared_examples 'matching environment scope' do
it 'returns environment specific cluster' do
is_expected.to eq(cluster.platform_kubernetes)
end
it_behaves_like 'certificate_based_clusters is disabled'
end
shared_examples 'not matching environment scope' do
it 'returns default cluster' do
is_expected.to eq(default_cluster.platform_kubernetes)
end
it_behaves_like 'certificate_based_clusters is disabled'
end
context 'multiple clusters use the same management project' do
......
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