k8s-ruby 0.11.0 → 0.12.0
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 +4 -4
- data/.gitignore +1 -0
- data/Dockerfile +1 -1
- data/README.md +2 -2
- data/docker-compose.yaml +9 -9
- data/k8s-ruby.gemspec +11 -10
- data/lib/k8s/api/metav1/api_resource.rb +2 -2
- data/lib/k8s/api/metav1/object.rb +2 -2
- data/lib/k8s/api.rb +1 -1
- data/lib/k8s/config.rb +6 -6
- data/lib/k8s/resource.rb +6 -9
- data/lib/k8s/ruby/version.rb +1 -1
- data/lib/k8s/transport.rb +2 -5
- metadata +27 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 462575bda9c48588eb7d9d9d1ffda32c973ebdbf0b3d9113a7b8a2fdd94b781f
|
4
|
+
data.tar.gz: 2a593329f6040478517bc2895d1cf4929a19f728fd97ceb696e538dfb0de161e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ca53f957316cfc8b8fa38988e5637e85e110c8772601c6ad591a711486393d7ed530bfd86b6840bd8156bab9bf4299f5547963e825a5b1ee4c5835d95d8c0ae
|
7
|
+
data.tar.gz: b5ad610fadaa524f603e90b5c027bd6f17dc9005dc70785467a5ef50e59ae73aebf4c1962f0202f8221b070927c480286725baab366cfa888d7b1a9a76036b39
|
data/.gitignore
CHANGED
data/Dockerfile
CHANGED
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
@@ -16,12 +16,12 @@ services:
|
|
16
16
|
volumes:
|
17
17
|
- .:/app
|
18
18
|
entrypoint: bundle exec rspec
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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-ruby.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
lib = File.expand_path("
|
2
|
+
lib = File.expand_path("lib", __dir__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require "k8s/ruby/version"
|
5
5
|
|
@@ -15,22 +15,23 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
# Specify which files should be added to the gem when it is released.
|
17
17
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path(
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
19
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
20
|
end
|
21
21
|
spec.bindir = "bin"
|
22
22
|
spec.executables = []
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
-
spec.required_ruby_version =
|
24
|
+
spec.required_ruby_version = [">= 2.4", "< 3.1"]
|
25
25
|
|
26
26
|
spec.add_runtime_dependency "excon", "~> 0.71"
|
27
|
-
spec.add_runtime_dependency "dry-struct", "~>
|
28
|
-
spec.add_runtime_dependency "dry-types", "~>
|
29
|
-
spec.add_runtime_dependency "
|
30
|
-
spec.add_runtime_dependency
|
31
|
-
spec.add_runtime_dependency
|
32
|
-
spec.add_runtime_dependency
|
33
|
-
spec.add_runtime_dependency "
|
27
|
+
spec.add_runtime_dependency "dry-struct", "~> 1.3.0"
|
28
|
+
spec.add_runtime_dependency "dry-types", "~> 1.4.0"
|
29
|
+
spec.add_runtime_dependency "dry-configurable", "~> 0.13.0"
|
30
|
+
spec.add_runtime_dependency "recursive-open-struct", "~> 1.1.3"
|
31
|
+
spec.add_runtime_dependency "hashdiff", "~> 1.0.0"
|
32
|
+
spec.add_runtime_dependency "jsonpath", "~> 0.9.5"
|
33
|
+
spec.add_runtime_dependency "yajl-ruby", "~> 1.4.0"
|
34
|
+
spec.add_runtime_dependency "yaml-safe_load_stream2", "~> 0.1.1"
|
34
35
|
|
35
36
|
spec.add_development_dependency "bundler", ">= 1.17", "< 3.0"
|
36
37
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
@@ -12,8 +12,8 @@ module K8s
|
|
12
12
|
attribute :version, Types::Strict::String.optional.default(nil)
|
13
13
|
attribute :kind, Types::Strict::String
|
14
14
|
attribute :verbs, Types::Strict::Array.of(Types::Strict::String)
|
15
|
-
attribute :shortNames, Types::Strict::Array.of(Types::Strict::String).optional.default(proc { [] })
|
16
|
-
attribute :categories, Types::Strict::Array.of(Types::Strict::String).optional.default(proc { [] })
|
15
|
+
attribute :shortNames, Types::Strict::Array.of(Types::Strict::String).optional.default(proc { [] }, shared: true)
|
16
|
+
attribute :categories, Types::Strict::Array.of(Types::Strict::String).optional.default(proc { [] }, shared: true)
|
17
17
|
end
|
18
18
|
|
19
19
|
# @see https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#APIResourceList
|
@@ -38,9 +38,9 @@ module K8s
|
|
38
38
|
attribute :deletionGracePeriodSeconds, Types::Strict::Integer.optional.default(nil)
|
39
39
|
attribute :labels, Types::Strict::Hash.map(Types::Strict::String, Types::Strict::String).optional.default(nil)
|
40
40
|
attribute :annotations, Types::Strict::Hash.map(Types::Strict::String, Types::Strict::String).optional.default(nil)
|
41
|
-
attribute :ownerReferences, Types::Strict::Array.of(OwnerReference).optional.default([])
|
41
|
+
attribute :ownerReferences, Types::Strict::Array.of(OwnerReference).optional.default([], shared: true)
|
42
42
|
attribute :initializers, Initializers.optional.default(nil)
|
43
|
-
attribute :finalizers, Types::Strict::Array.of(Types::Strict::String).optional.default([])
|
43
|
+
attribute :finalizers, Types::Strict::Array.of(Types::Strict::String).optional.default([], shared: true)
|
44
44
|
attribute :clusterName, Types::Strict::String.optional.default(nil)
|
45
45
|
end
|
46
46
|
|
data/lib/k8s/api.rb
CHANGED
data/lib/k8s/config.rb
CHANGED
@@ -25,7 +25,7 @@ module K8s
|
|
25
25
|
class Config < ConfigStruct
|
26
26
|
# Common dry-types for config
|
27
27
|
class Types
|
28
|
-
include Dry::Types
|
28
|
+
include Dry::Types()
|
29
29
|
end
|
30
30
|
|
31
31
|
# structured cluster
|
@@ -99,12 +99,12 @@ module K8s
|
|
99
99
|
|
100
100
|
attribute :kind, Types::Strict::String.optional.default(nil)
|
101
101
|
attribute :apiVersion, Types::Strict::String.optional.default(nil)
|
102
|
-
attribute :preferences, Types::Strict::Hash.optional.default(proc { {} })
|
103
|
-
attribute :clusters, Types::Strict::Array.of(NamedCluster).optional.default(proc { [] })
|
104
|
-
attribute :users, Types::Strict::Array.of(NamedUser).optional.default(proc { [] })
|
105
|
-
attribute :contexts, Types::Strict::Array.of(NamedContext).optional.default(proc { [] })
|
102
|
+
attribute :preferences, Types::Strict::Hash.optional.default(proc { {} }, shared: true)
|
103
|
+
attribute :clusters, Types::Strict::Array.of(NamedCluster).optional.default(proc { [] }, shared: true)
|
104
|
+
attribute :users, Types::Strict::Array.of(NamedUser).optional.default(proc { [] }, shared: true)
|
105
|
+
attribute :contexts, Types::Strict::Array.of(NamedContext).optional.default(proc { [] }, shared: true)
|
106
106
|
attribute :current_context, Types::Strict::String.optional.default(nil)
|
107
|
-
attribute :extensions, Types::Strict::Array.optional.default(proc { [] })
|
107
|
+
attribute :extensions, Types::Strict::Array.optional.default(proc { [] }, shared: true)
|
108
108
|
|
109
109
|
# Loads a configuration from a YAML file
|
110
110
|
#
|
data/lib/k8s/resource.rb
CHANGED
@@ -40,19 +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
|
-
def initialize(hash,
|
46
|
-
|
47
|
-
|
48
|
-
**options
|
49
|
-
)
|
44
|
+
def initialize(hash, options = {})
|
45
|
+
options_with_defaults = { recurse_over_arrays: true }.merge(options)
|
46
|
+
super(hash, options_with_defaults)
|
50
47
|
end
|
51
48
|
|
52
|
-
# @param
|
49
|
+
# @param args [Array] see Hash#to_json
|
53
50
|
# @return [String]
|
54
|
-
def to_json(**options)
|
55
|
-
to_hash.to_json(**options)
|
51
|
+
def to_json(*args, **options)
|
52
|
+
to_hash.to_json(*args, **options)
|
56
53
|
end
|
57
54
|
|
58
55
|
# @param other [K8s::Resource]
|
data/lib/k8s/ruby/version.rb
CHANGED
data/lib/k8s/transport.rb
CHANGED
@@ -370,11 +370,8 @@ module K8s
|
|
370
370
|
# @param options [Hash] @see #request
|
371
371
|
# @return [Array<response_class, Hash, NilClass>]
|
372
372
|
def get(*path, **options)
|
373
|
-
|
374
|
-
|
375
|
-
path: self.path(*path),
|
376
|
-
**options
|
377
|
-
)
|
373
|
+
options = options.merge({ method: 'GET', path: self.path(*path) })
|
374
|
+
request(**options)
|
378
375
|
end
|
379
376
|
|
380
377
|
# @param paths [Array<String>]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k8s-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
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: 2022-01-
|
12
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
@@ -31,16 +31,30 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 1.3.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 1.3.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: dry-types
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.4.0
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.4.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: dry-configurable
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
60
|
- - "~>"
|
@@ -59,14 +73,14 @@ dependencies:
|
|
59
73
|
requirements:
|
60
74
|
- - "~>"
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.1.
|
76
|
+
version: 1.1.3
|
63
77
|
type: :runtime
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.1.
|
83
|
+
version: 1.1.3
|
70
84
|
- !ruby/object:Gem::Dependency
|
71
85
|
name: hashdiff
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,19 +124,19 @@ dependencies:
|
|
110
124
|
- !ruby/object:Gem::Version
|
111
125
|
version: 1.4.0
|
112
126
|
- !ruby/object:Gem::Dependency
|
113
|
-
name: yaml-
|
127
|
+
name: yaml-safe_load_stream2
|
114
128
|
requirement: !ruby/object:Gem::Requirement
|
115
129
|
requirements:
|
116
130
|
- - "~>"
|
117
131
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
132
|
+
version: 0.1.1
|
119
133
|
type: :runtime
|
120
134
|
prerelease: false
|
121
135
|
version_requirements: !ruby/object:Gem::Requirement
|
122
136
|
requirements:
|
123
137
|
- - "~>"
|
124
138
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
139
|
+
version: 0.1.1
|
126
140
|
- !ruby/object:Gem::Dependency
|
127
141
|
name: bundler
|
128
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -265,13 +279,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
279
|
- - ">="
|
266
280
|
- !ruby/object:Gem::Version
|
267
281
|
version: '2.4'
|
282
|
+
- - "<"
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: '3.1'
|
268
285
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
286
|
requirements:
|
270
287
|
- - ">="
|
271
288
|
- !ruby/object:Gem::Version
|
272
289
|
version: '0'
|
273
290
|
requirements: []
|
274
|
-
rubygems_version: 3.
|
291
|
+
rubygems_version: 3.2.3
|
275
292
|
signing_key:
|
276
293
|
specification_version: 4
|
277
294
|
summary: Kubernetes client library for Ruby
|