kruby 1.36.0.4 → 1.36.1.1
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 +58 -0
- data/lib/kubernetes/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3ee9a86d08b3ff0438f8aea702f9e76ca82e28609d5de1f43e3a4d5068551af
|
|
4
|
+
data.tar.gz: 54e1782b07ba5b9d517cc75f447406cb2b43a5511fc87723a365bf857f2a9f06
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78735449c98daaa2d42e6b1038d87ecebd5b2173e2357dfbe0db71cc19b3472b161aae7eed24959e7b854a87411e32e0038eb89c139bf2dcf8190a529f4a73e8
|
|
7
|
+
data.tar.gz: b3002a384c026a5fccc15a95b82efa9c59ea31f0f7c5bfea6efa4271ef5db823e956d7e25c303b6aeace8be7c8c068272e2cbbb4364c6906929a7ec3fbca0110
|
data/README.md
CHANGED
|
@@ -89,6 +89,64 @@ end
|
|
|
89
89
|
|
|
90
90
|
For backward compatibility, `require 'kubernetes'` is also supported.
|
|
91
91
|
|
|
92
|
+
## Usage Guides
|
|
93
|
+
|
|
94
|
+
### Common API entry points
|
|
95
|
+
|
|
96
|
+
- Core resources: [CoreV1Api](docs/CoreV1Api.md), [V1Pod](docs/V1Pod.md), [V1ConfigMap](docs/V1ConfigMap.md), [V1Service](docs/V1Service.md)
|
|
97
|
+
- Workloads: [AppsV1Api](docs/AppsV1Api.md), [BatchV1Api](docs/BatchV1Api.md), [V1Deployment](docs/V1Deployment.md), [V1StatefulSet](docs/V1StatefulSet.md)
|
|
98
|
+
- Networking and policy: [NetworkingV1Api](docs/NetworkingV1Api.md), [V1Ingress](docs/V1Ingress.md), [V1NetworkPolicy](docs/V1NetworkPolicy.md)
|
|
99
|
+
- Custom resources: [CustomObjectsApi](docs/CustomObjectsApi.md)
|
|
100
|
+
- Discovery and cluster metadata: [DiscoveryApi](docs/DiscoveryApi.md), [VersionApi](docs/VersionApi.md)
|
|
101
|
+
- Logs and streaming: [LogsApi](docs/LogsApi.md), `Kubernetes::Watch`
|
|
102
|
+
|
|
103
|
+
### Curated examples
|
|
104
|
+
|
|
105
|
+
- Full example index: <https://github.com/doridoridoriand/kruby/tree/master/examples/README.md>
|
|
106
|
+
- Minimal client: <https://github.com/doridoridoriand/kruby/blob/master/examples/simple/simple.rb>
|
|
107
|
+
- Safe dry-run write: <https://github.com/doridoridoriand/kruby/blob/master/examples/dry-run/dry-run.rb>
|
|
108
|
+
- Efficient filtered reads: <https://github.com/doridoridoriand/kruby/blob/master/examples/label-selector/label-selector.rb>
|
|
109
|
+
- Concurrent watches: <https://github.com/doridoridoriand/kruby/blob/master/examples/multi-watch/multi-watch.rb>
|
|
110
|
+
- Logs with lifecycle cleanup: <https://github.com/doridoridoriand/kruby/blob/master/examples/logs/logs.rb>
|
|
111
|
+
|
|
112
|
+
### Error handling
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
config = Kubernetes::Configuration.default_config
|
|
116
|
+
Kubernetes.load_kube_config(ENV["KUBECONFIG"], client_configuration: config)
|
|
117
|
+
client = Kubernetes::CoreV1Api.new(Kubernetes::ApiClient.new(config))
|
|
118
|
+
|
|
119
|
+
begin
|
|
120
|
+
pod = client.read_namespaced_pod("example", "default")
|
|
121
|
+
puts pod.metadata.name
|
|
122
|
+
rescue Kubernetes::ApiError => e
|
|
123
|
+
case e.code.to_i
|
|
124
|
+
when 404
|
|
125
|
+
warn "Pod was not found"
|
|
126
|
+
when 409
|
|
127
|
+
warn "Resource version conflict"
|
|
128
|
+
else
|
|
129
|
+
warn "Kubernetes API call failed: #{e.message}"
|
|
130
|
+
raise
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Concurrent usage
|
|
136
|
+
|
|
137
|
+
When you need multiple long-lived streams, create one `Kubernetes::ApiClient`, wrap it in `Kubernetes::Watch`, and fan out watches in threads.
|
|
138
|
+
See the `multi-watch` example for a concrete pattern:
|
|
139
|
+
|
|
140
|
+
- <https://github.com/doridoridoriand/kruby/blob/master/examples/multi-watch/multi-watch.rb>
|
|
141
|
+
|
|
142
|
+
### Performance tips
|
|
143
|
+
|
|
144
|
+
- Reuse a single `Kubernetes::ApiClient` and API object across many calls instead of rebuilding them per request.
|
|
145
|
+
- Prefer `label_selector` and `field_selector` when listing large collections.
|
|
146
|
+
- Use `Kubernetes::Watch` for change streams instead of frequent polling loops.
|
|
147
|
+
- Start from namespaced list/read methods when you already know the namespace to reduce server-side work.
|
|
148
|
+
- Use dry-run for manifest validation paths that should not persist resources.
|
|
149
|
+
|
|
92
150
|
## Documentation for API Endpoints
|
|
93
151
|
|
|
94
152
|
All URIs are relative to *http://localhost*
|
data/lib/kubernetes/version.rb
CHANGED