kubeclient 4.9.3 → 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/actions.yml +5 -4
- data/.rubocop.yml +111 -14
- data/CHANGELOG.md +37 -1
- data/README.md +5 -6
- data/RELEASING.md +8 -8
- data/kubeclient.gemspec +6 -4
- data/lib/kubeclient/common.rb +22 -17
- data/lib/kubeclient/version.rb +1 -1
- data/lib/kubeclient/watch_stream.rb +1 -0
- metadata +26 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fde357cc528d50c12d105ffe2513e2a2c16958a01183a71189be6bc6e80840c
|
4
|
+
data.tar.gz: b6e50bae096e72b396068c6da958ecddd7c3d61e9b91c2f55c05e020c1489235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4bfabe573e6f6da11be4635df9b8f19b0d4bf39693f195befc95e484d3cd3a22b132f57659f9947917c51f227e9f11dad9b7a6c8d996bbaccc6007a9a74212d
|
7
|
+
data.tar.gz: d99da69686d8548794c96ccfc943caa52e5156708f4ff717e84fb7c9f467c090f34426b8030bcbfc1daf68d09b54b3f1702152334c7769a429bac7280f567483
|
@@ -14,9 +14,11 @@ jobs:
|
|
14
14
|
runs-on: ${{ matrix.os_and_command.os }}
|
15
15
|
strategy:
|
16
16
|
matrix:
|
17
|
-
ruby: [ '2.
|
17
|
+
ruby: [ '2.7', '3.0', '3.1', 'ruby-head', 'truffleruby-head' ]
|
18
18
|
os_and_command:
|
19
|
-
- os:
|
19
|
+
- os: macos-latest
|
20
|
+
command: 'env TESTOPTS="--verbose" bundle exec rake test'
|
21
|
+
- os: windows-latest
|
20
22
|
command: 'env TESTOPTS="--verbose" bundle exec rake test'
|
21
23
|
- os: ubuntu-latest
|
22
24
|
# Sometimes minitest starts and then just hangs printing nothing.
|
@@ -25,7 +27,7 @@ jobs:
|
|
25
27
|
include:
|
26
28
|
# run rubocop against lowest supported ruby
|
27
29
|
- os: ubuntu-latest
|
28
|
-
ruby: '2.
|
30
|
+
ruby: '2.7'
|
29
31
|
command: 'bundle exec rake rubocop'
|
30
32
|
name: ${{ matrix.os_and_command.os }} ${{ matrix.ruby }} rake ${{ matrix.os_and_command.command }}
|
31
33
|
steps:
|
@@ -35,7 +37,6 @@ jobs:
|
|
35
37
|
with:
|
36
38
|
ruby-version: ${{ matrix.ruby }}
|
37
39
|
bundler-cache: false # disable running 'bundle install' and caching installed gems see https://github.com/httprb/http/issues/572
|
38
|
-
- run: gem install rake bundler
|
39
40
|
- run: bundle install
|
40
41
|
- run: ${{ matrix.os_and_command.command }}
|
41
42
|
timeout-minutes: 10
|
data/.rubocop.yml
CHANGED
@@ -1,35 +1,132 @@
|
|
1
1
|
AllCops:
|
2
2
|
DisplayCopNames: true
|
3
|
-
TargetRubyVersion: 2.
|
3
|
+
TargetRubyVersion: 2.7 # Oldest version kubeclient supports
|
4
4
|
MethodLength:
|
5
5
|
Enabled: false
|
6
6
|
ClassLength:
|
7
7
|
Enabled: false
|
8
8
|
Metrics/AbcSize:
|
9
9
|
Enabled: false
|
10
|
-
Metrics/LineLength:
|
11
|
-
Max: 100
|
12
10
|
Metrics/ParameterLists:
|
13
11
|
Max: 5
|
14
12
|
CountKeywordArgs: false
|
15
|
-
Metrics/CyclomaticComplexity:
|
16
|
-
Max: 8
|
17
|
-
Metrics/PerceivedComplexity:
|
18
|
-
Max: 8
|
19
13
|
Metrics/ModuleLength:
|
20
14
|
Enabled: false
|
21
|
-
Style/MethodCallWithArgsParentheses:
|
22
|
-
Enabled: true
|
23
|
-
IgnoredMethods: [require, raise, include, attr_reader, refute, assert]
|
24
|
-
Exclude: [Gemfile, Rakefile, kubeclient.gemspec, Gemfile.dev.rb]
|
25
15
|
Metrics/BlockLength:
|
26
16
|
Exclude: [kubeclient.gemspec]
|
27
17
|
Security/MarshalLoad:
|
28
18
|
Exclude: [test/**/*]
|
29
19
|
Style/FileName:
|
30
20
|
Exclude: [Gemfile, Rakefile, Gemfile.dev.rb]
|
31
|
-
Style/MethodCallWithArgsParentheses:
|
32
|
-
IgnoredMethods:
|
33
|
-
- require_relative
|
34
21
|
Style/RegexpLiteral:
|
35
22
|
Enabled: false
|
23
|
+
|
24
|
+
# Cops that have active offences in the codebase.
|
25
|
+
Lint/RedundantCopDisableDirective:
|
26
|
+
Enabled: false
|
27
|
+
Metrics/CyclomaticComplexity:
|
28
|
+
Enabled: false
|
29
|
+
Max: 8
|
30
|
+
Metrics/PerceivedComplexity:
|
31
|
+
Enabled: false
|
32
|
+
Max: 8
|
33
|
+
Style/MethodCallWithArgsParentheses:
|
34
|
+
Enabled: false
|
35
|
+
IgnoredMethods: [require, require_relative, raise, include, attr_reader, refute, assert]
|
36
|
+
Exclude: [Gemfile, Rakefile, kubeclient.gemspec, Gemfile.dev.rb]
|
37
|
+
Style/FrozenStringLiteralComment:
|
38
|
+
Enabled: false
|
39
|
+
Lint/UnreachableLoop:
|
40
|
+
Enabled: false
|
41
|
+
Style/RedundantRegexpEscape:
|
42
|
+
Enabled: false
|
43
|
+
Layout/MultilineMethodCallIndentation:
|
44
|
+
Enabled: false
|
45
|
+
Lint/UselessAssignment:
|
46
|
+
Enabled: false
|
47
|
+
Style/StringLiterals:
|
48
|
+
Enabled: false
|
49
|
+
Layout/ExtraSpacing:
|
50
|
+
Enabled: false
|
51
|
+
Layout/IndentationWidth:
|
52
|
+
Enabled: false
|
53
|
+
Naming/MethodParameterName:
|
54
|
+
Enabled: false
|
55
|
+
Layout/HashAlignment:
|
56
|
+
Enabled: false
|
57
|
+
Layout/TrailingWhitespace:
|
58
|
+
Enabled: false
|
59
|
+
Naming/RescuedExceptionsVariableName:
|
60
|
+
Enabled: false
|
61
|
+
Style/RedundantBegin:
|
62
|
+
Enabled: false
|
63
|
+
Style/WordArray:
|
64
|
+
Enabled: false
|
65
|
+
Style/ExplicitBlockArgument:
|
66
|
+
Enabled: false
|
67
|
+
Layout/LeadingEmptyLines:
|
68
|
+
Enabled: false
|
69
|
+
Layout/EmptyLineAfterGuardClause:
|
70
|
+
Enabled: false
|
71
|
+
Style/SafeNavigation:
|
72
|
+
Enabled: false
|
73
|
+
Style/SoleNestedConditional:
|
74
|
+
Enabled: false
|
75
|
+
Lint/MissingSuper:
|
76
|
+
Enabled: false
|
77
|
+
Style/IfUnlessModifier:
|
78
|
+
Enabled: false
|
79
|
+
Layout/LineLength:
|
80
|
+
Enabled: false
|
81
|
+
Lint/MissingCopEnableDirective:
|
82
|
+
Enabled: false
|
83
|
+
Naming/MethodName:
|
84
|
+
Enabled: false
|
85
|
+
Style/StringConcatenation:
|
86
|
+
Enabled: false
|
87
|
+
Style/SlicingWithRange:
|
88
|
+
Enabled: false
|
89
|
+
Lint/MixedRegexpCaptureTypes:
|
90
|
+
Enabled: false
|
91
|
+
Style/AccessorGrouping:
|
92
|
+
Enabled: false
|
93
|
+
Style/HashEachMethods:
|
94
|
+
Enabled: false
|
95
|
+
Naming/AccessorMethodName:
|
96
|
+
Enabled: false
|
97
|
+
Style/RedundantAssignment:
|
98
|
+
Enabled: false
|
99
|
+
Gemspec/OrderedDependencies:
|
100
|
+
Enabled: false
|
101
|
+
Style/ExpandPathArguments:
|
102
|
+
Enabled: false
|
103
|
+
Style/Encoding:
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
# New Cops to configure
|
107
|
+
Lint/DuplicateBranch: # (new in 1.3)
|
108
|
+
Enabled: false
|
109
|
+
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
|
110
|
+
Enabled: false
|
111
|
+
Lint/EmptyBlock: # (new in 1.1)
|
112
|
+
Enabled: false
|
113
|
+
Lint/EmptyClass: # (new in 1.3)
|
114
|
+
Enabled: false
|
115
|
+
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
|
116
|
+
Enabled: false
|
117
|
+
Lint/ToEnumArguments: # (new in 1.1)
|
118
|
+
Enabled: false
|
119
|
+
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
|
120
|
+
Enabled: false
|
121
|
+
Style/ArgumentsForwarding: # (new in 1.1)
|
122
|
+
Enabled: false
|
123
|
+
Style/CollectionCompact: # (new in 1.2)
|
124
|
+
Enabled: false
|
125
|
+
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
|
126
|
+
Enabled: false
|
127
|
+
Style/NegatedIfElseCondition: # (new in 1.2)
|
128
|
+
Enabled: false
|
129
|
+
Style/NilLambda: # (new in 1.3)
|
130
|
+
Enabled: false
|
131
|
+
Style/SwapValues: # (new in 1.1)
|
132
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,39 @@ Notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
5
5
|
Kubeclient release versioning follows [SemVer](https://semver.org/).
|
6
6
|
|
7
|
-
## 4.
|
7
|
+
## 4.11.0 — 2022-12-22
|
8
|
+
|
9
|
+
### Removed
|
10
|
+
|
11
|
+
- Dropped support for EOL Ruby versions 2.5, 2.6. (#589)
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- Relaxed dependency on `http` gem (used for watches) to allow 5.y.z versions. (#589)
|
16
|
+
|
17
|
+
- Specifically, http 5.1.1 may fix issues watching with IPv6. (#585)
|
18
|
+
|
19
|
+
## 4.10.1 — 2022-10-01
|
20
|
+
|
21
|
+
### Removed
|
22
|
+
|
23
|
+
- Dropped debug logging about bearer token options that was added in 4.10.0. (#577)
|
24
|
+
|
25
|
+
## 4.10.0 — 2022-08-29
|
26
|
+
|
27
|
+
### Added
|
28
|
+
|
29
|
+
- When using `:bearer_token_file`, re-read the file on every request. (#566 closed #561)
|
30
|
+
|
31
|
+
Kubernetes version 1.21 graduated [BoundServiceAccountTokenVolume feature][] to beta
|
32
|
+
and enabled it by default, so standard in-cluster auth now uses short-lived tokens.
|
33
|
+
|
34
|
+
This changes allows a long-lived `Client` object to keep working when the token file gets
|
35
|
+
rotated. It's not optimized at all, if you feel the performance overhead, please report!
|
36
|
+
|
37
|
+
[BoundServiceAccountTokenVolume feature]: https://github.com/kubernetes/enhancements/issues/542
|
38
|
+
|
39
|
+
## 4.9.3 — 2022-03-23
|
8
40
|
|
9
41
|
### Fixed
|
10
42
|
|
@@ -23,12 +55,16 @@ Kubeclient release versioning follows [SemVer](https://semver.org/).
|
|
23
55
|
This was broken IN ALL RELEASES MADE BEFORE 2022, ever since
|
24
56
|
[`Kubeclient::Config` was created](https://github.com/ManageIQ/kubeclient/pull/127/files#diff-32e70f2f6781a9e9c7b83ae5e7eaf5ffd068a05649077fa38f6789e72f3de837R41-R48).
|
25
57
|
|
58
|
+
[#554](https://github.com/ManageIQ/kubeclient/issues/554).
|
59
|
+
|
26
60
|
- Bug fix: kubeconfig `insecure-skip-tls-verify` field was ignored.
|
27
61
|
When kubeconfig did define custom CA, `Config` was returning hard-coded `VERIFY_PEER`.
|
28
62
|
|
29
63
|
Now we honor it, return `VERIFY_NONE` iff kubeconfig has explicit
|
30
64
|
`insecure-skip-tls-verify: true`, otherwise `VERIFY_PEER`.
|
31
65
|
|
66
|
+
[#555](https://github.com/ManageIQ/kubeclient/issues/555).
|
67
|
+
|
32
68
|
- `Config`: fixed parsing of `certificate-authority` file containing concatenation of
|
33
69
|
several certificates. Previously, server's cert was checked against only first CA cert,
|
34
70
|
resulting in possible "certificate verify failed" errors.
|
data/README.md
CHANGED
@@ -13,8 +13,7 @@ To learn more about groups and versions in kubernetes refer to [k8s docs](https:
|
|
13
13
|
|
14
14
|
If you use `Kubeclient::Config`, all gem versions released before 2022 could return incorrect `ssl_options[:verify_ssl]`,
|
15
15
|
endangering your connection and cluster credentials.
|
16
|
-
See
|
17
|
-
Open an issue if you want a backport to another version.
|
16
|
+
See https://github.com/ManageIQ/kubeclient/issues/554 for details and which versions got a fix.
|
18
17
|
|
19
18
|
## Installation
|
20
19
|
|
@@ -105,8 +104,8 @@ client = Kubeclient::Client.new(
|
|
105
104
|
### Authentication
|
106
105
|
|
107
106
|
If you are using basic authentication or bearer tokens as described
|
108
|
-
[here](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/authentication.md)
|
109
|
-
of the following:
|
107
|
+
[here](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/authentication.md)
|
108
|
+
then you can specify one of the following:
|
110
109
|
|
111
110
|
```ruby
|
112
111
|
auth_options = {
|
@@ -118,7 +117,7 @@ client = Kubeclient::Client.new(
|
|
118
117
|
)
|
119
118
|
```
|
120
119
|
|
121
|
-
or
|
120
|
+
or (fixed token, if it expires it's up to you to create a new `Client` object):
|
122
121
|
|
123
122
|
```ruby
|
124
123
|
auth_options = {
|
@@ -129,7 +128,7 @@ client = Kubeclient::Client.new(
|
|
129
128
|
)
|
130
129
|
```
|
131
130
|
|
132
|
-
or
|
131
|
+
or (will automatically re-read the token if file is updated):
|
133
132
|
|
134
133
|
```ruby
|
135
134
|
auth_options = {
|
data/RELEASING.md
CHANGED
@@ -4,10 +4,6 @@
|
|
4
4
|
Kubeclient release versioning follows [SemVer](https://semver.org/).
|
5
5
|
At some point in time it is decided to release version x.y.z.
|
6
6
|
|
7
|
-
```bash
|
8
|
-
RELEASE_BRANCH="master"
|
9
|
-
```
|
10
|
-
|
11
7
|
## 0. (once) Install gem-release, needed for several commands here:
|
12
8
|
|
13
9
|
```bash
|
@@ -16,13 +12,17 @@ gem install gem-release
|
|
16
12
|
|
17
13
|
## 1. PR(s) for changelog & bump
|
18
14
|
|
19
|
-
Edit `CHANGELOG.md` as necessary. Even if all included changes remembered to update it, you should replace "Unreleased" section header with appropriate "x.y.z — 20yy-mm-dd" header.
|
20
|
-
|
21
|
-
Bump `lib/kubeclient/version.rb` manually, or by using:
|
22
15
|
```bash
|
16
|
+
RELEASE_BRANCH="master"
|
23
17
|
RELEASE_VERSION=x.y.z
|
24
18
|
|
25
19
|
git checkout -b "release-$RELEASE_VERSION" $RELEASE_BRANCH
|
20
|
+
```
|
21
|
+
|
22
|
+
Edit `CHANGELOG.md` as necessary. Even if all included changes remembered to update it, you should replace "Unreleased" section header with appropriate "x.y.z — 20yy-mm-dd" header.
|
23
|
+
|
24
|
+
Bump `lib/kubeclient/version.rb` manually, or by using:
|
25
|
+
```bash
|
26
26
|
# Won't work with uncommitted changes, you have to commit the changelog first.
|
27
27
|
gem bump --version $RELEASE_VERSION
|
28
28
|
git show # View version bump change.
|
@@ -46,7 +46,7 @@ Make sure we're locally after the bump PR *merge commit*:
|
|
46
46
|
```bash
|
47
47
|
git checkout $RELEASE_BRANCH
|
48
48
|
git status # Make sure there are no local changes
|
49
|
-
git pull --ff-only https://github.com/
|
49
|
+
git pull --ff-only https://github.com/ManageIQ/kubeclient $RELEASE_BRANCH
|
50
50
|
git log -n1
|
51
51
|
```
|
52
52
|
|
data/kubeclient.gemspec
CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
20
|
spec.test_files = []
|
21
21
|
spec.require_paths = ['lib']
|
22
|
-
spec.required_ruby_version = '>= 2.
|
22
|
+
spec.required_ruby_version = '>= 2.7.0'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '>= 1.6'
|
25
|
-
spec.add_development_dependency 'rake', '~>
|
26
|
-
spec.add_development_dependency 'minitest'
|
25
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
26
|
+
spec.add_development_dependency 'minitest', '~> 5.15.0'
|
27
27
|
spec.add_development_dependency 'minitest-rg'
|
28
28
|
spec.add_development_dependency 'webmock', '~> 3.0'
|
29
29
|
spec.add_development_dependency 'vcr'
|
@@ -32,9 +32,11 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency('mocha', '~> 1.5')
|
33
33
|
spec.add_development_dependency 'openid_connect', '~> 1.1'
|
34
34
|
spec.add_development_dependency 'net-smtp'
|
35
|
+
# needed on Windows, at least for openid_connect
|
36
|
+
spec.add_development_dependency 'tzinfo-data'
|
35
37
|
|
36
38
|
spec.add_dependency 'jsonpath', '~> 1.0'
|
37
39
|
spec.add_dependency 'rest-client', '~> 2.0'
|
38
40
|
spec.add_dependency 'recursive-open-struct', '~> 1.1', '>= 1.1.1'
|
39
|
-
spec.add_dependency 'http', '>= 3.0', '<
|
41
|
+
spec.add_dependency 'http', '>= 3.0', '< 6.0'
|
40
42
|
end
|
data/lib/kubeclient/common.rb
CHANGED
@@ -78,7 +78,7 @@ module Kubeclient
|
|
78
78
|
@api_version = version
|
79
79
|
@headers = {}
|
80
80
|
@ssl_options = ssl_options
|
81
|
-
@auth_options = auth_options
|
81
|
+
@auth_options = auth_options.dup
|
82
82
|
@socket_options = socket_options
|
83
83
|
# Allow passing partial timeouts hash, without unspecified
|
84
84
|
# @timeouts[:foo] == nil resulting in infinite timeout.
|
@@ -87,11 +87,11 @@ module Kubeclient
|
|
87
87
|
@http_max_redirects = http_max_redirects
|
88
88
|
@as = as
|
89
89
|
|
90
|
-
if auth_options[:
|
91
|
-
bearer_token(@auth_options[:bearer_token])
|
92
|
-
elsif auth_options[:bearer_token_file]
|
90
|
+
if auth_options[:bearer_token_file]
|
93
91
|
validate_bearer_token_file
|
94
92
|
bearer_token(File.read(@auth_options[:bearer_token_file]))
|
93
|
+
elsif auth_options[:bearer_token]
|
94
|
+
bearer_token(@auth_options[:bearer_token])
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -136,6 +136,11 @@ module Kubeclient
|
|
136
136
|
@discovered = true
|
137
137
|
end
|
138
138
|
|
139
|
+
def get_headers
|
140
|
+
bearer_token(File.read(@auth_options[:bearer_token_file])) if @auth_options[:bearer_token_file]
|
141
|
+
@headers
|
142
|
+
end
|
143
|
+
|
139
144
|
def self.parse_definition(kind, name)
|
140
145
|
# Kubernetes gives us 3 inputs:
|
141
146
|
# kind: "ComponentStatus", "NetworkPolicy", "Endpoints"
|
@@ -349,7 +354,7 @@ module Kubeclient
|
|
349
354
|
ns_prefix = build_namespace_prefix(options[:namespace])
|
350
355
|
response = handle_exception do
|
351
356
|
rest_client[ns_prefix + resource_name]
|
352
|
-
.get({ 'params' => params }.merge(
|
357
|
+
.get({ 'params' => params }.merge(get_headers))
|
353
358
|
end
|
354
359
|
format_response(options[:as] || @as, response.body, entity_type)
|
355
360
|
end
|
@@ -362,7 +367,7 @@ module Kubeclient
|
|
362
367
|
ns_prefix = build_namespace_prefix(namespace)
|
363
368
|
response = handle_exception do
|
364
369
|
rest_client[ns_prefix + resource_name + "/#{name}"]
|
365
|
-
.get(
|
370
|
+
.get(get_headers)
|
366
371
|
end
|
367
372
|
format_response(options[:as] || @as, response.body)
|
368
373
|
end
|
@@ -378,7 +383,7 @@ module Kubeclient
|
|
378
383
|
rs.options.merge(
|
379
384
|
method: :delete,
|
380
385
|
url: rs.url,
|
381
|
-
headers: { 'Content-Type' => 'application/json' }.merge(
|
386
|
+
headers: { 'Content-Type' => 'application/json' }.merge(get_headers),
|
382
387
|
payload: payload
|
383
388
|
)
|
384
389
|
)
|
@@ -400,7 +405,7 @@ module Kubeclient
|
|
400
405
|
hash[:apiVersion] = @api_group + @api_version
|
401
406
|
response = handle_exception do
|
402
407
|
rest_client[ns_prefix + resource_name]
|
403
|
-
.post(hash.to_json, { 'Content-Type' => 'application/json' }.merge(
|
408
|
+
.post(hash.to_json, { 'Content-Type' => 'application/json' }.merge(get_headers))
|
404
409
|
end
|
405
410
|
format_response(@as, response.body)
|
406
411
|
end
|
@@ -410,7 +415,7 @@ module Kubeclient
|
|
410
415
|
ns_prefix = build_namespace_prefix(entity_config[:metadata][:namespace])
|
411
416
|
response = handle_exception do
|
412
417
|
rest_client[ns_prefix + resource_name + "/#{name}"]
|
413
|
-
.put(entity_config.to_h.to_json, { 'Content-Type' => 'application/json' }.merge(
|
418
|
+
.put(entity_config.to_h.to_json, { 'Content-Type' => 'application/json' }.merge(get_headers))
|
414
419
|
end
|
415
420
|
format_response(@as, response.body)
|
416
421
|
end
|
@@ -421,7 +426,7 @@ module Kubeclient
|
|
421
426
|
rest_client[ns_prefix + resource_name + "/#{name}"]
|
422
427
|
.patch(
|
423
428
|
patch.to_json,
|
424
|
-
{ 'Content-Type' => "application/#{strategy}+json" }.merge(
|
429
|
+
{ 'Content-Type' => "application/#{strategy}+json" }.merge(get_headers)
|
425
430
|
)
|
426
431
|
end
|
427
432
|
format_response(@as, response.body)
|
@@ -434,7 +439,7 @@ module Kubeclient
|
|
434
439
|
rest_client[ns_prefix + resource_name + "/#{name}"]
|
435
440
|
.patch(
|
436
441
|
resource.to_json,
|
437
|
-
{ 'Content-Type' => 'application/apply-patch+yaml' }.merge(
|
442
|
+
{ 'Content-Type' => 'application/apply-patch+yaml' }.merge(get_headers)
|
438
443
|
)
|
439
444
|
end
|
440
445
|
format_response(@as, response.body)
|
@@ -468,7 +473,7 @@ module Kubeclient
|
|
468
473
|
ns = build_namespace_prefix(namespace)
|
469
474
|
handle_exception do
|
470
475
|
rest_client[ns + "pods/#{pod_name}/log"]
|
471
|
-
.get({ 'params' => params }.merge(
|
476
|
+
.get({ 'params' => params }.merge(get_headers))
|
472
477
|
end
|
473
478
|
end
|
474
479
|
|
@@ -506,7 +511,7 @@ module Kubeclient
|
|
506
511
|
ns_prefix = build_namespace_prefix(template[:metadata][:namespace])
|
507
512
|
response = handle_exception do
|
508
513
|
rest_client[ns_prefix + 'processedtemplates']
|
509
|
-
.post(template.to_h.to_json, { 'Content-Type' => 'application/json' }.merge(
|
514
|
+
.post(template.to_h.to_json, { 'Content-Type' => 'application/json' }.merge(get_headers))
|
510
515
|
end
|
511
516
|
JSON.parse(response)
|
512
517
|
end
|
@@ -519,7 +524,7 @@ module Kubeclient
|
|
519
524
|
end
|
520
525
|
|
521
526
|
def api
|
522
|
-
response = handle_exception { create_rest_client.get(
|
527
|
+
response = handle_exception { create_rest_client.get(get_headers) }
|
523
528
|
JSON.parse(response)
|
524
529
|
end
|
525
530
|
|
@@ -593,7 +598,7 @@ module Kubeclient
|
|
593
598
|
end
|
594
599
|
|
595
600
|
def fetch_entities
|
596
|
-
JSON.parse(handle_exception { rest_client.get(
|
601
|
+
JSON.parse(handle_exception { rest_client.get(get_headers) })
|
597
602
|
end
|
598
603
|
|
599
604
|
def bearer_token(bearer_token)
|
@@ -638,11 +643,11 @@ module Kubeclient
|
|
638
643
|
options = {
|
639
644
|
basic_auth_user: @auth_options[:username],
|
640
645
|
basic_auth_password: @auth_options[:password],
|
641
|
-
headers:
|
646
|
+
headers: get_headers,
|
642
647
|
http_proxy_uri: @http_proxy_uri,
|
643
648
|
http_max_redirects: http_max_redirects
|
644
649
|
}
|
645
|
-
|
650
|
+
options[:bearer_token_file] = @auth_options[:bearer_token_file] if @auth_options[:bearer_token_file]
|
646
651
|
if uri.scheme == 'https'
|
647
652
|
options[:ssl] = {
|
648
653
|
ca_file: @ssl_options[:ca_file],
|
data/lib/kubeclient/version.rb
CHANGED
@@ -79,6 +79,7 @@ module Kubeclient
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def build_client_options
|
82
|
+
@http_options[:headers][:Authorization] = "Bearer #{File.read(@http_options[:bearer_token_file])}" if @http_options[:bearer_token_file]
|
82
83
|
client_options = {
|
83
84
|
headers: @http_options[:headers],
|
84
85
|
proxy: using_proxy
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubeclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alissa Bonas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 5.15.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 5.15.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest-rg
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: tzinfo-data
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: jsonpath
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,7 +235,7 @@ dependencies:
|
|
221
235
|
version: '3.0'
|
222
236
|
- - "<"
|
223
237
|
- !ruby/object:Gem::Version
|
224
|
-
version: '
|
238
|
+
version: '6.0'
|
225
239
|
type: :runtime
|
226
240
|
prerelease: false
|
227
241
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -231,7 +245,7 @@ dependencies:
|
|
231
245
|
version: '3.0'
|
232
246
|
- - "<"
|
233
247
|
- !ruby/object:Gem::Version
|
234
|
-
version: '
|
248
|
+
version: '6.0'
|
235
249
|
description: A client for Kubernetes REST api
|
236
250
|
email:
|
237
251
|
- abonas@redhat.com
|
@@ -277,14 +291,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
277
291
|
requirements:
|
278
292
|
- - ">="
|
279
293
|
- !ruby/object:Gem::Version
|
280
|
-
version: 2.
|
294
|
+
version: 2.7.0
|
281
295
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
282
296
|
requirements:
|
283
297
|
- - ">="
|
284
298
|
- !ruby/object:Gem::Version
|
285
299
|
version: '0'
|
286
300
|
requirements: []
|
287
|
-
rubygems_version: 3.
|
301
|
+
rubygems_version: 3.2.32
|
288
302
|
signing_key:
|
289
303
|
specification_version: 4
|
290
304
|
summary: A client for Kubernetes REST api
|