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
Boxiang Sun
gitlab-ce
Commits
ba2d8a3f
Commit
ba2d8a3f
authored
Dec 05, 2018
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename to CreateOrUpdateServiceAccountService
This reflects how we now create or update
parent
9c140b7d
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
13 deletions
+13
-13
app/services/clusters/gcp/finalize_creation_service.rb
app/services/clusters/gcp/finalize_creation_service.rb
+1
-1
app/services/clusters/gcp/kubernetes/create_or_update_namespace_service.rb
...ters/gcp/kubernetes/create_or_update_namespace_service.rb
+1
-1
app/services/clusters/gcp/kubernetes/create_or_update_service_account_service.rb
...cp/kubernetes/create_or_update_service_account_service.rb
+1
-1
spec/services/clusters/gcp/kubernetes/create_or_update_namespace_service_spec.rb
...gcp/kubernetes/create_or_update_namespace_service_spec.rb
+2
-2
spec/services/clusters/gcp/kubernetes/create_or_update_service_account_service_spec.rb
...bernetes/create_or_update_service_account_service_spec.rb
+1
-1
spec/services/clusters/refresh_service_spec.rb
spec/services/clusters/refresh_service_spec.rb
+3
-3
spec/services/projects/create_service_spec.rb
spec/services/projects/create_service_spec.rb
+2
-2
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+2
-2
No files found.
app/services/clusters/gcp/finalize_creation_service.rb
View file @
ba2d8a3f
...
@@ -26,7 +26,7 @@ module Clusters
...
@@ -26,7 +26,7 @@ module Clusters
private
private
def
create_gitlab_service_account!
def
create_gitlab_service_account!
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
.
gitlab_creator
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
.
gitlab_creator
(
kube_client
,
kube_client
,
rbac:
create_rbac_cluster?
rbac:
create_rbac_cluster?
).
execute
).
execute
...
...
app/services/clusters/gcp/kubernetes/create_or_update_namespace_service.rb
View file @
ba2d8a3f
...
@@ -27,7 +27,7 @@ module Clusters
...
@@ -27,7 +27,7 @@ module Clusters
end
end
def
create_project_service_account
def
create_project_service_account
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
.
namespace_creator
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
.
namespace_creator
(
platform
.
kubeclient
,
platform
.
kubeclient
,
service_account_name:
kubernetes_namespace
.
service_account_name
,
service_account_name:
kubernetes_namespace
.
service_account_name
,
service_account_namespace:
kubernetes_namespace
.
namespace
,
service_account_namespace:
kubernetes_namespace
.
namespace
,
...
...
app/services/clusters/gcp/kubernetes/create_service_account_service.rb
→
app/services/clusters/gcp/kubernetes/create_
or_update_
service_account_service.rb
View file @
ba2d8a3f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
module
Clusters
module
Clusters
module
Gcp
module
Gcp
module
Kubernetes
module
Kubernetes
class
CreateServiceAccountService
class
Create
OrUpdate
ServiceAccountService
def
initialize
(
kubeclient
,
service_account_name
:,
service_account_namespace
:,
token_name
:,
rbac
:,
namespace_creator:
false
,
role_binding_name:
nil
)
def
initialize
(
kubeclient
,
service_account_name
:,
service_account_namespace
:,
token_name
:,
rbac
:,
namespace_creator:
false
,
role_binding_name:
nil
)
@kubeclient
=
kubeclient
@kubeclient
=
kubeclient
@service_account_name
=
service_account_name
@service_account_name
=
service_account_name
...
...
spec/services/clusters/gcp/kubernetes/create_or_update_namespace_service_spec.rb
View file @
ba2d8a3f
...
@@ -51,7 +51,7 @@ describe Clusters::Gcp::Kubernetes::CreateOrUpdateNamespaceService, '#execute' d
...
@@ -51,7 +51,7 @@ describe Clusters::Gcp::Kubernetes::CreateOrUpdateNamespaceService, '#execute' d
end
end
it
'creates project service account'
do
it
'creates project service account'
do
expect_any_instance_of
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
).
to
receive
(
:execute
).
once
expect_any_instance_of
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
).
to
receive
(
:execute
).
once
subject
subject
end
end
...
@@ -115,7 +115,7 @@ describe Clusters::Gcp::Kubernetes::CreateOrUpdateNamespaceService, '#execute' d
...
@@ -115,7 +115,7 @@ describe Clusters::Gcp::Kubernetes::CreateOrUpdateNamespaceService, '#execute' d
end
end
it
'creates project service account'
do
it
'creates project service account'
do
expect_any_instance_of
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
).
to
receive
(
:execute
).
once
expect_any_instance_of
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
).
to
receive
(
:execute
).
once
subject
subject
end
end
...
...
spec/services/clusters/gcp/kubernetes/create_service_account_service_spec.rb
→
spec/services/clusters/gcp/kubernetes/create_
or_update_
service_account_service_spec.rb
View file @
ba2d8a3f
# frozen_string_literal: true
# frozen_string_literal: true
require
'spec_helper'
require
'spec_helper'
describe
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
do
describe
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
do
include
KubernetesHelpers
include
KubernetesHelpers
let
(
:api_url
)
{
'http://111.111.111.111'
}
let
(
:api_url
)
{
'http://111.111.111.111'
}
...
...
spec/services/clusters/refresh_service_spec.rb
View file @
ba2d8a3f
...
@@ -5,11 +5,11 @@ require 'spec_helper'
...
@@ -5,11 +5,11 @@ require 'spec_helper'
describe
Clusters
::
RefreshService
do
describe
Clusters
::
RefreshService
do
shared_examples
'creates a kubernetes namespace'
do
shared_examples
'creates a kubernetes namespace'
do
let
(
:token
)
{
'aaaaaa'
}
let
(
:token
)
{
'aaaaaa'
}
let
(
:service_account_creator
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
,
execute:
true
)
}
let
(
:service_account_creator
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
,
execute:
true
)
}
let
(
:secrets_fetcher
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
,
execute:
token
)
}
let
(
:secrets_fetcher
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
,
execute:
token
)
}
it
'creates a kubernetes namespace'
do
it
'creates a kubernetes namespace'
do
expect
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
).
to
receive
(
:namespace_creator
).
and_return
(
service_account_creator
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
).
to
receive
(
:namespace_creator
).
and_return
(
service_account_creator
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
).
to
receive
(
:new
).
and_return
(
secrets_fetcher
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
).
to
receive
(
:new
).
and_return
(
secrets_fetcher
)
expect
{
subject
}.
to
change
(
project
.
kubernetes_namespaces
,
:count
)
expect
{
subject
}.
to
change
(
project
.
kubernetes_namespaces
,
:count
)
...
@@ -22,7 +22,7 @@ describe Clusters::RefreshService do
...
@@ -22,7 +22,7 @@ describe Clusters::RefreshService do
shared_examples
'does not create a kubernetes namespace'
do
shared_examples
'does not create a kubernetes namespace'
do
it
'does not create a new kubernetes namespace'
do
it
'does not create a new kubernetes namespace'
do
expect
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
).
not_to
receive
(
:namespace_creator
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
).
not_to
receive
(
:namespace_creator
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
).
not_to
receive
(
:new
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
).
not_to
receive
(
:new
)
expect
{
subject
}.
not_to
change
(
Clusters
::
KubernetesNamespace
,
:count
)
expect
{
subject
}.
not_to
change
(
Clusters
::
KubernetesNamespace
,
:count
)
...
...
spec/services/projects/create_service_spec.rb
View file @
ba2d8a3f
...
@@ -266,13 +266,13 @@ describe Projects::CreateService, '#execute' do
...
@@ -266,13 +266,13 @@ describe Projects::CreateService, '#execute' do
let
(
:group
)
{
group_cluster
.
group
}
let
(
:group
)
{
group_cluster
.
group
}
let
(
:token
)
{
'aaaa'
}
let
(
:token
)
{
'aaaa'
}
let
(
:service_account_creator
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
,
execute:
true
)
}
let
(
:service_account_creator
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
,
execute:
true
)
}
let
(
:secrets_fetcher
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
,
execute:
token
)
}
let
(
:secrets_fetcher
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
,
execute:
token
)
}
before
do
before
do
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
).
to
receive
(
:namespace_creator
).
and_return
(
service_account_creator
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
).
to
receive
(
:namespace_creator
).
and_return
(
service_account_creator
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
).
to
receive
(
:new
).
and_return
(
secrets_fetcher
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
).
to
receive
(
:new
).
and_return
(
secrets_fetcher
)
end
end
...
...
spec/services/projects/transfer_service_spec.rb
View file @
ba2d8a3f
...
@@ -68,13 +68,13 @@ describe Projects::TransferService do
...
@@ -68,13 +68,13 @@ describe Projects::TransferService do
let
(
:group
)
{
group_cluster
.
group
}
let
(
:group
)
{
group_cluster
.
group
}
let
(
:token
)
{
'aaaa'
}
let
(
:token
)
{
'aaaa'
}
let
(
:service_account_creator
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
,
execute:
true
)
}
let
(
:service_account_creator
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
,
execute:
true
)
}
let
(
:secrets_fetcher
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
,
execute:
token
)
}
let
(
:secrets_fetcher
)
{
double
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
,
execute:
token
)
}
subject
{
transfer_project
(
project
,
user
,
group
)
}
subject
{
transfer_project
(
project
,
user
,
group
)
}
before
do
before
do
expect
(
Clusters
::
Gcp
::
Kubernetes
::
CreateServiceAccountService
).
to
receive
(
:namespace_creator
).
and_return
(
service_account_creator
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
Create
OrUpdate
ServiceAccountService
).
to
receive
(
:namespace_creator
).
and_return
(
service_account_creator
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
).
to
receive
(
:new
).
and_return
(
secrets_fetcher
)
expect
(
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
).
to
receive
(
:new
).
and_return
(
secrets_fetcher
)
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