kubeclient 4.7.0 → 4.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/.github/workflows/actions.yml +43 -0
- data/.rubocop.yml +111 -14
- data/CHANGELOG.md +119 -0
- data/README.md +41 -4
- data/RELEASING.md +8 -8
- data/kubeclient.gemspec +11 -7
- data/lib/kubeclient/aws_eks_credentials.rb +17 -8
- data/lib/kubeclient/common.rb +55 -21
- data/lib/kubeclient/config.rb +33 -13
- data/lib/kubeclient/exec_credentials.rb +33 -4
- data/lib/kubeclient/version.rb +1 -1
- data/lib/kubeclient/watch_stream.rb +1 -0
- metadata +46 -222
- data/.travis.yml +0 -29
- data/test/cassettes/kubernetes_guestbook.yml +0 -879
- data/test/config/allinone.kubeconfig +0 -20
- data/test/config/execauth.kubeconfig +0 -62
- data/test/config/external-ca.pem +0 -18
- data/test/config/external-cert.pem +0 -19
- data/test/config/external-key.rsa +0 -27
- data/test/config/external.kubeconfig +0 -20
- data/test/config/gcpauth.kubeconfig +0 -22
- data/test/config/gcpcmdauth.kubeconfig +0 -26
- data/test/config/nouser.kubeconfig +0 -16
- data/test/config/oidcauth.kubeconfig +0 -25
- data/test/config/timestamps.kubeconfig +0 -25
- data/test/config/userauth.kubeconfig +0 -28
- data/test/json/bindings_list.json +0 -10
- data/test/json/component_status.json +0 -17
- data/test/json/component_status_list.json +0 -52
- data/test/json/config.istio.io_api_resource_list.json +0 -679
- data/test/json/config_map_list.json +0 -9
- data/test/json/core_api_resource_list.json +0 -181
- data/test/json/core_api_resource_list_without_kind.json +0 -129
- data/test/json/core_oapi_resource_list_without_kind.json +0 -197
- data/test/json/created_endpoint.json +0 -28
- data/test/json/created_namespace.json +0 -20
- data/test/json/created_secret.json +0 -16
- data/test/json/created_security_context_constraint.json +0 -65
- data/test/json/created_service.json +0 -31
- data/test/json/empty_pod_list.json +0 -9
- data/test/json/endpoint_list.json +0 -48
- data/test/json/entity_list.json +0 -56
- data/test/json/event_list.json +0 -35
- data/test/json/extensions_v1beta1_api_resource_list.json +0 -217
- data/test/json/limit_range.json +0 -23
- data/test/json/limit_range_list.json +0 -31
- data/test/json/namespace.json +0 -13
- data/test/json/namespace_exception.json +0 -8
- data/test/json/namespace_list.json +0 -32
- data/test/json/node.json +0 -29
- data/test/json/node_list.json +0 -37
- data/test/json/node_notice.json +0 -160
- data/test/json/persistent_volume.json +0 -37
- data/test/json/persistent_volume_claim.json +0 -32
- data/test/json/persistent_volume_claim_list.json +0 -40
- data/test/json/persistent_volume_claims_nil_items.json +0 -8
- data/test/json/persistent_volume_list.json +0 -45
- data/test/json/pod.json +0 -92
- data/test/json/pod_list.json +0 -79
- data/test/json/pod_template_list.json +0 -9
- data/test/json/pods_1.json +0 -265
- data/test/json/pods_2.json +0 -102
- data/test/json/pods_410.json +0 -9
- data/test/json/processed_template.json +0 -27
- data/test/json/replication_controller.json +0 -57
- data/test/json/replication_controller_list.json +0 -66
- data/test/json/resource_quota.json +0 -46
- data/test/json/resource_quota_list.json +0 -54
- data/test/json/secret_list.json +0 -44
- data/test/json/security.openshift.io_api_resource_list.json +0 -69
- data/test/json/security_context_constraint_list.json +0 -375
- data/test/json/service.json +0 -33
- data/test/json/service_account.json +0 -25
- data/test/json/service_account_list.json +0 -82
- data/test/json/service_illegal_json_404.json +0 -1
- data/test/json/service_json_patch.json +0 -26
- data/test/json/service_list.json +0 -97
- data/test/json/service_merge_patch.json +0 -26
- data/test/json/service_patch.json +0 -25
- data/test/json/service_update.json +0 -22
- data/test/json/template.json +0 -27
- data/test/json/template.openshift.io_api_resource_list.json +0 -75
- data/test/json/template_list.json +0 -35
- data/test/json/versions_list.json +0 -6
- data/test/json/watch_stream.json +0 -3
- data/test/test_common.rb +0 -95
- data/test/test_component_status.rb +0 -29
- data/test/test_config.rb +0 -222
- data/test/test_endpoint.rb +0 -54
- data/test/test_exec_credentials.rb +0 -125
- data/test/test_gcp_command_credentials.rb +0 -27
- data/test/test_google_application_default_credentials.rb +0 -15
- data/test/test_guestbook_go.rb +0 -235
- data/test/test_helper.rb +0 -18
- data/test/test_kubeclient.rb +0 -881
- data/test/test_limit_range.rb +0 -25
- data/test/test_missing_methods.rb +0 -80
- data/test/test_namespace.rb +0 -59
- data/test/test_node.rb +0 -70
- data/test/test_oidc_auth_provider.rb +0 -103
- data/test/test_persistent_volume.rb +0 -29
- data/test/test_persistent_volume_claim.rb +0 -28
- data/test/test_pod.rb +0 -81
- data/test/test_pod_log.rb +0 -157
- data/test/test_process_template.rb +0 -80
- data/test/test_replication_controller.rb +0 -47
- data/test/test_resource_list_without_kind.rb +0 -78
- data/test/test_resource_quota.rb +0 -23
- data/test/test_secret.rb +0 -62
- data/test/test_security_context_constraint.rb +0 -62
- data/test/test_service.rb +0 -330
- data/test/test_service_account.rb +0 -26
- data/test/test_watch.rb +0 -195
- data/test/txt/pod_log.txt +0 -6
- data/test/valid_token_file +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21e5de1343a8f393c8eef653af1bb41e061bbee7fafa5d8cedafe8c163653071
|
4
|
+
data.tar.gz: aebdf094e7b05239467c8120382e47b65c82e031092cfc728b605f158257800a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 161d8585521513897f730c0c1ab5f060634533cff048e146819dfa5c93e60afbdb67a4ed314245d61e343f7eca891454b2022e4ed9ced0117d518a8c2eb78ffa
|
7
|
+
data.tar.gz: 7f42460a4528177faccc81526ffc0904a5a7cc89ac56013fe99c208b6ab6cc2e7f289e1a654cb67f5f85985ffcd98af4b9e93b49cd052963d4d333697f50a7d5
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: CI
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- '**'
|
6
|
+
tags:
|
7
|
+
- '**'
|
8
|
+
pull_request:
|
9
|
+
branches:
|
10
|
+
- '**'
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
continue-on-error: true
|
14
|
+
runs-on: ${{ matrix.os_and_command.os }}
|
15
|
+
strategy:
|
16
|
+
matrix:
|
17
|
+
ruby: [ '2.7', '3.0', '3.1', '3.2', 'ruby-head', 'truffleruby-head' ]
|
18
|
+
os_and_command:
|
19
|
+
- os: macos-latest
|
20
|
+
command: 'env TESTOPTS="--verbose" bundle exec rake test'
|
21
|
+
- os: windows-latest
|
22
|
+
command: 'env TESTOPTS="--verbose" bundle exec rake test'
|
23
|
+
- os: ubuntu-latest
|
24
|
+
# Sometimes minitest starts and then just hangs printing nothing.
|
25
|
+
# Github by default kills after 6hours(!). Hopefully SIGTERM may let it print some details?
|
26
|
+
command: 'timeout --signal=TERM 3m env TESTOPTS="--verbose" test/config/update_certs_k0s.rb'
|
27
|
+
include:
|
28
|
+
# run rubocop against lowest supported ruby
|
29
|
+
- os: ubuntu-latest
|
30
|
+
ruby: '2.7'
|
31
|
+
command: 'bundle exec rake rubocop'
|
32
|
+
name: ${{ matrix.os_and_command.os }} ${{ matrix.ruby }} rake ${{ matrix.os_and_command.command }}
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v4
|
35
|
+
# actions/setup-ruby did not support truffle or bundler caching
|
36
|
+
- uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: ${{ matrix.ruby }}
|
39
|
+
bundler-cache: false # disable running 'bundle install' and caching installed gems see https://github.com/httprb/http/issues/572
|
40
|
+
- run: bundle install
|
41
|
+
- run: ${{ matrix.os_and_command.command }}
|
42
|
+
timeout-minutes: 10
|
43
|
+
|
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,6 +4,125 @@ 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.12.0 - 2024-06-18
|
8
|
+
|
9
|
+
### Added
|
10
|
+
- Add test coverage for Ruby 3.2 (#615)
|
11
|
+
- Allow a region when getting a signer for Aws::Sts (#507)
|
12
|
+
- Update the AWS STS endpoint to be regional as the method is now regional (#528)
|
13
|
+
- Assume role support for aws eks credentials (#630)
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- [v4.y] Regenerated expired test TLS certs by running `test/config/update_certs_k0s.rb`.
|
17
|
+
- [v4.y] Regenerated expired test TLS certs (#611)
|
18
|
+
- Regenerated expired test TLS certs (#632)
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
- Update actions/checkout (#590)
|
22
|
+
- chore(deps): update actions/checkout action to v4 (#619)
|
23
|
+
|
24
|
+
## 4.11.0 — 2022-12-22
|
25
|
+
|
26
|
+
### Removed
|
27
|
+
|
28
|
+
- Dropped support for EOL Ruby versions 2.5, 2.6. (#589)
|
29
|
+
|
30
|
+
### Added
|
31
|
+
|
32
|
+
- Relaxed dependency on `http` gem (used for watches) to allow 5.y.z versions. (#589)
|
33
|
+
|
34
|
+
- Specifically, http 5.1.1 may fix issues watching with IPv6. (#585)
|
35
|
+
|
36
|
+
## 4.10.1 — 2022-10-01
|
37
|
+
|
38
|
+
### Removed
|
39
|
+
|
40
|
+
- Dropped debug logging about bearer token options that was added in 4.10.0. (#577)
|
41
|
+
|
42
|
+
## 4.10.0 — 2022-08-29
|
43
|
+
|
44
|
+
### Added
|
45
|
+
|
46
|
+
- When using `:bearer_token_file`, re-read the file on every request. (#566 closed #561)
|
47
|
+
|
48
|
+
Kubernetes version 1.21 graduated [BoundServiceAccountTokenVolume feature][] to beta
|
49
|
+
and enabled it by default, so standard in-cluster auth now uses short-lived tokens.
|
50
|
+
|
51
|
+
This changes allows a long-lived `Client` object to keep working when the token file gets
|
52
|
+
rotated. It's not optimized at all, if you feel the performance overhead, please report!
|
53
|
+
|
54
|
+
[BoundServiceAccountTokenVolume feature]: https://github.com/kubernetes/enhancements/issues/542
|
55
|
+
|
56
|
+
## 4.9.3 — 2022-03-23
|
57
|
+
|
58
|
+
### Fixed
|
59
|
+
|
60
|
+
- VULNERABILITY FIX: Previously, whenever kubeconfig did not define custom CA
|
61
|
+
(normal situation for production clusters with public domain and certificate!),
|
62
|
+
`Config` was returning ssl_options[:verify_ssl] hard-coded to `VERIFY_NONE` :-(
|
63
|
+
|
64
|
+
Assuming you passed those ssl_options to Kubeclient::Client, this means that
|
65
|
+
instead of checking server's certificate against your system CA store,
|
66
|
+
it would accept ANY certificate, allowing easy man-in-the middle attacks.
|
67
|
+
|
68
|
+
This is especially dangerous with user/password or token credentials
|
69
|
+
because MITM attacker could simply steal those credentials to the cluster
|
70
|
+
and do anything you could do on the cluster.
|
71
|
+
|
72
|
+
This was broken IN ALL RELEASES MADE BEFORE 2022, ever since
|
73
|
+
[`Kubeclient::Config` was created](https://github.com/ManageIQ/kubeclient/pull/127/files#diff-32e70f2f6781a9e9c7b83ae5e7eaf5ffd068a05649077fa38f6789e72f3de837R41-R48).
|
74
|
+
|
75
|
+
[#554](https://github.com/ManageIQ/kubeclient/issues/554).
|
76
|
+
|
77
|
+
- Bug fix: kubeconfig `insecure-skip-tls-verify` field was ignored.
|
78
|
+
When kubeconfig did define custom CA, `Config` was returning hard-coded `VERIFY_PEER`.
|
79
|
+
|
80
|
+
Now we honor it, return `VERIFY_NONE` iff kubeconfig has explicit
|
81
|
+
`insecure-skip-tls-verify: true`, otherwise `VERIFY_PEER`.
|
82
|
+
|
83
|
+
[#555](https://github.com/ManageIQ/kubeclient/issues/555).
|
84
|
+
|
85
|
+
- `Config`: fixed parsing of `certificate-authority` file containing concatenation of
|
86
|
+
several certificates. Previously, server's cert was checked against only first CA cert,
|
87
|
+
resulting in possible "certificate verify failed" errors.
|
88
|
+
|
89
|
+
An important use case is a chain of root & intermediate cert(s) - necessary when cluster's CA
|
90
|
+
itself is signed by another custom CA.
|
91
|
+
But also helps when you simply concatenate independent certs. (#461, #552)
|
92
|
+
|
93
|
+
- Still broken (#460): inline `certificate-authority-data` is still parsed using `add_cert`
|
94
|
+
method that handles only one cert.
|
95
|
+
|
96
|
+
These don't affect code that supplies `Client` parameters directly,
|
97
|
+
only code that uses `Config`.
|
98
|
+
|
99
|
+
## 4.9.2 — 2021-05-30
|
100
|
+
|
101
|
+
### Added
|
102
|
+
- Ruby 3.0 compatibility (#500, #505).
|
103
|
+
|
104
|
+
### Removed
|
105
|
+
- Reduce .gem size by dropping test/ directory, it's useless at run time (#502).
|
106
|
+
|
107
|
+
## 4.9.1 — 2020-08-31
|
108
|
+
### Fixed
|
109
|
+
- Now should work with apiserver deployed not at root of domain but a sub-path,
|
110
|
+
which is standard with Rancher.
|
111
|
+
Notably, `create_...` methods were sending bad apiVersion and getting 400 error.
|
112
|
+
(#457, hopefully fixes #318, #418 and https://gitlab.com/gitlab-org/gitlab/-/issues/22043)
|
113
|
+
|
114
|
+
## 4.9.0 - 2020-08-03
|
115
|
+
### Added
|
116
|
+
- Support for `user: exec` credential plugins using TLS client auth (#453)
|
117
|
+
|
118
|
+
## 4.8.0 — 2020-07-03
|
119
|
+
|
120
|
+
### Added
|
121
|
+
- Support for server-side apply (#448).
|
122
|
+
|
123
|
+
### Fixed
|
124
|
+
- Declared forgotten dependency on jsonpath, needed for `gcp` provider with `cmd-path` (#450).
|
125
|
+
|
7
126
|
## 4.7.0 — 2020-06-14
|
8
127
|
|
9
128
|
### Fixed
|
data/README.md
CHANGED
@@ -9,6 +9,12 @@ The client supports GET, POST, PUT, DELETE on all the entities available in kube
|
|
9
9
|
The client currently supports Kubernetes REST api version v1.
|
10
10
|
To learn more about groups and versions in kubernetes refer to [k8s docs](https://kubernetes.io/docs/api/)
|
11
11
|
|
12
|
+
## VULNERABILITY❗
|
13
|
+
|
14
|
+
If you use `Kubeclient::Config`, all gem versions released before 2022 could return incorrect `ssl_options[:verify_ssl]`,
|
15
|
+
endangering your connection and cluster credentials.
|
16
|
+
See https://github.com/ManageIQ/kubeclient/issues/554 for details and which versions got a fix.
|
17
|
+
|
12
18
|
## Installation
|
13
19
|
|
14
20
|
Add this line to your application's Gemfile:
|
@@ -98,8 +104,8 @@ client = Kubeclient::Client.new(
|
|
98
104
|
### Authentication
|
99
105
|
|
100
106
|
If you are using basic authentication or bearer tokens as described
|
101
|
-
[here](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/authentication.md)
|
102
|
-
of the following:
|
107
|
+
[here](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/authentication.md)
|
108
|
+
then you can specify one of the following:
|
103
109
|
|
104
110
|
```ruby
|
105
111
|
auth_options = {
|
@@ -111,7 +117,7 @@ client = Kubeclient::Client.new(
|
|
111
117
|
)
|
112
118
|
```
|
113
119
|
|
114
|
-
or
|
120
|
+
or (fixed token, if it expires it's up to you to create a new `Client` object):
|
115
121
|
|
116
122
|
```ruby
|
117
123
|
auth_options = {
|
@@ -122,7 +128,7 @@ client = Kubeclient::Client.new(
|
|
122
128
|
)
|
123
129
|
```
|
124
130
|
|
125
|
-
or
|
131
|
+
or (will automatically re-read the token if file is updated):
|
126
132
|
|
127
133
|
```ruby
|
128
134
|
auth_options = {
|
@@ -307,10 +313,14 @@ require 'aws-sdk-core'
|
|
307
313
|
credentials = Aws::Credentials.new(access_key, secret_key)
|
308
314
|
# Or a profile
|
309
315
|
credentials = Aws::SharedCredentials.new(profile_name: 'default').credentials
|
316
|
+
# Or for an STS Assumed Role Credentials or any other credential Provider other than Static Credentials
|
317
|
+
credentials = Aws::AssumeRoleCredentials.new({ client: sts_client, role_arn: role_arn, role_session_name: session_name })
|
310
318
|
|
319
|
+
# Kubeclient Auth Options
|
311
320
|
auth_options = {
|
312
321
|
bearer_token: Kubeclient::AmazonEksCredentials.token(credentials, eks_cluster_name)
|
313
322
|
}
|
323
|
+
|
314
324
|
client = Kubeclient::Client.new(
|
315
325
|
eks_cluster_https_endpoint, 'v1', auth_options: auth_options
|
316
326
|
)
|
@@ -447,6 +457,9 @@ update_foo(Kubeclient::Resource.new({metadata: {name: 'name', ...}, ...})) # gl
|
|
447
457
|
|
448
458
|
patch_foo('name', patch, 'namespace') # namespaced
|
449
459
|
patch_foo('name', patch) # global
|
460
|
+
|
461
|
+
apply_foo(Kubeclient::Resource.new({metadata: {name: 'name', namespace: 'namespace', ...}, ...}), field_manager: 'myapp', **opts)
|
462
|
+
apply_foo(Kubeclient::Resource.new({metadata: {name: 'name', ...}, ...}), field_manager: 'myapp', **opts) # global
|
450
463
|
```
|
451
464
|
|
452
465
|
These grew to be quite inconsistent :confounded:, see https://github.com/abonas/kubeclient/issues/312 and https://github.com/abonas/kubeclient/issues/332 for improvement plans.
|
@@ -702,6 +715,30 @@ patched = client.patch_pod("docker-registry", {metadata: {annotations: {key: 'va
|
|
702
715
|
|
703
716
|
`patch_#{entity}` is called using a [strategic merge patch](https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#notes-on-the-strategic-merge-patch). `json_patch_#{entity}` and `merge_patch_#{entity}` are also available that use JSON patch and JSON merge patch, respectively. These strategies are useful for resources that do not support strategic merge patch, such as Custom Resources. Consult the [Kubernetes docs](https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment) for more information about the different patch strategies.
|
704
717
|
|
718
|
+
### Apply an entity
|
719
|
+
|
720
|
+
This is similar to `kubectl apply --server-side` (kubeclient doesn't implement logic for client-side apply). See https://kubernetes.io/docs/reference/using-api/api-concepts/#server-side-apply
|
721
|
+
|
722
|
+
For example: `apply_pod`
|
723
|
+
|
724
|
+
Input parameters - resource (Kubeclient::Resource) representing the desired state of the resource, field_manager (String) to identify the system managing the state of the resource, force (Boolean) whether or not to override a field managed by someone else.
|
725
|
+
|
726
|
+
Example:
|
727
|
+
|
728
|
+
```ruby
|
729
|
+
service = Kubeclient::Resource.new(
|
730
|
+
metadata: {
|
731
|
+
name: 'redis-master',
|
732
|
+
namespace: 'staging',
|
733
|
+
},
|
734
|
+
spec: {
|
735
|
+
...
|
736
|
+
}
|
737
|
+
)
|
738
|
+
|
739
|
+
client.apply_service(service, field_manager: 'myapp')
|
740
|
+
```
|
741
|
+
|
705
742
|
### Get all entities of all types : all_entities
|
706
743
|
|
707
744
|
Makes requests for all entities of each discovered kind (in this client's API group). This method is a convenience method instead of calling each entity's get method separately.
|
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
@@ -14,15 +14,16 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = 'https://github.com/abonas/kubeclient'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
|
-
|
17
|
+
git_files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.files = git_files.grep_v(%r{^(test|spec|features)/})
|
18
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files =
|
20
|
+
spec.test_files = []
|
20
21
|
spec.require_paths = ['lib']
|
21
|
-
spec.required_ruby_version = '>= 2.
|
22
|
+
spec.required_ruby_version = '>= 2.7.0'
|
22
23
|
|
23
24
|
spec.add_development_dependency 'bundler', '>= 1.6'
|
24
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
-
spec.add_development_dependency 'minitest'
|
25
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
26
|
+
spec.add_development_dependency 'minitest', '~> 5.15.0'
|
26
27
|
spec.add_development_dependency 'minitest-rg'
|
27
28
|
spec.add_development_dependency 'webmock', '~> 3.0'
|
28
29
|
spec.add_development_dependency 'vcr'
|
@@ -30,9 +31,12 @@ Gem::Specification.new do |spec|
|
|
30
31
|
spec.add_development_dependency 'googleauth', '~> 0.5.1'
|
31
32
|
spec.add_development_dependency('mocha', '~> 1.5')
|
32
33
|
spec.add_development_dependency 'openid_connect', '~> 1.1'
|
33
|
-
spec.add_development_dependency '
|
34
|
+
spec.add_development_dependency 'net-smtp'
|
35
|
+
# needed on Windows, at least for openid_connect
|
36
|
+
spec.add_development_dependency 'tzinfo-data'
|
34
37
|
|
38
|
+
spec.add_dependency 'jsonpath', '~> 1.0'
|
35
39
|
spec.add_dependency 'rest-client', '~> 2.0'
|
36
40
|
spec.add_dependency 'recursive-open-struct', '~> 1.1', '>= 1.1.1'
|
37
|
-
spec.add_dependency 'http', '>= 3.0', '<
|
41
|
+
spec.add_dependency 'http', '>= 3.0', '< 6.0'
|
38
42
|
end
|
@@ -7,7 +7,7 @@ module Kubeclient
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class << self
|
10
|
-
def token(credentials, eks_cluster)
|
10
|
+
def token(credentials, eks_cluster, region: 'us-east-1')
|
11
11
|
begin
|
12
12
|
require 'aws-sigv4'
|
13
13
|
require 'base64'
|
@@ -20,17 +20,26 @@ module Kubeclient
|
|
20
20
|
end
|
21
21
|
# https://github.com/aws/aws-sdk-ruby/pull/1848
|
22
22
|
# Get a signer
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
signer = if credentials.respond_to?(:credentials)
|
24
|
+
Aws::Sigv4::Signer.new(
|
25
|
+
service: 'sts',
|
26
|
+
region: region,
|
27
|
+
credentials_provider: credentials
|
28
|
+
)
|
29
|
+
else
|
30
|
+
Aws::Sigv4::Signer.new(
|
31
|
+
service: 'sts',
|
32
|
+
region: region,
|
33
|
+
credentials: credentials
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
credentials = credentials.credentials if credentials.respond_to?(:credentials)
|
29
38
|
|
30
39
|
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Sigv4/Signer.html#presign_url-instance_method
|
31
40
|
presigned_url_string = signer.presign_url(
|
32
41
|
http_method: 'GET',
|
33
|
-
url:
|
42
|
+
url: "https://sts.#{region}.amazonaws.com/?Action=GetCallerIdentity&Version=2011-06-15",
|
34
43
|
body: '',
|
35
44
|
credentials: credentials,
|
36
45
|
expires_in: 60,
|