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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
bf0179b7
Commit
bf0179b7
authored
Aug 29, 2018
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set RBAC support behind a feature flag.
This is the same as with adding an existing cluster
parent
0f210a69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
app/services/clusters/gcp/finalize_creation_service.rb
app/services/clusters/gcp/finalize_creation_service.rb
+1
-2
spec/services/clusters/gcp/finalize_creation_service_spec.rb
spec/services/clusters/gcp/finalize_creation_service_spec.rb
+26
-1
No files found.
app/services/clusters/gcp/finalize_creation_service.rb
View file @
bf0179b7
...
@@ -48,9 +48,8 @@ module Clusters
...
@@ -48,9 +48,8 @@ module Clusters
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
.
new
(
kube_client
).
execute
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
.
new
(
kube_client
).
execute
end
end
# GKE Clusters have RBAC enabled on Kubernetes >= 1.6
def
authorization_type
def
authorization_type
'r
bac'
Feature
.
enabled?
(
:rbac_clusters
)
?
'rbac'
:
'a
bac'
end
end
def
kube_client
def
kube_client
...
...
spec/services/clusters/gcp/finalize_creation_service_spec.rb
View file @
bf0179b7
...
@@ -59,6 +59,8 @@ describe Clusters::Gcp::FinalizeCreationService do
...
@@ -59,6 +59,8 @@ describe Clusters::Gcp::FinalizeCreationService do
metadata_name:
'gitlab-token-Y1a'
,
metadata_name:
'gitlab-token-Y1a'
,
token:
Base64
.
encode64
(
token
)
token:
Base64
.
encode64
(
token
)
}
)
}
)
stub_feature_flags
(
rbac_clusters:
false
)
end
end
it_behaves_like
'success'
it_behaves_like
'success'
...
@@ -74,9 +76,32 @@ describe Clusters::Gcp::FinalizeCreationService do
...
@@ -74,9 +76,32 @@ describe Clusters::Gcp::FinalizeCreationService do
expect
(
platform
.
ca_cert
).
to
eq
(
Base64
.
decode64
(
load_sample_cert
))
expect
(
platform
.
ca_cert
).
to
eq
(
Base64
.
decode64
(
load_sample_cert
))
expect
(
platform
.
username
).
to
eq
(
username
)
expect
(
platform
.
username
).
to
eq
(
username
)
expect
(
platform
.
password
).
to
eq
(
password
)
expect
(
platform
.
password
).
to
eq
(
password
)
expect
(
platform
.
authorization_type
).
to
eq
(
'
r
bac'
)
expect
(
platform
.
authorization_type
).
to
eq
(
'
a
bac'
)
expect
(
platform
.
token
).
to
eq
(
token
)
expect
(
platform
.
token
).
to
eq
(
token
)
end
end
context
'rbac_clusters feature enabled'
do
before
do
stub_feature_flags
(
rbac_clusters:
true
)
end
it_behaves_like
'success'
it
'has corresponded data'
do
described_class
.
new
.
execute
(
provider
)
cluster
.
reload
provider
.
reload
platform
.
reload
expect
(
provider
.
endpoint
).
to
eq
(
endpoint
)
expect
(
platform
.
api_url
).
to
eq
(
api_url
)
expect
(
platform
.
ca_cert
).
to
eq
(
Base64
.
decode64
(
load_sample_cert
))
expect
(
platform
.
username
).
to
eq
(
username
)
expect
(
platform
.
password
).
to
eq
(
password
)
expect
(
platform
.
authorization_type
).
to
eq
(
'rbac'
)
expect
(
platform
.
token
).
to
eq
(
token
)
end
end
end
end
context
'when default-token is not found'
do
context
'when default-token is not found'
do
...
...
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