Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
20fd268e
Commit
20fd268e
authored
Nov 19, 2019
by
Tiger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove :create_eks_clusters feature flag
https://gitlab.com/gitlab-org/gitlab/issues/22392
parent
8b2e5366
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
42 additions
and
182 deletions
+42
-182
app/assets/javascripts/create_cluster/init_create_cluster.js
app/assets/javascripts/create_cluster/init_create_cluster.js
+9
-11
app/controllers/clusters/clusters_controller.rb
app/controllers/clusters/clusters_controller.rb
+2
-7
app/views/admin/application_settings/integrations.html.haml
app/views/admin/application_settings/integrations.html.haml
+1
-1
app/views/clusters/clusters/gcp/_new.html.haml
app/views/clusters/clusters/gcp/_new.html.haml
+0
-2
app/views/clusters/clusters/gcp/_signin_with_google_button.html.haml
...lusters/clusters/gcp/_signin_with_google_button.html.haml
+0
-4
app/views/clusters/clusters/new.html.haml
app/views/clusters/clusters/new.html.haml
+3
-11
changelogs/unreleased/22392-remove-eks-cluster-feature-flag.yml
...logs/unreleased/22392-remove-eks-cluster-feature-flag.yml
+5
-0
doc/user/project/clusters/add_remove_clusters.md
doc/user/project/clusters/add_remove_clusters.md
+0
-24
ee/spec/features/projects/clusters_spec.rb
ee/spec/features/projects/clusters_spec.rb
+4
-6
locale/gitlab.pot
locale/gitlab.pot
+0
-6
spec/controllers/admin/clusters_controller_spec.rb
spec/controllers/admin/clusters_controller_spec.rb
+4
-22
spec/controllers/groups/clusters_controller_spec.rb
spec/controllers/groups/clusters_controller_spec.rb
+3
-17
spec/controllers/projects/clusters_controller_spec.rb
spec/controllers/projects/clusters_controller_spec.rb
+3
-17
spec/features/projects/clusters/gcp_spec.rb
spec/features/projects/clusters/gcp_spec.rb
+2
-27
spec/features/projects/clusters_spec.rb
spec/features/projects/clusters_spec.rb
+6
-27
No files found.
app/assets/javascripts/create_cluster/init_create_cluster.js
View file @
20fd268e
...
...
@@ -6,7 +6,7 @@ const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:cre
const
isProjectLevelCluster
=
page
=>
page
.
startsWith
(
'
project:clusters
'
);
export
default
(
document
,
gon
)
=>
{
export
default
document
=>
{
const
{
page
}
=
document
.
body
.
dataset
;
const
isNewClusterView
=
newClusterViews
.
some
(
view
=>
page
.
endsWith
(
view
));
...
...
@@ -19,17 +19,15 @@ export default (document, gon) => {
initGkeDropdowns
();
if
(
gon
.
features
.
createEksClusters
)
{
import
(
/* webpackChunkName: 'eks_cluster' */
'
~/create_cluster/eks_cluster
'
)
.
then
(({
default
:
initCreateEKSCluster
})
=>
{
const
el
=
document
.
querySelector
(
'
.js-create-eks-cluster-form-container
'
);
import
(
/* webpackChunkName: 'eks_cluster' */
'
~/create_cluster/eks_cluster
'
)
.
then
(({
default
:
initCreateEKSCluster
})
=>
{
const
el
=
document
.
querySelector
(
'
.js-create-eks-cluster-form-container
'
);
if
(
el
)
{
initCreateEKSCluster
(
el
);
}
})
.
catch
(()
=>
{});
}
if
(
el
)
{
initCreateEKSCluster
(
el
);
}
})
.
catch
(()
=>
{});
if
(
isProjectLevelCluster
(
page
))
{
initGkeNamespace
();
...
...
app/controllers/clusters/clusters_controller.rb
View file @
20fd268e
...
...
@@ -12,9 +12,6 @@ class Clusters::ClustersController < Clusters::BaseController
before_action
:authorize_update_cluster!
,
only:
[
:update
]
before_action
:authorize_admin_cluster!
,
only:
[
:destroy
,
:clear_cache
]
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
push_frontend_feature_flag
(
:enable_cluster_application_elastic_stack
)
push_frontend_feature_flag
(
:enable_cluster_application_crossplane
)
...
...
@@ -42,8 +39,6 @@ class Clusters::ClustersController < Clusters::BaseController
end
def
new
return
unless
Feature
.
enabled?
(
:create_eks_clusters
)
if
params
[
:provider
]
==
'aws'
@aws_role
=
current_user
.
aws_role
||
Aws
::
Role
.
new
@aws_role
.
ensure_role_external_id!
...
...
@@ -113,6 +108,7 @@ class Clusters::ClustersController < Clusters::BaseController
generate_gcp_authorize_url
validate_gcp_token
user_cluster
params
[
:provider
]
=
'gcp'
render
:new
,
locals:
{
active_tab:
'create'
}
end
...
...
@@ -277,8 +273,7 @@ class Clusters::ClustersController < Clusters::BaseController
end
def
generate_gcp_authorize_url
params
=
Feature
.
enabled?
(
:create_eks_clusters
)
?
{
provider: :gke
}
:
{}
state
=
generate_session_key_redirect
(
clusterable
.
new_path
(
params
).
to_s
)
state
=
generate_session_key_redirect
(
clusterable
.
new_path
(
provider: :gcp
).
to_s
)
@authorize_url
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
nil
,
callback_google_api_auth_url
,
...
...
app/views/admin/application_settings/integrations.html.haml
View file @
20fd268e
...
...
@@ -8,5 +8,5 @@
=
render_if_exists
'admin/application_settings/slack'
=
render
'admin/application_settings/third_party_offers'
=
render
'admin/application_settings/snowplow'
=
render
'admin/application_settings/eks'
if
Feature
.
enabled?
(
:create_eks_clusters
)
=
render
'admin/application_settings/eks'
app/views/clusters/clusters/gcp/_new.html.haml
View file @
20fd268e
=
render
'clusters/clusters/gcp/header'
-
if
@valid_gcp_token
=
render
'clusters/clusters/gcp/form'
-
elsif
@authorize_url
=
render
'clusters/clusters/gcp/signin_with_google_button'
-
else
=
render
'clusters/clusters/gcp/gcp_not_configured'
app/views/clusters/clusters/gcp/_signin_with_google_button.html.haml
deleted
100644 → 0
View file @
8b2e5366
.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
}
app/views/clusters/clusters/new.html.haml
View file @
20fd268e
-
breadcrumb_title
_
(
'Kubernetes'
)
-
page_title
_
(
'Kubernetes Cluster'
)
-
create_eks_enabled
=
Feature
.
enabled?
(
:create_eks_clusters
)
-
active_tab
=
local_assigns
.
fetch
(
:active_tab
,
'create'
)
=
javascript_include_tag
'https://apis.google.com/js/api.js'
...
...
@@ -14,21 +13,14 @@
%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'
}
%span
-
if
create_eks_enabled
=
create_new_cluster_label
(
provider:
params
[
:provider
])
-
else
=
create_new_cluster_label
(
provider:
'gcp'
)
=
create_new_cluster_label
(
provider:
params
[
:provider
])
%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'
}
%span
Add existing cluster
.tab-content.gitlab-tab-content
-
if
create_eks_enabled
.tab-pane
{
id:
'create-cluster-pane'
,
class:
active_when
(
active_tab
==
'create'
),
role:
'tabpanel'
}
=
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:
'create-cluster-pane'
,
class:
active_when
(
active_tab
==
'create'
),
role:
'tabpanel'
}
=
render
new_cluster_partial
(
provider:
params
[
:provider
])
.tab-pane
{
id:
'add-cluster-pane'
,
class:
active_when
(
active_tab
==
'add'
),
role:
'tabpanel'
}
=
render
'clusters/clusters/user/header'
...
...
changelogs/unreleased/22392-remove-eks-cluster-feature-flag.yml
0 → 100644
View file @
20fd268e
---
title
:
Enable creating Amazon EKS clusters from GitLab
merge_request
:
20333
author
:
type
:
added
doc/user/project/clusters/add_remove_clusters.md
View file @
20fd268e
...
...
@@ -211,33 +211,9 @@ GitLab supports:
Before creating your first cluster on Amazon EKS with GitLab's integration,
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.
-
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
If you are using a self-managed GitLab instance, GitLab must first
...
...
ee/spec/features/projects/clusters_spec.rb
View file @
20fd268e
...
...
@@ -14,10 +14,6 @@ describe 'EE Clusters', :js do
end
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
before
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
...
...
@@ -115,7 +111,8 @@ describe 'EE Clusters', :js do
context
'when user filled form with environment scope'
do
before
do
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
execute_script
(
'document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")'
)
...
...
@@ -159,7 +156,8 @@ describe 'EE Clusters', :js do
context
'when user updates duplicated environment scope'
do
before
do
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
execute_script
(
'document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")'
)
...
...
locale/gitlab.pot
View file @
20fd268e
...
...
@@ -15948,9 +15948,6 @@ msgstr ""
msgid "Sign in via 2FA code"
msgstr ""
msgid "Sign in with Google"
msgstr ""
msgid "Sign in with Single Sign-On"
msgstr ""
...
...
@@ -21263,9 +21260,6 @@ msgstr ""
msgid "opened %{timeAgoString} by %{user}"
msgstr ""
msgid "or %{link_start}create a new Google account%{link_end}"
msgstr ""
msgid "out of %d total test"
msgid_plural "out of %d total tests"
msgstr[0] ""
...
...
spec/controllers/admin/clusters_controller_spec.rb
View file @
20fd268e
...
...
@@ -84,29 +84,11 @@ describe Admin::ClustersController do
GoogleApi
::
CloudPlatform
::
Client
.
session_key_for_redirect_uri
(
key
)
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
it
'redirects to gcp authorize_url'
do
get_new
context
'when selected provider is gke and no valid gcp token exists'
do
it
'redirects to gcp authorize_url'
do
get_new
expect
(
response
).
to
redirect_to
(
assigns
(
:authorize_url
))
end
expect
(
response
).
to
redirect_to
(
assigns
(
:authorize_url
))
end
end
end
...
...
spec/controllers/groups/clusters_controller_spec.rb
View file @
20fd268e
...
...
@@ -97,29 +97,15 @@ describe Groups::ClustersController do
end
before
do
stub_feature_flags
(
create_eks_clusters:
false
)
allow
(
SecureRandom
).
to
receive
(
:hex
).
and_return
(
key
)
end
it
'
has
authorize_url'
do
it
'
redirects to gcp
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
go
expect
(
response
).
to
redirect_to
(
assigns
(
:authorize_url
))
end
end
expect
(
session
[
session_key_for_redirect_uri
]).
to
eq
(
new_group_cluster_path
(
group
,
provider: :gcp
))
expect
(
response
).
to
redirect_to
(
assigns
(
:authorize_url
))
end
end
...
...
spec/controllers/projects/clusters_controller_spec.rb
View file @
20fd268e
...
...
@@ -95,29 +95,15 @@ describe Projects::ClustersController do
end
before
do
stub_feature_flags
(
create_eks_clusters:
false
)
allow
(
SecureRandom
).
to
receive
(
:hex
).
and_return
(
key
)
end
it
'
has
authorize_url'
do
it
'
redirects to gcp
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
go
expect
(
response
).
to
redirect_to
(
assigns
(
:authorize_url
))
end
end
expect
(
session
[
session_key_for_redirect_uri
]).
to
eq
(
new_project_cluster_path
(
project
,
provider: :gcp
))
expect
(
response
).
to
redirect_to
(
assigns
(
:authorize_url
))
end
end
...
...
spec/features/projects/clusters/gcp_spec.rb
View file @
20fd268e
...
...
@@ -18,8 +18,6 @@ describe 'Gcp Cluster', :js do
let
(
:project_id
)
{
'test-project-1234'
}
before
do
stub_feature_flags
(
create_eks_clusters:
false
)
allow_any_instance_of
(
Projects
::
ClustersController
)
.
to
receive
(
:token_in_session
).
and_return
(
'token'
)
allow_any_instance_of
(
Projects
::
ClustersController
)
...
...
@@ -31,7 +29,8 @@ describe 'Gcp Cluster', :js do
visit
project_clusters_path
(
project
)
click_link
'Add Kubernetes cluster'
click_link
'Create new Cluster on GKE'
click_link
'Create new Cluster'
click_link
'Google GKE'
end
context
'when user filled form with valid parameters'
do
...
...
@@ -147,21 +146,6 @@ describe 'Gcp Cluster', :js do
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
before
do
visit
project_clusters_path
(
project
)
...
...
@@ -177,7 +161,6 @@ describe 'Gcp Cluster', :js do
context
'when user has not dismissed GCP signup offer'
do
before
do
stub_feature_flags
(
create_eks_clusters:
false
)
visit
project_clusters_path
(
project
)
end
...
...
@@ -190,18 +173,10 @@ describe 'Gcp Cluster', :js do
expect
(
page
).
to
have_css
(
'.gcp-signup-offer'
)
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
context
'when user has dismissed GCP signup offer'
do
before
do
stub_feature_flags
(
create_eks_clusters:
false
)
visit
project_clusters_path
(
project
)
end
...
...
spec/features/projects/clusters_spec.rb
View file @
20fd268e
...
...
@@ -49,41 +49,20 @@ describe 'Clusters', :js do
end
end
context
'
when user has not signed in Googl
e'
do
context
'
user visits create cluster pag
e'
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
'
click_link
'Create new Cluster'
end
it
'user sees a login page'
do
expect
(
page
).
to
have_css
(
'.signin-with-google'
)
expect
(
page
).
to
have_link
(
'Google account'
)
it
'user sees a link to create a GKE cluster'
do
expect
(
page
).
to
have_link
(
'Google GKE'
)
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
visit
project_clusters_path
(
project
)
click_link
'Add Kubernetes cluster'
click_link
'Create new Cluster'
end
it
'user sees a link to create a GKE cluster'
do
expect
(
page
).
to
have_link
(
'Google GKE'
)
end
it
'user sees a link to create an EKS cluster'
do
expect
(
page
).
to
have_link
(
'Amazon EKS'
)
end
it
'user sees a link to create an EKS cluster'
do
expect
(
page
).
to
have_link
(
'Amazon EKS'
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment