k8s-client 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/k8s-client.gemspec +3 -3
- data/lib/k8s/client.rb +8 -2
- data/lib/k8s/client/version.rb +1 -1
- data/lib/k8s/config.rb +0 -1
- data/lib/k8s/transport.rb +3 -2
- data/lib/k8s/util.rb +1 -1
- metadata +9 -11
- data/lib/k8s/foo.yaml +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 19eea2ff84c28a9aee67c104cb56b68ccfc8ca005293541064ca214efb5a662e
|
4
|
+
data.tar.gz: 76be6aea1d087cf89c61517648eb22bde5a4fe65f5ce78d64d9fc74cd3c5e583
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ca77d99c0d84a9d2bc5786b65cbfafefb819f815d93ca1221219ebc6ee3a85a046ac52f3f9c948c3a18de227dbd5c7c27f1eb30e41670cc9e7144f73b5cfc8
|
7
|
+
data.tar.gz: 96f48718e9a6747ace8bdfabddf3895b90c47f98dd4aa5c84e5840c0ab6105b7e91662084c42dd13aa92471900a645628d6526f6808aa7b414415c6020431ba1
|
data/k8s-client.gemspec
CHANGED
@@ -23,11 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
spec.required_ruby_version = '~> 2.4'
|
25
25
|
|
26
|
-
spec.add_runtime_dependency "excon", "~> 0.
|
26
|
+
spec.add_runtime_dependency "excon", "~> 0.66"
|
27
27
|
spec.add_runtime_dependency "dry-struct", "~> 0.5.0"
|
28
28
|
spec.add_runtime_dependency "dry-types", "~> 0.13.0"
|
29
29
|
spec.add_runtime_dependency "recursive-open-struct", "~> 1.1.0"
|
30
|
-
spec.add_runtime_dependency 'hashdiff', '~> 0.
|
30
|
+
spec.add_runtime_dependency 'hashdiff', '~> 1.0.0'
|
31
31
|
spec.add_runtime_dependency 'jsonpath', '~> 0.9.5'
|
32
32
|
spec.add_runtime_dependency 'yajl-ruby', '~> 1.4.0'
|
33
33
|
spec.add_runtime_dependency "yaml-safe_load_stream", "~> 0.1"
|
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "bundler", ">= 1.17", "< 3.0"
|
36
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
37
37
|
spec.add_development_dependency "rspec", "~> 3.7"
|
38
|
-
spec.add_development_dependency "webmock", "~> 3.
|
38
|
+
spec.add_development_dependency "webmock", "~> 3.6.2"
|
39
39
|
spec.add_development_dependency "rubocop", "~> 0.59"
|
40
40
|
end
|
data/lib/k8s/client.rb
CHANGED
@@ -82,8 +82,14 @@ module K8s
|
|
82
82
|
configuration = K8s::Config.build(server: ENV['KUBE_SERVER'], ca: ENV['KUBE_CA'], auth_token: token)
|
83
83
|
elsif !ENV['KUBECONFIG'].to_s.empty?
|
84
84
|
configuration = K8s::Config.from_kubeconfig_env(ENV['KUBECONFIG'])
|
85
|
-
|
86
|
-
|
85
|
+
else
|
86
|
+
found_config = [
|
87
|
+
File.join(Dir.home, '.kube', 'config'),
|
88
|
+
'/etc/kubernetes/admin.conf',
|
89
|
+
'/etc/kubernetes/kubelet.conf'
|
90
|
+
].find { |f| File.exist?(f) && File.readable?(f) }
|
91
|
+
|
92
|
+
configuration = K8s::Config.load_file(found_config) if found_config
|
87
93
|
end
|
88
94
|
|
89
95
|
if configuration
|
data/lib/k8s/client/version.rb
CHANGED
data/lib/k8s/config.rb
CHANGED
data/lib/k8s/transport.rb
CHANGED
@@ -131,7 +131,7 @@ module K8s
|
|
131
131
|
raise(K8s::Error::Configuration, "in_cluster_config failed: KUBERNETES_SERVICE_HOST environment not set") if host.empty?
|
132
132
|
|
133
133
|
port = ENV['KUBERNETES_SERVICE_PORT_HTTPS'].to_s
|
134
|
-
raise(K8s::Error::Configuration, "in_cluster_config failed:
|
134
|
+
raise(K8s::Error::Configuration, "in_cluster_config failed: KUBERNETES_SERVICE_PORT_HTTPS environment not set") if port.empty?
|
135
135
|
|
136
136
|
new(
|
137
137
|
"https://#{host}:#{port}",
|
@@ -180,7 +180,8 @@ module K8s
|
|
180
180
|
# @param parts [Array<String>] join path parts together to build the full URL
|
181
181
|
# @return [String]
|
182
182
|
def path(*parts)
|
183
|
-
File.join(
|
183
|
+
joined_parts = File.join(*parts)
|
184
|
+
joined_parts.start_with?(path_prefix) ? joined_parts : File.join(path_prefix, joined_parts)
|
184
185
|
end
|
185
186
|
|
186
187
|
# @param request_object [Object] include request body using to_json
|
data/lib/k8s/util.rb
CHANGED
@@ -98,7 +98,7 @@ module K8s
|
|
98
98
|
# @param patch_to [Hash] Hash to compute patches against
|
99
99
|
# @param patch_from [Hash] New Hash to compute patches "from"
|
100
100
|
def self.json_patch(patch_to, patch_from)
|
101
|
-
diffs =
|
101
|
+
diffs = Hashdiff.diff(patch_to, patch_from, array_path: true)
|
102
102
|
ops = []
|
103
103
|
# Each diff is like:
|
104
104
|
# ["+", ["spec", "selector", "food"], "kebab"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k8s-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kontena, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.66'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.66'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dry-struct
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 1.0.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 1.0.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: jsonpath
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,14 +176,14 @@ dependencies:
|
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: 3.
|
179
|
+
version: 3.6.2
|
180
180
|
type: :development
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: 3.
|
186
|
+
version: 3.6.2
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
188
|
name: rubocop
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,7 +233,6 @@ files:
|
|
233
233
|
- lib/k8s/client/version.rb
|
234
234
|
- lib/k8s/config.rb
|
235
235
|
- lib/k8s/error.rb
|
236
|
-
- lib/k8s/foo.yaml
|
237
236
|
- lib/k8s/logging.rb
|
238
237
|
- lib/k8s/resource.rb
|
239
238
|
- lib/k8s/resource_client.rb
|
@@ -259,8 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
258
|
- !ruby/object:Gem::Version
|
260
259
|
version: '0'
|
261
260
|
requirements: []
|
262
|
-
|
263
|
-
rubygems_version: 2.6.14.4
|
261
|
+
rubygems_version: 3.0.3
|
264
262
|
signing_key:
|
265
263
|
specification_version: 4
|
266
264
|
summary: Kubernetes client library
|
data/lib/k8s/foo.yaml
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
apiVersion: v1
|
2
|
-
kind: Pod
|
3
|
-
metadata:
|
4
|
-
name: myapp
|
5
|
-
spec:
|
6
|
-
containers:
|
7
|
-
- name: myapp
|
8
|
-
image: docker.io/nginx/:1-alpine
|
9
|
-
resources:
|
10
|
-
limits:
|
11
|
-
memory: "10Mi"
|
12
|
-
cpu: "100m"
|
13
|
-
|
14
|
-
---
|
15
|
-
|
16
|
-
apiVersion: v1
|
17
|
-
kind: Pod
|
18
|
-
metadata:
|
19
|
-
name: myapp
|
20
|
-
labels: {}
|
21
|
-
spec:
|
22
|
-
containers:
|
23
|
-
- name: myapp
|
24
|
-
image: docker.io/nginx/:1-alpine
|
25
|
-
resources:
|
26
|
-
limits:
|
27
|
-
memory: "10Mi"
|
28
|
-
cpu: "100m"
|
29
|
-
ports: []
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|