kruby 1.35.0.2 → 1.35.0.4
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/README.md +18 -6
- data/lib/kubernetes/api_client.rb +15 -2
- data/lib/kubernetes/loader.rb +54 -3
- data/lib/kubernetes/release/changelog.rb +86 -0
- data/lib/kubernetes/version.rb +1 -1
- data/lib/kubernetes/watch.rb +57 -3
- metadata +9 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cdd7db944280966e22d2be3322abbfe98981fb18351266c16ab4c327e9afc74
|
|
4
|
+
data.tar.gz: 9923f2a3752d27a87968c409bd16247ab58ae885f594febcc4b99bd03e5b1884
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52a3459ee9ae1d8f914f57e1beceb1597cc54d32c409afaa6c474cdcbc5d8346042279ac3a721459db6f243a37ea934319381e5fe2395a4c89122d45db10e907
|
|
7
|
+
data.tar.gz: d8b4048dad3e851ca12332b53aa925dc0dfce5bd45d143615d9ce76b6b10defec8dda971f6e3371d9b8612d7c32022617cb47b4bcf9522b43a9c193c2a30c56d
|
data/README.md
CHANGED
|
@@ -7,9 +7,19 @@ No description provided (generated by Openapi Generator https://github.com/opena
|
|
|
7
7
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
8
8
|
|
|
9
9
|
- API version: release-1.35
|
|
10
|
-
- Package version: 1.35.0.
|
|
10
|
+
- Package version: 1.35.0.4
|
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
|
12
12
|
|
|
13
|
+
## Project Origin
|
|
14
|
+
|
|
15
|
+
- Fork source: [kubernetes-client/ruby](https://github.com/kubernetes-client/ruby).
|
|
16
|
+
- This repository is a community-maintained fork and includes modifications beyond generated code (packaging, compatibility updates, and maintenance fixes).
|
|
17
|
+
|
|
18
|
+
## Release History
|
|
19
|
+
|
|
20
|
+
- User-visible release notes are tracked in the repository [CHANGELOG.md](https://github.com/doridoridoriand/kruby/blob/master/CHANGELOG.md).
|
|
21
|
+
- Release tags use the format `vX.Y.Z`, and matching GitHub Releases are published at [github.com/doridoridoriand/kruby/releases](https://github.com/doridoridoriand/kruby/releases).
|
|
22
|
+
|
|
13
23
|
## Installation
|
|
14
24
|
|
|
15
25
|
### Build a gem
|
|
@@ -23,22 +33,24 @@ gem build kubernetes.gemspec
|
|
|
23
33
|
Then either install the gem locally:
|
|
24
34
|
|
|
25
35
|
```shell
|
|
26
|
-
gem install ./kruby-1.35.0.
|
|
36
|
+
gem install ./kruby-1.35.0.4.gem
|
|
27
37
|
```
|
|
28
38
|
|
|
29
|
-
(for development, run `gem install --dev ./kruby-1.35.0.
|
|
39
|
+
(for development, run `gem install --dev ./kruby-1.35.0.4.gem` to install the development dependencies)
|
|
30
40
|
|
|
31
41
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
|
32
42
|
|
|
33
43
|
Finally add this to the Gemfile:
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
```ruby
|
|
46
|
+
gem 'kruby', '~> 1.35.0.4'
|
|
47
|
+
```
|
|
36
48
|
|
|
37
49
|
### Install from Git
|
|
38
50
|
|
|
39
|
-
If the Ruby gem is hosted at a git repository: https://github.com/doridoridoriand/
|
|
51
|
+
If the Ruby gem is hosted at a git repository: https://github.com/doridoridoriand/kruby, then add the following in the Gemfile:
|
|
40
52
|
|
|
41
|
-
gem 'kruby', :git => 'https://github.com/doridoridoriand/
|
|
53
|
+
gem 'kruby', :git => 'https://github.com/doridoridoriand/kruby.git'
|
|
42
54
|
|
|
43
55
|
### Include the Ruby code directly
|
|
44
56
|
|
|
@@ -360,9 +360,22 @@ module Kubernetes
|
|
|
360
360
|
# @param [Object] obj object to be converted into JSON string
|
|
361
361
|
# @return [String] JSON string representation of the object
|
|
362
362
|
def object_to_hash(obj)
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
sanitize_for_serialization(obj)
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def sanitize_for_serialization(obj)
|
|
367
|
+
case obj
|
|
368
|
+
when Array
|
|
369
|
+
obj.map { |item| sanitize_for_serialization(item) }
|
|
370
|
+
when Hash
|
|
371
|
+
obj.each_with_object({}) do |(key, value), result|
|
|
372
|
+
result[key] = sanitize_for_serialization(value)
|
|
373
|
+
end
|
|
374
|
+
when Time, Date, DateTime
|
|
375
|
+
obj.iso8601
|
|
365
376
|
else
|
|
377
|
+
return sanitize_for_serialization(obj.to_hash) if obj.respond_to?(:to_hash)
|
|
378
|
+
|
|
366
379
|
obj
|
|
367
380
|
end
|
|
368
381
|
end
|
data/lib/kubernetes/loader.rb
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Copyright 2019 The Kubernetes Authors.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
2
14
|
|
|
3
|
-
|
|
4
|
-
|
|
15
|
+
require 'kubernetes/config/incluster_config'
|
|
16
|
+
require 'kubernetes/config/kube_config'
|
|
17
|
+
|
|
18
|
+
module Kubernetes
|
|
19
|
+
# Configuration is a utility class for loading kubernetes configurations
|
|
20
|
+
class Configuration
|
|
21
|
+
def self.default_config
|
|
22
|
+
result = Configuration.new
|
|
23
|
+
return result if load_local_config(result)
|
|
24
|
+
|
|
25
|
+
# In cluster config
|
|
26
|
+
if InClusterConfig.in_cluster?
|
|
27
|
+
k_config = InClusterConfig.new
|
|
28
|
+
k_config.configure(result)
|
|
29
|
+
return result
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
result.scheme = 'http'
|
|
33
|
+
result.host = 'localhost:8080'
|
|
34
|
+
result
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.load_local_config(result)
|
|
38
|
+
# KUBECONFIG environment variable
|
|
39
|
+
kc = (ENV['KUBECONFIG']).to_s
|
|
40
|
+
return load_file_config(kc, result) if File.exist?(kc)
|
|
41
|
+
|
|
42
|
+
# default home location
|
|
43
|
+
kc = "#{ENV['HOME']}/.kube/config"
|
|
44
|
+
return unless File.exist?(kc)
|
|
45
|
+
|
|
46
|
+
load_file_config(kc, result)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.load_file_config(file, result)
|
|
50
|
+
k_config = KubeConfig.new(file)
|
|
51
|
+
k_config.configure(result)
|
|
52
|
+
result
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kubernetes
|
|
4
|
+
module Release
|
|
5
|
+
class Changelog
|
|
6
|
+
Error = Class.new(StandardError)
|
|
7
|
+
|
|
8
|
+
SECTION_HEADER = /^## \[(?<name>[^\]]+)\](?: - (?<label>[^\n]+))?$/.freeze
|
|
9
|
+
EMPTY_UNRELEASED_PLACEHOLDER = "- Nothing yet."
|
|
10
|
+
|
|
11
|
+
attr_reader :path
|
|
12
|
+
|
|
13
|
+
def initialize(path)
|
|
14
|
+
@path = File.expand_path(path)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def include?(name)
|
|
18
|
+
entries.key?(name)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def release_notes(name)
|
|
22
|
+
entry(name).fetch(:body)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def unreleased_empty?
|
|
26
|
+
return false unless include?("Unreleased")
|
|
27
|
+
|
|
28
|
+
body = release_notes("Unreleased").strip
|
|
29
|
+
body.empty? || body == EMPTY_UNRELEASED_PLACEHOLDER
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def validate_release!(version:, tag: nil, require_empty_unreleased: false)
|
|
33
|
+
errors = []
|
|
34
|
+
|
|
35
|
+
errors << "missing Unreleased section in #{path}" unless include?("Unreleased")
|
|
36
|
+
errors << "missing CHANGELOG entry for #{version} in #{path}" unless include?(version)
|
|
37
|
+
|
|
38
|
+
expected_tag = "v#{version}"
|
|
39
|
+
if tag && tag != expected_tag
|
|
40
|
+
errors << "release tag #{tag} does not match version #{version} (expected #{expected_tag})"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if require_empty_unreleased && !unreleased_empty?
|
|
44
|
+
errors << "Unreleased section must be empty before cutting #{expected_tag}"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
raise Error, errors.join("\n") unless errors.empty?
|
|
48
|
+
|
|
49
|
+
true
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def entry(name)
|
|
55
|
+
entries.fetch(name) do
|
|
56
|
+
raise Error, "missing CHANGELOG entry for #{name} in #{path}"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def entries
|
|
61
|
+
@entries ||= parse_entries
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def parse_entries
|
|
65
|
+
content = File.read(path)
|
|
66
|
+
matches = content.to_enum(:scan, SECTION_HEADER).map { Regexp.last_match }
|
|
67
|
+
|
|
68
|
+
raise Error, "no CHANGELOG sections found in #{path}" if matches.empty?
|
|
69
|
+
|
|
70
|
+
matches.each_with_index.each_with_object({}) do |(match, index), parsed|
|
|
71
|
+
name = match[:name]
|
|
72
|
+
raise Error, "duplicate CHANGELOG section #{name} in #{path}" if parsed.key?(name)
|
|
73
|
+
|
|
74
|
+
body_start = match.end(0)
|
|
75
|
+
body_end = index + 1 < matches.length ? matches[index + 1].begin(0) : content.length
|
|
76
|
+
parsed[name] = {
|
|
77
|
+
label: match[:label],
|
|
78
|
+
body: content[body_start...body_end].to_s.strip
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
rescue Errno::ENOENT => e
|
|
82
|
+
raise Error, e.message
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
data/lib/kubernetes/version.rb
CHANGED
data/lib/kubernetes/watch.rb
CHANGED
|
@@ -1,4 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Copyright 2019 The Kubernetes Authors.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
2
14
|
|
|
3
|
-
|
|
4
|
-
|
|
15
|
+
require 'json'
|
|
16
|
+
|
|
17
|
+
# The Kubernetes module encapsulates the Kubernetes client for Ruby
|
|
18
|
+
module Kubernetes
|
|
19
|
+
# The Watch class provides the ability to watch a specific resource for
|
|
20
|
+
# updates.
|
|
21
|
+
class Watch
|
|
22
|
+
def initialize(client)
|
|
23
|
+
@client = client
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def make_url(path, resource_version)
|
|
27
|
+
query = '?watch=true'
|
|
28
|
+
query += "&resourceVersion=#{resource_version}" if resource_version
|
|
29
|
+
path + query
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def connect(path, resource_version = nil, &_block)
|
|
33
|
+
opts = { auth_names: ['BearerToken'] }
|
|
34
|
+
url = make_url(path, resource_version)
|
|
35
|
+
request = @client.build_request('GET', url, opts)
|
|
36
|
+
last = ''
|
|
37
|
+
request.on_body do |chunk|
|
|
38
|
+
last, pieces = split_lines(last, chunk)
|
|
39
|
+
pieces.each do |part|
|
|
40
|
+
yield JSON.parse(part)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
request.run
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def split_lines(last, chunk)
|
|
47
|
+
data = chunk
|
|
48
|
+
data = last + '' + data
|
|
49
|
+
|
|
50
|
+
ix = data.rindex("\n")
|
|
51
|
+
return [data, []] unless ix
|
|
52
|
+
|
|
53
|
+
complete = data[0..ix]
|
|
54
|
+
last = data[(ix + 1)..data.length]
|
|
55
|
+
[last, complete.split(/\n/)]
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.35.0.
|
|
4
|
+
version: 1.35.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- doridoridoriand
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: typhoeus
|
|
@@ -878,18 +878,19 @@ files:
|
|
|
878
878
|
- lib/kubernetes/models/v2beta1_api_subresource_discovery.rb
|
|
879
879
|
- lib/kubernetes/models/v2beta1_api_version_discovery.rb
|
|
880
880
|
- lib/kubernetes/models/version_info.rb
|
|
881
|
+
- lib/kubernetes/release/changelog.rb
|
|
881
882
|
- lib/kubernetes/utils.rb
|
|
882
883
|
- lib/kubernetes/version.rb
|
|
883
884
|
- lib/kubernetes/watch.rb
|
|
884
|
-
homepage: https://github.com/doridoridoriand/
|
|
885
|
+
homepage: https://github.com/doridoridoriand/kruby
|
|
885
886
|
licenses:
|
|
886
887
|
- Apache-2.0
|
|
887
888
|
metadata:
|
|
888
|
-
homepage_uri: https://github.com/doridoridoriand/
|
|
889
|
-
source_code_uri: https://github.com/doridoridoriand/
|
|
890
|
-
documentation_uri: https://github.com/doridoridoriand/
|
|
891
|
-
changelog_uri: https://github.com/doridoridoriand/
|
|
892
|
-
bug_tracker_uri: https://github.com/doridoridoriand/
|
|
889
|
+
homepage_uri: https://github.com/doridoridoriand/kruby
|
|
890
|
+
source_code_uri: https://github.com/doridoridoriand/kruby
|
|
891
|
+
documentation_uri: https://github.com/doridoridoriand/kruby#readme
|
|
892
|
+
changelog_uri: https://github.com/doridoridoriand/kruby/blob/master/CHANGELOG.md
|
|
893
|
+
bug_tracker_uri: https://github.com/doridoridoriand/kruby/issues
|
|
893
894
|
allowed_push_host: https://rubygems.org
|
|
894
895
|
rubygems_mfa_required: 'true'
|
|
895
896
|
post_install_message:
|