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
58566637
Commit
58566637
authored
Dec 15, 2019
by
Tan Yee Jian
Committed by
Thong Kuah
Dec 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify default GKE OAuth Scopes
to minimally allow pulling images from private registry.
parent
f51fece8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
changelogs/unreleased/gke-oauth.yml
changelogs/unreleased/gke-oauth.yml
+5
-0
lib/google_api/cloud_platform/client.rb
lib/google_api/cloud_platform/client.rb
+14
-4
spec/lib/google_api/cloud_platform/client_spec.rb
spec/lib/google_api/cloud_platform/client_spec.rb
+6
-1
No files found.
changelogs/unreleased/gke-oauth.yml
0 → 100644
View file @
58566637
---
title
:
Allow Gitlab GKE clusters to access Google Cloud Registry private images
merge_request
:
20662
author
:
Tan Yee Jian
type
:
fixed
lib/google_api/cloud_platform/client.rb
View file @
58566637
...
...
@@ -13,6 +13,11 @@ module GoogleApi
LEAST_TOKEN_LIFE_TIME
=
10
.
minutes
CLUSTER_MASTER_AUTH_USERNAME
=
'admin'
CLUSTER_IPV4_CIDR_BLOCK
=
'/16'
CLUSTER_OAUTH_SCOPES
=
[
"https://www.googleapis.com/auth/devstorage.read_only"
,
"https://www.googleapis.com/auth/logging.write"
,
"https://www.googleapis.com/auth/monitoring"
].
freeze
class
<<
self
def
session_key_for_token
...
...
@@ -86,7 +91,8 @@ module GoogleApi
name:
cluster_name
,
initial_node_count:
cluster_size
,
node_config:
{
machine_type:
machine_type
machine_type:
machine_type
,
oauth_scopes:
CLUSTER_OAUTH_SCOPES
},
master_auth:
{
username:
CLUSTER_MASTER_AUTH_USERNAME
,
...
...
@@ -101,13 +107,17 @@ module GoogleApi
use_ip_aliases:
true
,
cluster_ipv4_cidr_block:
CLUSTER_IPV4_CIDR_BLOCK
},
addons_config:
enable_addons
.
each_with_object
({})
do
|
addon
,
hash
|
hash
[
addon
]
=
{
disabled:
false
}
end
addons_config:
make_addons_config
(
enable_addons
)
}
}
end
def
make_addons_config
(
enable_addons
)
enable_addons
.
each_with_object
({})
do
|
addon
,
hash
|
hash
[
addon
]
=
{
disabled:
false
}
end
end
def
token_life_time
(
expires_at
)
DateTime
.
strptime
(
expires_at
,
'%s'
).
to_time
.
utc
-
Time
.
now
.
utc
end
...
...
spec/lib/google_api/cloud_platform/client_spec.rb
View file @
58566637
...
...
@@ -92,7 +92,12 @@ describe GoogleApi::CloudPlatform::Client do
name:
cluster_name
,
initial_node_count:
cluster_size
,
node_config:
{
machine_type:
machine_type
machine_type:
machine_type
,
oauth_scopes:
[
"https://www.googleapis.com/auth/devstorage.read_only"
,
"https://www.googleapis.com/auth/logging.write"
,
"https://www.googleapis.com/auth/monitoring"
]
},
master_auth:
{
username:
'admin'
,
...
...
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