kruby 1.35.0.2 → 1.35.0.3
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 +6 -4
- data/lib/kubernetes/loader.rb +54 -3
- data/lib/kubernetes/version.rb +1 -1
- data/lib/kubernetes/watch.rb +57 -3
- metadata +12 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 668379c300ae5f9e89b4d47791010ab9aaa22527b45d5465cbe4839cfda217bf
|
|
4
|
+
data.tar.gz: 184d611febbbf5118d0b73ed1bab37c5ff4b0617435228e55faa6169eea6d488
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac3872ddf0fa4d6a3b1d215e28425c7a9e608cf0b64d29b13f67c3018664b5fc54c914fc90d2fc81a53e10424b5faa2b4bb3dfcbb17a28c04d84b88dc08566ff
|
|
7
|
+
data.tar.gz: c409205171ab819c6dd529316c01695a9e1e5f071c637c684c9664bea3f17a04fb704de2a366fd4c4fcc951db2fbf509041cdfb98d4c712acbda96d3d5e19948
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ 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.3
|
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
@@ -23,16 +23,18 @@ gem build kubernetes.gemspec
|
|
|
23
23
|
Then either install the gem locally:
|
|
24
24
|
|
|
25
25
|
```shell
|
|
26
|
-
gem install ./kruby-1.35.0.
|
|
26
|
+
gem install ./kruby-1.35.0.3.gem
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
(for development, run `gem install --dev ./kruby-1.35.0.
|
|
29
|
+
(for development, run `gem install --dev ./kruby-1.35.0.3.gem` to install the development dependencies)
|
|
30
30
|
|
|
31
31
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
|
32
32
|
|
|
33
33
|
Finally add this to the Gemfile:
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
```ruby
|
|
36
|
+
gem 'kruby', '~> 1.35.0.3'
|
|
37
|
+
```
|
|
36
38
|
|
|
37
39
|
### Install from Git
|
|
38
40
|
|
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
|
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,11 +1,11 @@
|
|
|
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.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- doridoridoriand
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2026-03-03 00:00:00.000000000 Z
|
|
@@ -48,25 +48,25 @@ dependencies:
|
|
|
48
48
|
name: rspec
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: 3.6.0
|
|
54
51
|
- - "~>"
|
|
55
52
|
- !ruby/object:Gem::Version
|
|
56
53
|
version: '3.6'
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 3.6.0
|
|
57
57
|
type: :development
|
|
58
58
|
prerelease: false
|
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
|
60
60
|
requirements:
|
|
61
|
-
- - ">="
|
|
62
|
-
- !ruby/object:Gem::Version
|
|
63
|
-
version: 3.6.0
|
|
64
61
|
- - "~>"
|
|
65
62
|
- !ruby/object:Gem::Version
|
|
66
63
|
version: '3.6'
|
|
64
|
+
- - ">="
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: 3.6.0
|
|
67
67
|
description: Kruby is a community-maintained Ruby client generated from Kubernetes
|
|
68
68
|
OpenAPI.
|
|
69
|
-
email:
|
|
69
|
+
email:
|
|
70
70
|
executables: []
|
|
71
71
|
extensions: []
|
|
72
72
|
extra_rdoc_files: []
|
|
@@ -892,7 +892,7 @@ metadata:
|
|
|
892
892
|
bug_tracker_uri: https://github.com/doridoridoriand/k8sruby/issues
|
|
893
893
|
allowed_push_host: https://rubygems.org
|
|
894
894
|
rubygems_mfa_required: 'true'
|
|
895
|
-
post_install_message:
|
|
895
|
+
post_install_message:
|
|
896
896
|
rdoc_options: []
|
|
897
897
|
require_paths:
|
|
898
898
|
- lib
|
|
@@ -907,8 +907,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
907
907
|
- !ruby/object:Gem::Version
|
|
908
908
|
version: '0'
|
|
909
909
|
requirements: []
|
|
910
|
-
rubygems_version: 3.
|
|
911
|
-
signing_key:
|
|
910
|
+
rubygems_version: 3.5.22
|
|
911
|
+
signing_key:
|
|
912
912
|
specification_version: 4
|
|
913
913
|
summary: Kruby community client for Kubernetes API.
|
|
914
914
|
test_files: []
|