kubernetes-deploy 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d4d12495a2c45feea06818619b789fe435c9458
|
4
|
+
data.tar.gz: be4b5c1fd86dd89e61ff4c209325dd355a9c4ca6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbc9a37c932a11084c881b5333bb32d2d86500095c704f0a17ad2e0d53331f91105b4f0afbe5134a30f244fdce6b53b48cc9e43f8005d6c6bcfc4ed6ff59c29a
|
7
|
+
data.tar.gz: 3910718f3c377f15a88e478211c1ebc25a9ba365af017405f7999f1c0a2fcdf14f43b0b348d900666640200a623baaef2b3c37149d32ccee83f75246e6130cd5
|
data/kubernetes-deploy.gemspec
CHANGED
@@ -22,9 +22,11 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
spec.add_dependency "activesupport", ">= 4.2"
|
24
24
|
spec.add_dependency "kubeclient", "~> 2.3"
|
25
|
+
spec.add_dependency "googleauth", ">= 0.5"
|
25
26
|
|
26
27
|
spec.add_development_dependency "bundler", "~> 1.13"
|
27
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
29
|
spec.add_development_dependency "minitest", "~> 5.0"
|
29
30
|
spec.add_development_dependency "minitest-stub-const", "~> 0.6"
|
31
|
+
spec.add_development_dependency "webmock", "~> 3.0"
|
30
32
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'kubeclient'
|
3
|
+
require 'kubernetes-deploy/kubeclient_builder/google_friendly_config'
|
3
4
|
|
4
5
|
module KubernetesDeploy
|
5
6
|
module KubeclientBuilder
|
@@ -28,7 +29,7 @@ module KubernetesDeploy
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def _build_kubeclient(api_version:, context:, endpoint_path: nil)
|
31
|
-
config =
|
32
|
+
config = GoogleFriendlyConfig.read(ENV.fetch("KUBECONFIG"))
|
32
33
|
unless config.contexts.include?(context)
|
33
34
|
raise ContextMissingError, context
|
34
35
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'googleauth'
|
4
|
+
module KubernetesDeploy
|
5
|
+
module KubeclientBuilder
|
6
|
+
class GoogleFriendlyConfig < Kubeclient::Config
|
7
|
+
def fetch_user_auth_options(user)
|
8
|
+
if user['auth-provider'] && (user['auth-provider']['name'] == 'gcp')
|
9
|
+
{ bearer_token: new_token }
|
10
|
+
else
|
11
|
+
super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.read(filename)
|
16
|
+
new(YAML.load_file(filename), File.dirname(filename))
|
17
|
+
end
|
18
|
+
|
19
|
+
def new_token
|
20
|
+
scopes = ['https://www.googleapis.com/auth/cloud-platform']
|
21
|
+
authorization = Google::Auth.get_application_default(scopes)
|
22
|
+
|
23
|
+
authorization.apply({})
|
24
|
+
|
25
|
+
authorization.access_token
|
26
|
+
|
27
|
+
rescue Signet::AuthorizationError => e
|
28
|
+
err_message = json_error_message(e.response.body) || e.message
|
29
|
+
raise KubeException.new(e.response.status, err_message, e.response.body)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def json_error_message(body)
|
35
|
+
json_error_msg = begin
|
36
|
+
JSON.parse(body || '') || {}
|
37
|
+
rescue JSON::ParserError
|
38
|
+
{}
|
39
|
+
end
|
40
|
+
json_error_msg['message']
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubernetes-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kir Shatrov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-05-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '2.3'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: googleauth
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.5'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.5'
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: bundler
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,6 +110,20 @@ dependencies:
|
|
96
110
|
- - "~>"
|
97
111
|
- !ruby/object:Gem::Version
|
98
112
|
version: '0.6'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: webmock
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '3.0'
|
99
127
|
description: Kubernetes deploy scripts
|
100
128
|
email:
|
101
129
|
- ops-accounts+shipit@shopify.com
|
@@ -120,6 +148,7 @@ files:
|
|
120
148
|
- kubernetes-deploy.gemspec
|
121
149
|
- lib/kubernetes-deploy.rb
|
122
150
|
- lib/kubernetes-deploy/kubeclient_builder.rb
|
151
|
+
- lib/kubernetes-deploy/kubeclient_builder/google_friendly_config.rb
|
123
152
|
- lib/kubernetes-deploy/kubectl.rb
|
124
153
|
- lib/kubernetes-deploy/kubernetes_resource.rb
|
125
154
|
- lib/kubernetes-deploy/kubernetes_resource/bugsnag.rb
|
@@ -159,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
188
|
version: '0'
|
160
189
|
requirements: []
|
161
190
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
191
|
+
rubygems_version: 2.4.5.1
|
163
192
|
signing_key:
|
164
193
|
specification_version: 4
|
165
194
|
summary: Kubernetes deploy scripts
|