diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-15 21:07:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-15 21:07:47 +0000 |
commit | 8a04ac238cdbe9aa804c5f145207baa67403eadd (patch) | |
tree | acaea6622650af7f6192981f220414e5f51eac97 /lib/google_api | |
parent | 86944cb975cbcdac9d68966454cc9859e4469af1 (diff) | |
download | gitlab-ce-8a04ac238cdbe9aa804c5f145207baa67403eadd.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/google_api')
-rw-r--r-- | lib/google_api/cloud_platform/client.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb index 99029b54a69..9668badc757 100644 --- a/lib/google_api/cloud_platform/client.rb +++ b/lib/google_api/cloud_platform/client.rb @@ -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 |