Commit 8497ad15 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'gitlabktl-54-cloud-run-feature-flag' into 'master'

Hide Cloud Run on GKE behind a feature flag

See merge request gitlab-org/gitlab!19063
parents 160b5256 7c06b899
......@@ -9,5 +9,9 @@ module Clusters
def feature_available?(feature)
::Feature.enabled?(feature, default_enabled: true)
end
def flipper_id
self.class.to_s
end
end
end
......@@ -64,12 +64,13 @@
%p.form-text.text-muted
= s_('ClusterIntegration|Learn more about %{help_link_start_machine_type}machine types%{help_link_end} and %{help_link_start_pricing}pricing%{help_link_end}.').html_safe % { help_link_start_machine_type: help_link_start % { url: machine_type_link_url }, help_link_start_pricing: help_link_start % { url: pricing_link_url }, help_link_end: help_link_end }
.form-group
= provider_gcp_field.check_box :cloud_run, { label: s_('ClusterIntegration|Enable Cloud Run on GKE (beta)'),
label_class: 'label-bold' }
.form-text.text-muted
= s_('ClusterIntegration|Uses the Cloud Run, Istio, and HTTP Load Balancing addons for this cluster.')
= link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'cloud-run-on-gke'), target: '_blank'
- if Feature.enabled?(:create_cloud_run_clusters, clusterable)
.form-group
= provider_gcp_field.check_box :cloud_run, { label: s_('ClusterIntegration|Enable Cloud Run on GKE (beta)'),
label_class: 'label-bold' }
.form-text.text-muted
= s_('ClusterIntegration|Uses the Cloud Run, Istio, and HTTP Load Balancing addons for this cluster.')
= link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'cloud-run-on-gke'), target: '_blank'
.form-group
= field.check_box :managed, { label: s_('ClusterIntegration|GitLab-managed cluster'),
......
# frozen_string_literal: true
require 'spec_helper'
describe 'clusters/clusters/gcp/_form' do
let(:admin) { create(:admin) }
let(:environment) { create(:environment) }
let(:gcp_cluster) { create(:cluster, :provided_by_gcp) }
let(:clusterable) { ClusterablePresenter.fabricate(environment.project, current_user: admin) }
before do
assign(:environment, environment)
assign(:gcp_cluster, gcp_cluster)
allow(view).to receive(:clusterable).and_return(clusterable)
allow(view).to receive(:url_for).and_return('#')
allow(view).to receive(:token_in_session).and_return('')
end
context 'with all feature flags enabled' do
it 'has a cloud run checkbox' do
render
expect(rendered).to have_selector("input[id='cluster_provider_gcp_attributes_cloud_run']")
end
end
context 'with cloud run feature flag disabled' do
before do
stub_feature_flags(create_cloud_run_clusters: false)
end
it 'does not have a cloud run checkbox' do
render
expect(rendered).not_to have_selector("input[id='cluster_provider_gcp_attributes_cloud_run']")
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