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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 18685c17f11d9b22cd78b7ec8931ada4e58feb72
4
- data.tar.gz: 7f1d403748d95d72641a414936b568197b24c058
2
+ SHA256:
3
+ metadata.gz: 19eea2ff84c28a9aee67c104cb56b68ccfc8ca005293541064ca214efb5a662e
4
+ data.tar.gz: 76be6aea1d087cf89c61517648eb22bde5a4fe65f5ce78d64d9fc74cd3c5e583
5
5
  SHA512:
6
- metadata.gz: 42103f4da761437771a1af304462d68111cb9e33db4514f31ae58e68f341896f628d7aea4ac5b8368e10c42426a7f04b4186e7fd28fd22ca0bc8638146954f0a
7
- data.tar.gz: 98d9905892a6282bb6a3850beb5a2bc84fcb5179127e5d937bc2983b40601ffa71dadd458395cb7f9e77900793160d7c2921b3a36942cb3c8387883e58379b91
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.64.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.3.7'
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.4.2"
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
- elsif File.exist?(File.join(Dir.home, '.kube', 'config'))
86
- configuration = K8s::Config.load_file(File.join(Dir.home, '.kube', 'config'))
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
@@ -3,6 +3,6 @@
3
3
  module K8s
4
4
  class Client
5
5
  # Updated on releases using semver.
6
- VERSION = "0.10.2"
6
+ VERSION = "0.10.3"
7
7
  end
8
8
  end
data/lib/k8s/config.rb CHANGED
@@ -175,7 +175,6 @@ module K8s
175
175
  when NilClass
176
176
  new_value
177
177
  else
178
- warn "key is #{key} old val is #{old_value.inspect} and new val is #{new_value.inspect}"
179
178
  old_value
180
179
  end
181
180
  end
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: KUBERNETES_SERVICE_HOST environment not set") if port.empty?
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(path_prefix, *parts)
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 = HashDiff.diff(patch_to, patch_from, array_path: true)
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.2
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-06-28 00:00:00.000000000 Z
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.64.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.64.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.3.7
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.3.7
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.4.2
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.4.2
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
- rubyforge_project:
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
-