Commit 20fd268e authored by Tiger's avatar Tiger

Remove :create_eks_clusters feature flag

https://gitlab.com/gitlab-org/gitlab/issues/22392
parent 8b2e5366
...@@ -6,7 +6,7 @@ const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:cre ...@@ -6,7 +6,7 @@ const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:cre
const isProjectLevelCluster = page => page.startsWith('project:clusters'); const isProjectLevelCluster = page => page.startsWith('project:clusters');
export default (document, gon) => { export default document => {
const { page } = document.body.dataset; const { page } = document.body.dataset;
const isNewClusterView = newClusterViews.some(view => page.endsWith(view)); const isNewClusterView = newClusterViews.some(view => page.endsWith(view));
...@@ -19,7 +19,6 @@ export default (document, gon) => { ...@@ -19,7 +19,6 @@ export default (document, gon) => {
initGkeDropdowns(); initGkeDropdowns();
if (gon.features.createEksClusters) {
import(/* webpackChunkName: 'eks_cluster' */ '~/create_cluster/eks_cluster') import(/* webpackChunkName: 'eks_cluster' */ '~/create_cluster/eks_cluster')
.then(({ default: initCreateEKSCluster }) => { .then(({ default: initCreateEKSCluster }) => {
const el = document.querySelector('.js-create-eks-cluster-form-container'); const el = document.querySelector('.js-create-eks-cluster-form-container');
...@@ -29,7 +28,6 @@ export default (document, gon) => { ...@@ -29,7 +28,6 @@ export default (document, gon) => {
} }
}) })
.catch(() => {}); .catch(() => {});
}
if (isProjectLevelCluster(page)) { if (isProjectLevelCluster(page)) {
initGkeNamespace(); initGkeNamespace();
......
...@@ -12,9 +12,6 @@ class Clusters::ClustersController < Clusters::BaseController ...@@ -12,9 +12,6 @@ class Clusters::ClustersController < Clusters::BaseController
before_action :authorize_update_cluster!, only: [:update] before_action :authorize_update_cluster!, only: [:update]
before_action :authorize_admin_cluster!, only: [:destroy, :clear_cache] before_action :authorize_admin_cluster!, only: [:destroy, :clear_cache]
before_action :update_applications_status, only: [:cluster_status] before_action :update_applications_status, only: [:cluster_status]
before_action only: [:new, :create_gcp] do
push_frontend_feature_flag(:create_eks_clusters)
end
before_action only: [:show] do before_action only: [:show] do
push_frontend_feature_flag(:enable_cluster_application_elastic_stack) push_frontend_feature_flag(:enable_cluster_application_elastic_stack)
push_frontend_feature_flag(:enable_cluster_application_crossplane) push_frontend_feature_flag(:enable_cluster_application_crossplane)
...@@ -42,8 +39,6 @@ class Clusters::ClustersController < Clusters::BaseController ...@@ -42,8 +39,6 @@ class Clusters::ClustersController < Clusters::BaseController
end end
def new def new
return unless Feature.enabled?(:create_eks_clusters)
if params[:provider] == 'aws' if params[:provider] == 'aws'
@aws_role = current_user.aws_role || Aws::Role.new @aws_role = current_user.aws_role || Aws::Role.new
@aws_role.ensure_role_external_id! @aws_role.ensure_role_external_id!
...@@ -113,6 +108,7 @@ class Clusters::ClustersController < Clusters::BaseController ...@@ -113,6 +108,7 @@ class Clusters::ClustersController < Clusters::BaseController
generate_gcp_authorize_url generate_gcp_authorize_url
validate_gcp_token validate_gcp_token
user_cluster user_cluster
params[:provider] = 'gcp'
render :new, locals: { active_tab: 'create' } render :new, locals: { active_tab: 'create' }
end end
...@@ -277,8 +273,7 @@ class Clusters::ClustersController < Clusters::BaseController ...@@ -277,8 +273,7 @@ class Clusters::ClustersController < Clusters::BaseController
end end
def generate_gcp_authorize_url def generate_gcp_authorize_url
params = Feature.enabled?(:create_eks_clusters) ? { provider: :gke } : {} state = generate_session_key_redirect(clusterable.new_path(provider: :gcp).to_s)
state = generate_session_key_redirect(clusterable.new_path(params).to_s)
@authorize_url = GoogleApi::CloudPlatform::Client.new( @authorize_url = GoogleApi::CloudPlatform::Client.new(
nil, callback_google_api_auth_url, nil, callback_google_api_auth_url,
......
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
= render_if_exists 'admin/application_settings/slack' = render_if_exists 'admin/application_settings/slack'
= render 'admin/application_settings/third_party_offers' = render 'admin/application_settings/third_party_offers'
= render 'admin/application_settings/snowplow' = render 'admin/application_settings/snowplow'
= render 'admin/application_settings/eks' if Feature.enabled?(:create_eks_clusters) = render 'admin/application_settings/eks'
= render 'clusters/clusters/gcp/header' = render 'clusters/clusters/gcp/header'
- if @valid_gcp_token - if @valid_gcp_token
= render 'clusters/clusters/gcp/form' = render 'clusters/clusters/gcp/form'
- elsif @authorize_url
= render 'clusters/clusters/gcp/signin_with_google_button'
- else - else
= render 'clusters/clusters/gcp/gcp_not_configured' = render 'clusters/clusters/gcp/gcp_not_configured'
.signin-with-google
- create_account_link = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: 'https://accounts.google.com/SignUpWithoutGmail?service=cloudconsole&continue=https%3A%2F%2Fconsole.cloud.google.com%2Ffreetrial%3Futm_campaign%3D2018_cpanel%26utm_source%3Dgitlab%26utm_medium%3Dreferral' }
= link_to(image_tag('auth_buttons/signin_with_google.png', width: '191px', alt: _('Sign in with Google')), @authorize_url)
= s_('or %{link_start}create a new Google account%{link_end}').html_safe % { link_start: create_account_link, link_end: '</a>'.html_safe }
- breadcrumb_title _('Kubernetes') - breadcrumb_title _('Kubernetes')
- page_title _('Kubernetes Cluster') - page_title _('Kubernetes Cluster')
- create_eks_enabled = Feature.enabled?(:create_eks_clusters)
- active_tab = local_assigns.fetch(:active_tab, 'create') - active_tab = local_assigns.fetch(:active_tab, 'create')
= javascript_include_tag 'https://apis.google.com/js/api.js' = javascript_include_tag 'https://apis.google.com/js/api.js'
...@@ -14,21 +13,14 @@ ...@@ -14,21 +13,14 @@
%li.nav-item{ role: 'presentation' } %li.nav-item{ role: 'presentation' }
%a.nav-link{ href: '#create-cluster-pane', id: 'create-cluster-tab', class: active_when(active_tab == 'create'), data: { toggle: 'tab' }, role: 'tab' } %a.nav-link{ href: '#create-cluster-pane', id: 'create-cluster-tab', class: active_when(active_tab == 'create'), data: { toggle: 'tab' }, role: 'tab' }
%span %span
- if create_eks_enabled
= create_new_cluster_label(provider: params[:provider]) = create_new_cluster_label(provider: params[:provider])
- else
= create_new_cluster_label(provider: 'gcp')
%li.nav-item{ role: 'presentation' } %li.nav-item{ role: 'presentation' }
%a.nav-link{ href: '#add-cluster-pane', id: 'add-cluster-tab', class: active_when(active_tab == 'add'), data: { toggle: 'tab' }, role: 'tab' } %a.nav-link{ href: '#add-cluster-pane', id: 'add-cluster-tab', class: active_when(active_tab == 'add'), data: { toggle: 'tab' }, role: 'tab' }
%span Add existing cluster %span Add existing cluster
.tab-content.gitlab-tab-content .tab-content.gitlab-tab-content
- if create_eks_enabled
.tab-pane{ id: 'create-cluster-pane', class: active_when(active_tab == 'create'), role: 'tabpanel' } .tab-pane{ id: 'create-cluster-pane', class: active_when(active_tab == 'create'), role: 'tabpanel' }
= render new_cluster_partial(provider: params[:provider]) = render new_cluster_partial(provider: params[:provider])
- else
.tab-pane{ id: 'create-cluster-pane', class: active_when(active_tab == 'create'), role: 'tabpanel' }
= render new_cluster_partial(provider: 'gcp')
.tab-pane{ id: 'add-cluster-pane', class: active_when(active_tab == 'add'), role: 'tabpanel' } .tab-pane{ id: 'add-cluster-pane', class: active_when(active_tab == 'add'), role: 'tabpanel' }
= render 'clusters/clusters/user/header' = render 'clusters/clusters/user/header'
......
---
title: Enable creating Amazon EKS clusters from GitLab
merge_request: 20333
author:
type: added
...@@ -211,33 +211,9 @@ GitLab supports: ...@@ -211,33 +211,9 @@ GitLab supports:
Before creating your first cluster on Amazon EKS with GitLab's integration, Before creating your first cluster on Amazon EKS with GitLab's integration,
make sure the following requirements are met: make sure the following requirements are met:
- Self-managed GitLab instances have the `create_eks_clusters` feature flag enabled.
- An [Amazon Web Services](https://aws.amazon.com/) account is set up and you are able to log in. - An [Amazon Web Services](https://aws.amazon.com/) account is set up and you are able to log in.
- You have permissions to manage IAM resources. - You have permissions to manage IAM resources.
##### Enable the `create_eks_clusters` feature flag **(CORE ONLY)**
Self-managed instances must have the feature flag `create_eks_clusters` enabled to create
EKS clusters. To enable EKS cluster creation, ask a GitLab administrator with Rails console access
to run the following command:
```ruby
Feature.enable(:create_eks_clusters)
```
To have it enabled for a specific project only, ask a GitLab administrator to run the following
command using a Rails console:
```ruby
Feature.enable(:create_eks_clusters, Project.find_by_full_path('my_group/my_project'))
```
To have this feature disabled, ask a GitLab administrator to run the following command:
```ruby
Feature.disable(:create_eks_clusters)
```
##### Additional requirements for self-managed instances ##### Additional requirements for self-managed instances
If you are using a self-managed GitLab instance, GitLab must first If you are using a self-managed GitLab instance, GitLab must first
......
...@@ -14,10 +14,6 @@ describe 'EE Clusters', :js do ...@@ -14,10 +14,6 @@ describe 'EE Clusters', :js do
end end
context 'when user has a cluster' do context 'when user has a cluster' do
before do
stub_feature_flags(create_eks_clusters: false)
end
context 'when license has multiple clusters feature' do context 'when license has multiple clusters feature' do
before do before do
allow(License).to receive(:feature_available?).and_call_original allow(License).to receive(:feature_available?).and_call_original
...@@ -115,7 +111,8 @@ describe 'EE Clusters', :js do ...@@ -115,7 +111,8 @@ describe 'EE Clusters', :js do
context 'when user filled form with environment scope' do context 'when user filled form with environment scope' do
before do before do
click_link 'Add Kubernetes cluster' click_link 'Add Kubernetes cluster'
click_link 'Create new Cluster on GKE' click_link 'Create new Cluster'
click_link 'Google GKE'
sleep 2 # wait for ajax sleep 2 # wait for ajax
execute_script('document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")') execute_script('document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")')
...@@ -159,7 +156,8 @@ describe 'EE Clusters', :js do ...@@ -159,7 +156,8 @@ describe 'EE Clusters', :js do
context 'when user updates duplicated environment scope' do context 'when user updates duplicated environment scope' do
before do before do
click_link 'Add Kubernetes cluster' click_link 'Add Kubernetes cluster'
click_link 'Create new Cluster on GKE' click_link 'Create new Cluster'
click_link 'Google GKE'
sleep 2 # wait for ajax sleep 2 # wait for ajax
execute_script('document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")') execute_script('document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")')
......
...@@ -15948,9 +15948,6 @@ msgstr "" ...@@ -15948,9 +15948,6 @@ msgstr ""
msgid "Sign in via 2FA code" msgid "Sign in via 2FA code"
msgstr "" msgstr ""
msgid "Sign in with Google"
msgstr ""
msgid "Sign in with Single Sign-On" msgid "Sign in with Single Sign-On"
msgstr "" msgstr ""
...@@ -21263,9 +21260,6 @@ msgstr "" ...@@ -21263,9 +21260,6 @@ msgstr ""
msgid "opened %{timeAgoString} by %{user}" msgid "opened %{timeAgoString} by %{user}"
msgstr "" msgstr ""
msgid "or %{link_start}create a new Google account%{link_end}"
msgstr ""
msgid "out of %d total test" msgid "out of %d total test"
msgid_plural "out of %d total tests" msgid_plural "out of %d total tests"
msgstr[0] "" msgstr[0] ""
......
...@@ -84,23 +84,6 @@ describe Admin::ClustersController do ...@@ -84,23 +84,6 @@ describe Admin::ClustersController do
GoogleApi::CloudPlatform::Client.session_key_for_redirect_uri(key) GoogleApi::CloudPlatform::Client.session_key_for_redirect_uri(key)
end end
before do
stub_feature_flags(create_eks_clusters: false)
allow(SecureRandom).to receive(:hex).and_return(key)
end
it 'has authorize_url' do
get_new
expect(assigns(:authorize_url)).to include(key)
expect(session[session_key_for_redirect_uri]).to eq(new_admin_cluster_path)
end
context 'when create_eks_clusters feature flag is enabled' do
before do
stub_feature_flags(create_eks_clusters: true)
end
context 'when selected provider is gke and no valid gcp token exists' do context 'when selected provider is gke and no valid gcp token exists' do
it 'redirects to gcp authorize_url' do it 'redirects to gcp authorize_url' do
get_new get_new
...@@ -109,7 +92,6 @@ describe Admin::ClustersController do ...@@ -109,7 +92,6 @@ describe Admin::ClustersController do
end end
end end
end end
end
context 'when omniauth has not configured' do context 'when omniauth has not configured' do
before do before do
......
...@@ -97,31 +97,17 @@ describe Groups::ClustersController do ...@@ -97,31 +97,17 @@ describe Groups::ClustersController do
end end
before do before do
stub_feature_flags(create_eks_clusters: false)
allow(SecureRandom).to receive(:hex).and_return(key) allow(SecureRandom).to receive(:hex).and_return(key)
end end
it 'has authorize_url' do
go
expect(assigns(:authorize_url)).to include(key)
expect(session[session_key_for_redirect_uri]).to eq(new_group_cluster_path(group))
end
context 'when create_eks_clusters feature flag is enabled' do
before do
stub_feature_flags(create_eks_clusters: true)
end
context 'when selected provider is gke and no valid gcp token exists' do
it 'redirects to gcp authorize_url' do it 'redirects to gcp authorize_url' do
go go
expect(assigns(:authorize_url)).to include(key)
expect(session[session_key_for_redirect_uri]).to eq(new_group_cluster_path(group, provider: :gcp))
expect(response).to redirect_to(assigns(:authorize_url)) expect(response).to redirect_to(assigns(:authorize_url))
end end
end end
end
end
context 'when omniauth has not configured' do context 'when omniauth has not configured' do
before do before do
......
...@@ -95,31 +95,17 @@ describe Projects::ClustersController do ...@@ -95,31 +95,17 @@ describe Projects::ClustersController do
end end
before do before do
stub_feature_flags(create_eks_clusters: false)
allow(SecureRandom).to receive(:hex).and_return(key) allow(SecureRandom).to receive(:hex).and_return(key)
end end
it 'has authorize_url' do
go
expect(assigns(:authorize_url)).to include(key)
expect(session[session_key_for_redirect_uri]).to eq(new_project_cluster_path(project))
end
context 'when create_eks_clusters feature flag is enabled' do
before do
stub_feature_flags(create_eks_clusters: true)
end
context 'when selected provider is gke and no valid gcp token exists' do
it 'redirects to gcp authorize_url' do it 'redirects to gcp authorize_url' do
go go
expect(assigns(:authorize_url)).to include(key)
expect(session[session_key_for_redirect_uri]).to eq(new_project_cluster_path(project, provider: :gcp))
expect(response).to redirect_to(assigns(:authorize_url)) expect(response).to redirect_to(assigns(:authorize_url))
end end
end end
end
end
context 'when omniauth has not configured' do context 'when omniauth has not configured' do
before do before do
......
...@@ -18,8 +18,6 @@ describe 'Gcp Cluster', :js do ...@@ -18,8 +18,6 @@ describe 'Gcp Cluster', :js do
let(:project_id) { 'test-project-1234' } let(:project_id) { 'test-project-1234' }
before do before do
stub_feature_flags(create_eks_clusters: false)
allow_any_instance_of(Projects::ClustersController) allow_any_instance_of(Projects::ClustersController)
.to receive(:token_in_session).and_return('token') .to receive(:token_in_session).and_return('token')
allow_any_instance_of(Projects::ClustersController) allow_any_instance_of(Projects::ClustersController)
...@@ -31,7 +29,8 @@ describe 'Gcp Cluster', :js do ...@@ -31,7 +29,8 @@ describe 'Gcp Cluster', :js do
visit project_clusters_path(project) visit project_clusters_path(project)
click_link 'Add Kubernetes cluster' click_link 'Add Kubernetes cluster'
click_link 'Create new Cluster on GKE' click_link 'Create new Cluster'
click_link 'Google GKE'
end end
context 'when user filled form with valid parameters' do context 'when user filled form with valid parameters' do
...@@ -147,21 +146,6 @@ describe 'Gcp Cluster', :js do ...@@ -147,21 +146,6 @@ describe 'Gcp Cluster', :js do
end end
end end
context 'when user has not signed with Google' do
before do
stub_feature_flags(create_eks_clusters: false)
visit project_clusters_path(project)
click_link 'Add Kubernetes cluster'
click_link 'Create new Cluster on GKE'
end
it 'user sees a login page' do
expect(page).to have_css('.signin-with-google')
expect(page).to have_link('Google account')
end
end
context 'when a user cannot edit the environment scope' do context 'when a user cannot edit the environment scope' do
before do before do
visit project_clusters_path(project) visit project_clusters_path(project)
...@@ -177,7 +161,6 @@ describe 'Gcp Cluster', :js do ...@@ -177,7 +161,6 @@ describe 'Gcp Cluster', :js do
context 'when user has not dismissed GCP signup offer' do context 'when user has not dismissed GCP signup offer' do
before do before do
stub_feature_flags(create_eks_clusters: false)
visit project_clusters_path(project) visit project_clusters_path(project)
end end
...@@ -190,18 +173,10 @@ describe 'Gcp Cluster', :js do ...@@ -190,18 +173,10 @@ describe 'Gcp Cluster', :js do
expect(page).to have_css('.gcp-signup-offer') expect(page).to have_css('.gcp-signup-offer')
end end
it 'user sees offer on cluster GCP login page' do
click_link 'Add Kubernetes cluster'
click_link 'Create new Cluster on GKE'
expect(page).to have_css('.gcp-signup-offer')
end
end end
context 'when user has dismissed GCP signup offer' do context 'when user has dismissed GCP signup offer' do
before do before do
stub_feature_flags(create_eks_clusters: false)
visit project_clusters_path(project) visit project_clusters_path(project)
end end
......
...@@ -49,27 +49,7 @@ describe 'Clusters', :js do ...@@ -49,27 +49,7 @@ describe 'Clusters', :js do
end end
end end
context 'when user has not signed in Google' do context 'user visits create cluster page' do
before do
stub_feature_flags(create_eks_clusters: false)
visit project_clusters_path(project)
click_link 'Add Kubernetes cluster'
click_link 'Create new Cluster on GKE'
end
it 'user sees a login page' do
expect(page).to have_css('.signin-with-google')
expect(page).to have_link('Google account')
end
end
context 'when create_eks_clusters feature flag is enabled' do
before do
stub_feature_flags(create_eks_clusters: true)
end
context 'when user access create cluster page' do
before do before do
visit project_clusters_path(project) visit project_clusters_path(project)
...@@ -85,5 +65,4 @@ describe 'Clusters', :js do ...@@ -85,5 +65,4 @@ describe 'Clusters', :js do
expect(page).to have_link('Amazon EKS') expect(page).to have_link('Amazon EKS')
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