k8s-ruby 0.12.0 → 0.13.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/.github/workflows/tests.yml +26 -0
- data/.gitignore +1 -1
- data/Dockerfile +3 -3
- data/Gemfile.lock +117 -0
- data/README.md +4 -2
- data/docker-compose.yaml +0 -5
- data/entrypoint.sh +6 -0
- data/k8s-ruby.gemspec +2 -2
- data/lib/k8s/ruby/version.rb +1 -1
- metadata +14 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 852ad2775ba818eac10ac0cfd9f1e362e1390526102e7c6e0d46b4941e153dc6
|
|
4
|
+
data.tar.gz: 83ef7dc2a19aa6abcc703161f715ce3d4b14732546ec5025991fbcc9d1440b47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffac9cb78159e00e5a84c8e81d60981f2a67f05a414e382599761e6c83f44ffc468e1367862225f3c652a69ff8265deba09a5525631a2f67dc12cefef69e1717
|
|
7
|
+
data.tar.gz: '087453bd8f6650b2db503e286c17f4ee3455bb9b376a13c04bfe145ae48ddcef9f31563f5f64d0e88dd2e52302a0888767c91e7a03b43a045f57bb4261095ea3'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-2-6:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v3
|
|
14
|
+
- run: docker-compose up --build rspec-2.6
|
|
15
|
+
|
|
16
|
+
build-2-7:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v3
|
|
20
|
+
- run: docker-compose up --build rspec-2.7
|
|
21
|
+
|
|
22
|
+
build-3-0:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v3
|
|
26
|
+
- run: docker-compose up --build rspec-3.0
|
data/.gitignore
CHANGED
data/Dockerfile
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
ARG BASE_IMAGE=ruby:2.7
|
|
2
2
|
FROM ${BASE_IMAGE}
|
|
3
3
|
|
|
4
|
+
RUN gem install bundler:2.3.5
|
|
5
|
+
|
|
4
6
|
WORKDIR /app
|
|
5
7
|
|
|
6
8
|
COPY Gemfile *.gemspec ./
|
|
7
9
|
COPY lib/k8s/ruby/version.rb ./lib/k8s/ruby/
|
|
8
10
|
|
|
9
|
-
RUN gem install bundler:2.3.5
|
|
10
11
|
RUN bundle install
|
|
11
12
|
RUN bundle update --bundler
|
|
12
13
|
|
|
13
14
|
COPY . .
|
|
14
|
-
|
|
15
|
-
ENTRYPOINT ["bundle", "exec"]
|
|
15
|
+
ENTRYPOINT ["/app/entrypoint.sh"]
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
k8s-ruby (0.13.0)
|
|
5
|
+
dry-configurable (~> 0.13.0)
|
|
6
|
+
dry-struct (<= 1.6.0)
|
|
7
|
+
dry-types (<= 1.7.0)
|
|
8
|
+
excon (~> 0.71)
|
|
9
|
+
hashdiff (~> 1.0.0)
|
|
10
|
+
jsonpath (~> 0.9.5)
|
|
11
|
+
recursive-open-struct (~> 1.1.3)
|
|
12
|
+
yajl-ruby (~> 1.4.0)
|
|
13
|
+
yaml-safe_load_stream2 (~> 0.1.1)
|
|
14
|
+
|
|
15
|
+
GEM
|
|
16
|
+
remote: https://rubygems.org/
|
|
17
|
+
specs:
|
|
18
|
+
addressable (2.8.1)
|
|
19
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
20
|
+
ast (2.4.2)
|
|
21
|
+
byebug (11.1.3)
|
|
22
|
+
concurrent-ruby (1.1.10)
|
|
23
|
+
crack (0.4.5)
|
|
24
|
+
rexml
|
|
25
|
+
diff-lcs (1.5.0)
|
|
26
|
+
dry-configurable (0.13.0)
|
|
27
|
+
concurrent-ruby (~> 1.0)
|
|
28
|
+
dry-core (~> 0.6)
|
|
29
|
+
dry-container (0.11.0)
|
|
30
|
+
concurrent-ruby (~> 1.0)
|
|
31
|
+
dry-core (0.9.1)
|
|
32
|
+
concurrent-ruby (~> 1.0)
|
|
33
|
+
zeitwerk (~> 2.6)
|
|
34
|
+
dry-inflector (0.3.0)
|
|
35
|
+
dry-logic (1.3.0)
|
|
36
|
+
concurrent-ruby (~> 1.0)
|
|
37
|
+
dry-core (~> 0.9, >= 0.9)
|
|
38
|
+
zeitwerk (~> 2.6)
|
|
39
|
+
dry-struct (1.5.2)
|
|
40
|
+
dry-core (~> 0.9, >= 0.9)
|
|
41
|
+
dry-types (~> 1.6)
|
|
42
|
+
ice_nine (~> 0.11)
|
|
43
|
+
zeitwerk (~> 2.6)
|
|
44
|
+
dry-types (1.6.1)
|
|
45
|
+
concurrent-ruby (~> 1.0)
|
|
46
|
+
dry-container (~> 0.3)
|
|
47
|
+
dry-core (~> 0.9, >= 0.9)
|
|
48
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
|
49
|
+
dry-logic (~> 1.3, >= 1.3)
|
|
50
|
+
zeitwerk (~> 2.6)
|
|
51
|
+
excon (0.94.0)
|
|
52
|
+
hashdiff (1.0.1)
|
|
53
|
+
ice_nine (0.11.2)
|
|
54
|
+
jsonpath (0.9.9)
|
|
55
|
+
multi_json
|
|
56
|
+
to_regexp (~> 0.2.1)
|
|
57
|
+
multi_json (1.15.0)
|
|
58
|
+
parallel (1.22.1)
|
|
59
|
+
parser (3.1.2.1)
|
|
60
|
+
ast (~> 2.4.1)
|
|
61
|
+
public_suffix (5.0.0)
|
|
62
|
+
rainbow (3.1.1)
|
|
63
|
+
rake (13.0.6)
|
|
64
|
+
recursive-open-struct (1.1.3)
|
|
65
|
+
regexp_parser (2.6.1)
|
|
66
|
+
rexml (3.2.5)
|
|
67
|
+
rspec (3.12.0)
|
|
68
|
+
rspec-core (~> 3.12.0)
|
|
69
|
+
rspec-expectations (~> 3.12.0)
|
|
70
|
+
rspec-mocks (~> 3.12.0)
|
|
71
|
+
rspec-core (3.12.0)
|
|
72
|
+
rspec-support (~> 3.12.0)
|
|
73
|
+
rspec-expectations (3.12.0)
|
|
74
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
75
|
+
rspec-support (~> 3.12.0)
|
|
76
|
+
rspec-mocks (3.12.0)
|
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
78
|
+
rspec-support (~> 3.12.0)
|
|
79
|
+
rspec-support (3.12.0)
|
|
80
|
+
rubocop (0.93.1)
|
|
81
|
+
parallel (~> 1.10)
|
|
82
|
+
parser (>= 2.7.1.5)
|
|
83
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
84
|
+
regexp_parser (>= 1.8)
|
|
85
|
+
rexml
|
|
86
|
+
rubocop-ast (>= 0.6.0)
|
|
87
|
+
ruby-progressbar (~> 1.7)
|
|
88
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
89
|
+
rubocop-ast (1.23.0)
|
|
90
|
+
parser (>= 3.1.1.0)
|
|
91
|
+
ruby-progressbar (1.11.0)
|
|
92
|
+
to_regexp (0.2.1)
|
|
93
|
+
unicode-display_width (1.8.0)
|
|
94
|
+
webmock (3.6.2)
|
|
95
|
+
addressable (>= 2.3.6)
|
|
96
|
+
crack (>= 0.3.2)
|
|
97
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
98
|
+
yajl-ruby (1.4.3)
|
|
99
|
+
yaml-safe_load_stream2 (0.1.1)
|
|
100
|
+
zeitwerk (2.6.6)
|
|
101
|
+
|
|
102
|
+
PLATFORMS
|
|
103
|
+
aarch64-linux
|
|
104
|
+
arm64-darwin-21
|
|
105
|
+
x86_64-darwin-21
|
|
106
|
+
|
|
107
|
+
DEPENDENCIES
|
|
108
|
+
bundler (>= 1.17, < 3.0)
|
|
109
|
+
byebug (~> 11.1)
|
|
110
|
+
k8s-ruby!
|
|
111
|
+
rake (>= 12.3.3)
|
|
112
|
+
rspec (~> 3.7)
|
|
113
|
+
rubocop (~> 0.82)
|
|
114
|
+
webmock (~> 3.6.2)
|
|
115
|
+
|
|
116
|
+
BUNDLED WITH
|
|
117
|
+
2.3.26
|
data/README.md
CHANGED
|
@@ -32,11 +32,11 @@ gem 'k8s-ruby'
|
|
|
32
32
|
|
|
33
33
|
And then execute:
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
bundle
|
|
36
36
|
|
|
37
37
|
Or install it yourself as:
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
gem install k8s-ruby
|
|
40
40
|
|
|
41
41
|
And then load the code using:
|
|
42
42
|
|
|
@@ -47,6 +47,7 @@ require 'k8s-ruby'
|
|
|
47
47
|
## Usage
|
|
48
48
|
|
|
49
49
|
### Overview
|
|
50
|
+
|
|
50
51
|
The top-level `K8s::Client` provides access to separate `APIClient` instances for each Kubernetes API Group (`v1`, `apps/v1`, etc.), which in turns provides access to separate `ResourceClient` instances for each API resource type (`nodes`, `pods`, `deployments`, etc.).
|
|
51
52
|
|
|
52
53
|
Individual resources are returned as `K8s::Resource` instances, which are `RecursiveOpenStruct` instances providing attribute access (`resource.metadata.name`). The resource instances are returned by methods such as `client.api('v1').resource('nodes').get('foo')`, and passed as arguments for `client.api('v1').resource('nodes').create_resource(res)`. Resources can also be loaded from disk using `K8s::Resource.from_files(path)`, and passed to the top-level methods such as `client.create_resource(res)`, which lookup the correct API/Resource client from the resource `apiVersion` and `kind`.
|
|
@@ -174,6 +175,7 @@ pods = client.api('v1').resource('pods', namespace: 'default').delete_collection
|
|
|
174
175
|
### Creating resources
|
|
175
176
|
|
|
176
177
|
#### Programmatically defined resources
|
|
178
|
+
|
|
177
179
|
```ruby
|
|
178
180
|
service = K8s::Resource.new({
|
|
179
181
|
apiVersion: 'v1',
|
data/docker-compose.yaml
CHANGED
|
@@ -6,8 +6,6 @@ services:
|
|
|
6
6
|
BASE_IMAGE: ruby:2.6
|
|
7
7
|
volumes:
|
|
8
8
|
- .:/app
|
|
9
|
-
entrypoint: bundle exec rspec
|
|
10
|
-
|
|
11
9
|
rspec-2.7:
|
|
12
10
|
build:
|
|
13
11
|
context: .
|
|
@@ -15,8 +13,6 @@ services:
|
|
|
15
13
|
BASE_IMAGE: ruby:2.7
|
|
16
14
|
volumes:
|
|
17
15
|
- .:/app
|
|
18
|
-
entrypoint: bundle exec rspec
|
|
19
|
-
|
|
20
16
|
rspec-3.0:
|
|
21
17
|
build:
|
|
22
18
|
context: .
|
|
@@ -24,4 +20,3 @@ services:
|
|
|
24
20
|
BASE_IMAGE: ruby:3.0
|
|
25
21
|
volumes:
|
|
26
22
|
- .:/app
|
|
27
|
-
entrypoint: bundle exec rspec
|
data/entrypoint.sh
ADDED
data/k8s-ruby.gemspec
CHANGED
|
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
|
|
|
24
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", "
|
|
27
|
+
spec.add_runtime_dependency "dry-struct", "<= 1.6.0"
|
|
28
|
+
spec.add_runtime_dependency "dry-types", "<= 1.7.0"
|
|
29
29
|
spec.add_runtime_dependency "dry-configurable", "~> 0.13.0"
|
|
30
30
|
spec.add_runtime_dependency "recursive-open-struct", "~> 1.1.3"
|
|
31
31
|
spec.add_runtime_dependency "hashdiff", "~> 1.0.0"
|
data/lib/k8s/ruby/version.rb
CHANGED
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.13.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-
|
|
12
|
+
date: 2022-11-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: excon
|
|
@@ -29,30 +29,30 @@ dependencies:
|
|
|
29
29
|
name: dry-struct
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
|
-
- - "
|
|
32
|
+
- - "<="
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: 1.
|
|
34
|
+
version: 1.6.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: 1.
|
|
41
|
+
version: 1.6.0
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: dry-types
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
|
-
- - "
|
|
46
|
+
- - "<="
|
|
47
47
|
- !ruby/object:Gem::Version
|
|
48
|
-
version: 1.
|
|
48
|
+
version: 1.7.0
|
|
49
49
|
type: :runtime
|
|
50
50
|
prerelease: false
|
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
52
52
|
requirements:
|
|
53
|
-
- - "
|
|
53
|
+
- - "<="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: 1.
|
|
55
|
+
version: 1.7.0
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: dry-configurable
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -234,16 +234,19 @@ executables: []
|
|
|
234
234
|
extensions: []
|
|
235
235
|
extra_rdoc_files: []
|
|
236
236
|
files:
|
|
237
|
+
- ".github/workflows/tests.yml"
|
|
237
238
|
- ".gitignore"
|
|
238
239
|
- ".rspec"
|
|
239
240
|
- ".rubocop.relaxed.yml"
|
|
240
241
|
- ".rubocop.yml"
|
|
241
242
|
- Dockerfile
|
|
242
243
|
- Gemfile
|
|
244
|
+
- Gemfile.lock
|
|
243
245
|
- LICENSE
|
|
244
246
|
- README.md
|
|
245
247
|
- Rakefile
|
|
246
248
|
- docker-compose.yaml
|
|
249
|
+
- entrypoint.sh
|
|
247
250
|
- k8s-ruby.gemspec
|
|
248
251
|
- lib/k8s-ruby.rb
|
|
249
252
|
- lib/k8s/api.rb
|
|
@@ -288,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
288
291
|
- !ruby/object:Gem::Version
|
|
289
292
|
version: '0'
|
|
290
293
|
requirements: []
|
|
291
|
-
rubygems_version: 3.2.
|
|
294
|
+
rubygems_version: 3.2.33
|
|
292
295
|
signing_key:
|
|
293
296
|
specification_version: 4
|
|
294
297
|
summary: Kubernetes client library for Ruby
|