k8s-ruby2 0.10.8 → 2.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81cc0649baf215e8752b780d291c665e8ba3459d81ce833753f02acfb7d7433d
4
- data.tar.gz: '055386dc40656b18b56b8183a5a3349a8acdbe736bdd333e4ec68676c421b800'
3
+ metadata.gz: 1352b8de0b29904b27cfc252235172e90a67bfee6145e9d1d1a87d208dec367a
4
+ data.tar.gz: 7ec31822a14ad48427a384e098692c70506355efad0e5e6e02bb3dfcc4569d7b
5
5
  SHA512:
6
- metadata.gz: 77c3b7fd5108604d254aba24f67c84277a9025627c1a5fe7afd4d4f8ee77e3abe3a0be343f2e83d2e9a1a76854295bef8f1b8fe72b2b6fa7a10290326e7c9f0a
7
- data.tar.gz: a506f96d9ec9c60776da5f5a87a3a74b7aa17357a7511a0b9585aff2589f52ec5679539eaac2b1f3f0a575aa7fc57e7eb84c99f14022128c2b264f52010dc20e
6
+ metadata.gz: 698229faa98d24de265a2fe096e0b2a8ac8753f19148b5cf2448242e205604da434ab9fb5ca243fc690f5677362c21f52c849cef128c7c1b87dc4a1f43cb7c1b
7
+ data.tar.gz: 8a3e6037f97e1720b1a1125d55d7ae774b4c81b21781a890d2249f6dd118265250cf70016380fd8c1ed28563ff4cb4b6df40ff4914ddbf8f46a419ef618c0dc8
data/.gitignore CHANGED
@@ -6,8 +6,9 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
- Gemfile.lock
9
+
10
10
  .ruby-version
11
+ .tool-versions
11
12
  /.byebug_history
12
13
 
13
14
  # rspec failure tracking
data/Dockerfile CHANGED
@@ -1,10 +1,14 @@
1
- FROM ruby:2.4.3
1
+ ARG BASE_IMAGE=ruby:2.7
2
+ FROM ${BASE_IMAGE}
2
3
 
3
4
  WORKDIR /app
4
5
 
5
6
  COPY Gemfile *.gemspec ./
6
- COPY lib/k8s/client/version.rb ./lib/k8s/client/
7
+ COPY lib/k8s/ruby/version.rb ./lib/k8s/ruby/
8
+
9
+ RUN gem install bundler:2.3.5
7
10
  RUN bundle install
11
+ RUN bundle update --bundler
8
12
 
9
13
  COPY . .
10
14
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- k8s-ruby2 (0.10.8)
4
+ k8s-ruby2 (2.0.13)
5
5
  dry-struct (~> 1.4.0)
6
6
  dry-types (~> 1.5.0)
7
7
  excon (~> 0.78)
@@ -21,8 +21,8 @@ GEM
21
21
  concurrent-ruby (1.1.9)
22
22
  crack (0.4.5)
23
23
  rexml
24
- diff-lcs (1.4.4)
25
- dry-configurable (0.13.0)
24
+ diff-lcs (1.5.0)
25
+ dry-configurable (0.14.0)
26
26
  concurrent-ruby (~> 1.0)
27
27
  dry-core (~> 0.6)
28
28
  dry-container (0.9.0)
@@ -44,34 +44,34 @@ GEM
44
44
  dry-core (~> 0.5, >= 0.5)
45
45
  dry-inflector (~> 0.1, >= 0.1.2)
46
46
  dry-logic (~> 1.0, >= 1.0.2)
47
- excon (0.88.0)
47
+ excon (0.91.0)
48
48
  hashdiff (1.0.1)
49
49
  ice_nine (0.11.2)
50
50
  jsonpath (1.1.0)
51
51
  multi_json
52
52
  multi_json (1.15.0)
53
53
  parallel (1.21.0)
54
- parser (3.0.2.0)
54
+ parser (3.1.0.0)
55
55
  ast (~> 2.4.1)
56
56
  public_suffix (4.0.6)
57
- rainbow (3.0.0)
57
+ rainbow (3.1.1)
58
58
  rake (13.0.6)
59
59
  recursive-open-struct (1.1.3)
60
- regexp_parser (2.1.1)
60
+ regexp_parser (2.2.0)
61
61
  rexml (3.2.5)
62
- rspec (3.10.0)
63
- rspec-core (~> 3.10.0)
64
- rspec-expectations (~> 3.10.0)
65
- rspec-mocks (~> 3.10.0)
66
- rspec-core (3.10.1)
67
- rspec-support (~> 3.10.0)
68
- rspec-expectations (3.10.1)
62
+ rspec (3.11.0)
63
+ rspec-core (~> 3.11.0)
64
+ rspec-expectations (~> 3.11.0)
65
+ rspec-mocks (~> 3.11.0)
66
+ rspec-core (3.11.0)
67
+ rspec-support (~> 3.11.0)
68
+ rspec-expectations (3.11.0)
69
69
  diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.10.0)
71
- rspec-mocks (3.10.2)
70
+ rspec-support (~> 3.11.0)
71
+ rspec-mocks (3.11.0)
72
72
  diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.10.0)
74
- rspec-support (3.10.2)
73
+ rspec-support (~> 3.11.0)
74
+ rspec-support (3.11.0)
75
75
  rubocop (1.8.1)
76
76
  parallel (~> 1.10)
77
77
  parser (>= 3.0.0.0)
@@ -81,7 +81,7 @@ GEM
81
81
  rubocop-ast (>= 1.2.0, < 2.0)
82
82
  ruby-progressbar (~> 1.7)
83
83
  unicode-display_width (>= 1.4.0, < 3.0)
84
- rubocop-ast (1.12.0)
84
+ rubocop-ast (1.15.1)
85
85
  parser (>= 3.0.1.1)
86
86
  ruby-progressbar (1.11.0)
87
87
  unicode-display_width (2.1.0)
@@ -93,8 +93,7 @@ GEM
93
93
  yaml-safe_load_stream2 (0.1.1)
94
94
 
95
95
  PLATFORMS
96
- arm64-darwin-20
97
- x86_64-darwin-20
96
+ arm64-darwin-21
98
97
 
99
98
  DEPENDENCIES
100
99
  bundler (>= 1.17, < 3.0)
@@ -106,4 +105,4 @@ DEPENDENCIES
106
105
  webmock (~> 3.11.0)
107
106
 
108
107
  BUNDLED WITH
109
- 2.2.30
108
+ 2.3.7
data/README.md CHANGED
@@ -175,7 +175,7 @@ pods = client.api('v1').resource('pods', namespace: 'default').delete_collection
175
175
 
176
176
  #### Programmatically defined resources
177
177
  ```ruby
178
- service = K8s::Resource.new(
178
+ service = K8s::Resource.new({
179
179
  apiVersion: 'v1',
180
180
  kind: 'Service',
181
181
  metadata: {
@@ -189,7 +189,7 @@ service = K8s::Resource.new(
189
189
  ],
190
190
  selector: {'app' => 'test'},
191
191
  },
192
- )
192
+ })
193
193
 
194
194
  logger.info "Create service=#{service.metadata.name} in namespace=#{service.metadata.namespace}"
195
195
 
data/docker-compose.yaml CHANGED
@@ -1,10 +1,27 @@
1
- rspec:
2
- build: .
3
- volumes:
4
- - .:/app
5
- entrypoint: bundle exec rspec
6
- k8s-ruby:
7
- build: .
8
- volumes:
9
- - .:/app
10
- entrypoint: bundle exec bin/k8s-client
1
+ services:
2
+ rspec-2.6:
3
+ build:
4
+ context: .
5
+ args:
6
+ BASE_IMAGE: ruby:2.6
7
+ volumes:
8
+ - .:/app
9
+ entrypoint: bundle exec rspec
10
+
11
+ rspec-2.7:
12
+ build:
13
+ context: .
14
+ args:
15
+ BASE_IMAGE: ruby:2.7
16
+ volumes:
17
+ - .:/app
18
+ entrypoint: bundle exec rspec
19
+
20
+ rspec-3.0:
21
+ build:
22
+ context: .
23
+ args:
24
+ BASE_IMAGE: ruby:3.0
25
+ volumes:
26
+ - .:/app
27
+ entrypoint: bundle exec rspec
data/k8s-ruby2.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- lib = File.expand_path('lib', __dir__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "k8s/ruby/version"
4
4
 
data/lib/k8s/config.rb CHANGED
@@ -115,7 +115,12 @@ module K8s
115
115
  # @param path [String]
116
116
  # @return [K8s::Config]
117
117
  def self.load_file(path)
118
- new(YAML.safe_load(File.read(File.expand_path(path)), [Time, DateTime, Date], [], true))
118
+ new(YAML.safe_load(
119
+ File.read(File.expand_path(path)),
120
+ permitted_classes: [Time, DateTime, Date],
121
+ permitted_symbols: [],
122
+ aliases: true
123
+ ))
119
124
  end
120
125
 
121
126
  # Loads configuration files listed in KUBE_CONFIG environment variable and
data/lib/k8s/resource.rb CHANGED
@@ -40,17 +40,16 @@ module K8s
40
40
  end
41
41
 
42
42
  # @param hash [Hash]
43
- # @param recurse_over_arrays [Boolean]
44
43
  # @param options [Hash] see RecursiveOpenStruct#initialize
45
44
  def initialize(hash, options = {}, **kwargs)
46
45
  options_with_defaults = { recurse_over_arrays: true }.merge(options).merge(kwargs)
47
46
  super(hash, options_with_defaults)
48
47
  end
49
48
 
50
- # @param options [Hash] see Hash#to_json
49
+ # @param args [Array] see Hash#to_json
51
50
  # @return [String]
52
- def to_json(**options)
53
- to_hash.to_json(**options)
51
+ def to_json(*args, **options)
52
+ to_hash.to_json(*args, **options)
54
53
  end
55
54
 
56
55
  # @param other [K8s::Resource]
@@ -3,6 +3,6 @@
3
3
  module K8s
4
4
  class Ruby
5
5
  # Updated on releases using semver.
6
- VERSION = "0.10.8"
6
+ VERSION = "2.0.13"
7
7
  end
8
8
  end
data/lib/k8s/transport.rb CHANGED
@@ -91,10 +91,13 @@ module K8s
91
91
  new(server, **options, **overrides)
92
92
  end
93
93
 
94
- # @param auth_provider [K8s::Config::UserAuthProvider]
94
+ # @param auth_provider_config [K8s::Config::UserAuthProvider]
95
95
  # @return [String]
96
96
  def self.token_from_auth_provider_config(auth_provider_config)
97
+ return auth_provider_config['id-token'] if auth_provider_config['id-token']
98
+
97
99
  auth_data = `#{auth_provider_config['cmd-path']} #{auth_provider_config['cmd-args']}`.strip
100
+
98
101
  if auth_provider_config['token-key']
99
102
  json_path = JsonPath.new(auth_provider_config['token-key'][1...-1])
100
103
  json_path.first(auth_data)
@@ -133,8 +136,14 @@ module K8s
133
136
  port = ENV['KUBERNETES_SERVICE_PORT_HTTPS'].to_s
134
137
  raise(K8s::Error::Configuration, "in_cluster_config failed: KUBERNETES_SERVICE_PORT_HTTPS environment not set") if port.empty?
135
138
 
139
+ host_with_ipv6_brackets_if_needed = if host.include? "::"
140
+ "[#{host}]"
141
+ else
142
+ host
143
+ end
144
+
136
145
  new(
137
- "https://#{host}:#{port}",
146
+ "https://#{host_with_ipv6_brackets_if_needed}:#{port}",
138
147
  ssl_verify_peer: options.key?(:ssl_verify_peer) ? options.delete(:ssl_verify_peer) : true,
139
148
  ssl_ca_file: options.delete(:ssl_ca_file) || File.join((ENV['TELEPRESENCE_ROOT'] || '/'), 'var/run/secrets/kubernetes.io/serviceaccount/ca.crt'),
140
149
  auth_token: options.delete(:auth_token) || File.read(File.join((ENV['TELEPRESENCE_ROOT'] || '/'), 'var/run/secrets/kubernetes.io/serviceaccount/token')),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k8s-ruby2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.8
4
+ version: 2.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - rdx.net
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-10-30 00:00:00.000000000 Z
12
+ date: 2022-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-struct
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  - !ruby/object:Gem::Version
273
273
  version: '0'
274
274
  requirements: []
275
- rubygems_version: 3.2.22
275
+ rubygems_version: 3.3.3
276
276
  signing_key:
277
277
  specification_version: 4
278
278
  summary: Kubernetes client library for Ruby