k8s-ruby2 0.10.8 → 2.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Dockerfile +6 -2
- data/Gemfile.lock +21 -22
- data/README.md +2 -2
- data/docker-compose.yaml +27 -10
- data/k8s-ruby2.gemspec +1 -1
- data/lib/k8s/config.rb +6 -1
- data/lib/k8s/resource.rb +3 -4
- data/lib/k8s/ruby/version.rb +1 -1
- data/lib/k8s/transport.rb +11 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1352b8de0b29904b27cfc252235172e90a67bfee6145e9d1d1a87d208dec367a
|
4
|
+
data.tar.gz: 7ec31822a14ad48427a384e098692c70506355efad0e5e6e02bb3dfcc4569d7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 698229faa98d24de265a2fe096e0b2a8ac8753f19148b5cf2448242e205604da434ab9fb5ca243fc690f5677362c21f52c849cef128c7c1b87dc4a1f43cb7c1b
|
7
|
+
data.tar.gz: 8a3e6037f97e1720b1a1125d55d7ae774b4c81b21781a890d2249f6dd118265250cf70016380fd8c1ed28563ff4cb4b6df40ff4914ddbf8f46a419ef618c0dc8
|
data/.gitignore
CHANGED
data/Dockerfile
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
|
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/
|
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.
|
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.
|
25
|
-
dry-configurable (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.
|
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.
|
54
|
+
parser (3.1.0.0)
|
55
55
|
ast (~> 2.4.1)
|
56
56
|
public_suffix (4.0.6)
|
57
|
-
rainbow (3.
|
57
|
+
rainbow (3.1.1)
|
58
58
|
rake (13.0.6)
|
59
59
|
recursive-open-struct (1.1.3)
|
60
|
-
regexp_parser (2.
|
60
|
+
regexp_parser (2.2.0)
|
61
61
|
rexml (3.2.5)
|
62
|
-
rspec (3.
|
63
|
-
rspec-core (~> 3.
|
64
|
-
rspec-expectations (~> 3.
|
65
|
-
rspec-mocks (~> 3.
|
66
|
-
rspec-core (3.
|
67
|
-
rspec-support (~> 3.
|
68
|
-
rspec-expectations (3.
|
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.
|
71
|
-
rspec-mocks (3.
|
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.
|
74
|
-
rspec-support (3.
|
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.
|
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-
|
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.
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
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(
|
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
|
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]
|
data/lib/k8s/ruby/version.rb
CHANGED
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
|
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://#{
|
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.
|
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:
|
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.
|
275
|
+
rubygems_version: 3.3.3
|
276
276
|
signing_key:
|
277
277
|
specification_version: 4
|
278
278
|
summary: Kubernetes client library for Ruby
|