k8s-client 0.9.0 → 0.10.0

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: f0648161976a34f538f314a5f5ac7509779c1df4
4
- data.tar.gz: e771af2d29bf02f3abaad33cb4ac6be17854bf07
3
+ metadata.gz: fe5285594d28e6f112fe34e988cbd981c1cba982
4
+ data.tar.gz: 62512ffc4b9619d55a1b944bfd2c7d22ef5ba9a3
5
5
  SHA512:
6
- metadata.gz: 1ca57fc419c30157b69392a63df5ca8ef5dd64600124ad2c292f2e58ae4b08a0ab89219e5fb732dd5472cb1d70ebbe22309a168051d88b8cb1e676da807db537
7
- data.tar.gz: 3591b8d176c5423cb5f2ed78f24feb571e2bf9f33e0b295296097edfb41ba8cd4a4942f2603d917afc995c464f115fb3dae690b59ed39bbe3937fe84e83c6362
6
+ metadata.gz: 02e79f42d225490c54aeb855f526cd3ddbcb71a5e266c1438734ae7839fc2716a7eadf0f44b556279a69d38acb9fe6037a98f5b7bbf16ba165a50467afa21e5b
7
+ data.tar.gz: 534208a895291ebac3d6f831db8513c85f52a73396689be0e254568913cc6bfa527e212b198ae52109e444873469b2a5dfc24298ce9ed528b3d3e5e434e1045a
@@ -4,6 +4,7 @@ require 'openssl'
4
4
  require 'base64'
5
5
  require 'yajl'
6
6
  require 'monitor'
7
+ require 'uri'
7
8
 
8
9
  require 'k8s/util'
9
10
 
@@ -3,6 +3,6 @@
3
3
  module K8s
4
4
  class Client
5
5
  # Updated on releases using semver.
6
- VERSION = "0.9.0"
6
+ VERSION = "0.10.0"
7
7
  end
8
8
  end
@@ -142,15 +142,17 @@ module K8s
142
142
  )
143
143
  end
144
144
 
145
- attr_reader :server, :options
145
+ attr_reader :server, :options, :path_prefix
146
146
 
147
- # @param server [String] URL with protocol://host:port - any /path is ignored
147
+ # @param server [String] URL with protocol://host:port (paths are preserved as well)
148
148
  # @param auth_token [String] optional Authorization: Bearer token
149
149
  # @param auth_username [String] optional Basic authentication username
150
150
  # @param auth_password [String] optional Basic authentication password
151
151
  # @param options [Hash] @see Excon.new
152
152
  def initialize(server, auth_token: nil, auth_username: nil, auth_password: nil, **options)
153
- @server = server
153
+ uri = URI.parse(server)
154
+ @server = "#{uri.scheme}://#{uri.host}:#{uri.port}"
155
+ @path_prefix = File.join('/', uri.path, '/') # add leading and/or trailing slashes
154
156
  @auth_token = auth_token
155
157
  @auth_username = auth_username
156
158
  @auth_password = auth_password
@@ -175,10 +177,10 @@ module K8s
175
177
  )
176
178
  end
177
179
 
178
- # @param path [Array<String>] join path parts together to build the full URL
180
+ # @param parts [Array<String>] join path parts together to build the full URL
179
181
  # @return [String]
180
- def path(*path)
181
- File.join('/', *path)
182
+ def path(*parts)
183
+ File.join(path_prefix, *parts)
182
184
  end
183
185
 
184
186
  # @param request_object [Object] include request body using to_json
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.9.0
4
+ version: 0.10.0
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-05-02 00:00:00.000000000 Z
11
+ date: 2019-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon