kube_schema 1.9.2 → 1.11.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/CHANGELOG.md +42 -0
- data/Gemfile.lock +3 -1
- data/flake.nix +8 -6
- data/kube_schema.gemspec +1 -0
- data/lefthook.yml +11 -0
- data/lib/kube/schema/instance.rb +41 -0
- data/lib/kube/schema/version.rb +1 -1
- data/lib/kube/schema.rb +20 -0
- data/schemas/crd-definitions.json +233310 -180574
- metadata +17 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6007594b371eeb36c26edde49a50c9ad8f4a2024784f4ef1add3eee59afaa8d
|
|
4
|
+
data.tar.gz: abb0766ced76224828aa5356bc52bcaffe738ce99a4bd6369458a1555b2f3579
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61eb43c26cf34db4c66b078169f8b23d36db383b80eb337cd39f4b61c69c36604f6bcec08606d90496ca825b70c50875deb99105db198f81532d055501baf310
|
|
7
|
+
data.tar.gz: 05316b1722bb83a2e182ba39afe1c109b50e92fe0fcc5839d12aaa80649241e533c98d731a956181475799e57b9a30714f1e146eb01ce3207b785f889c1fcb10
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
This file starts at 1.10.0; for earlier releases see the git history.
|
|
6
|
+
|
|
7
|
+
## [1.11.0]
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `Kube::Schema.api_groups` and `Instance#api_groups` — every API group known
|
|
12
|
+
to the schema (built-in types, the merged CRD bundles, and schemas
|
|
13
|
+
registered via `.register`), sorted and deduplicated, with the core group
|
|
14
|
+
as `""`. Intended for consumers that need to distinguish group/resource
|
|
15
|
+
from core resource/subresource strings — e.g. building RBAC rules — without
|
|
16
|
+
hardcoding a group list.
|
|
17
|
+
|
|
18
|
+
## [1.10.0]
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- JuiceFS Operator schemas (`juicefs.io/v1`), from
|
|
23
|
+
[juicedata/juicefs-operator](https://github.com/juicedata/juicefs-operator)
|
|
24
|
+
v0.8.5: `CacheGroup`, `CronSync`, `Sync`, `WarmUp`.
|
|
25
|
+
- Agent Sandbox schemas, picked up from upstream drift on an already-tracked
|
|
26
|
+
source: `Sandbox` (`agents.x-k8s.io/v1alpha1`), plus `SandboxClaim`,
|
|
27
|
+
`SandboxTemplate` and `SandboxWarmPool`
|
|
28
|
+
(`extensions.agents.x-k8s.io/v1alpha1`).
|
|
29
|
+
- VictoriaMetrics `VLDistributed` (`operator.victoriametrics.com/v1alpha1`),
|
|
30
|
+
also from upstream drift.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Pinned the Gateway API Inference CRD sources to v1.5.0. Upstream removed
|
|
35
|
+
`inferenceobjectives.yaml` and `inferencemodelrewrites.yaml` from `main`,
|
|
36
|
+
which broke schema generation and would otherwise have dropped those kinds.
|
|
37
|
+
- Preserved the `metrics.k8s.io/v1beta1` definitions (`PodMetrics`,
|
|
38
|
+
`NodeMetrics`, their list types and `ContainerMetrics`) along with
|
|
39
|
+
`meta.v1.Duration`. Newer k3s images no longer surface the metrics-server
|
|
40
|
+
types in `/openapi/v2`, so regenerating the schemas silently dropped them.
|
|
41
|
+
|
|
42
|
+
No definitions were removed in this release.
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
kube_schema (1.
|
|
4
|
+
kube_schema (1.11.0)
|
|
5
5
|
json_schemer (~> 2.5.0)
|
|
6
6
|
rubyshell (~> 1.5.0)
|
|
7
7
|
|
|
@@ -105,6 +105,7 @@ GEM
|
|
|
105
105
|
hana (~> 1.3)
|
|
106
106
|
regexp_parser (~> 2.0)
|
|
107
107
|
simpleidn (~> 0.2)
|
|
108
|
+
lefthook (2.1.10)
|
|
108
109
|
localhost (1.7.0)
|
|
109
110
|
logger (1.7.0)
|
|
110
111
|
mail (2.9.0)
|
|
@@ -229,6 +230,7 @@ DEPENDENCIES
|
|
|
229
230
|
bake-modernize
|
|
230
231
|
bake-releases
|
|
231
232
|
kube_schema!
|
|
233
|
+
lefthook (~> 2.1)
|
|
232
234
|
rake (~> 13.0)
|
|
233
235
|
rspec (~> 3.13)
|
|
234
236
|
utopia-project
|
data/flake.nix
CHANGED
|
@@ -18,18 +18,20 @@
|
|
|
18
18
|
];
|
|
19
19
|
|
|
20
20
|
buildInputs = [
|
|
21
|
+
pkgs.trufflehog
|
|
21
22
|
ruby
|
|
22
23
|
pkgs.libyaml # psych gem
|
|
23
24
|
pkgs.openssl # openssl gem
|
|
24
25
|
];
|
|
25
26
|
|
|
26
27
|
shellHook = ''
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
export GEM_HOME="$HOME/.gem-${ruby.version}"
|
|
29
|
+
export GEM_PATH="$GEM_HOME"
|
|
30
|
+
export PATH="$GEM_HOME/bin:$PATH"
|
|
31
|
+
export BUNDLE_GEMFILE="$PWD/Gemfile"
|
|
32
|
+
export BUNDLE_PATH="$GEM_HOME"
|
|
33
|
+
export BUNDLE_BIN="$GEM_HOME/bin"
|
|
34
|
+
'';
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
);
|
data/kube_schema.gemspec
CHANGED
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
|
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.13"
|
|
32
32
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
33
|
+
spec.add_development_dependency "lefthook", "~> 2.1"
|
|
33
34
|
|
|
34
35
|
spec.add_dependency "rubyshell", "~> 1.5.0"
|
|
35
36
|
spec.add_dependency "json_schemer", "~> 2.5.0"
|
data/lefthook.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Git hooks (managed by lefthook). Install with `bundle exec lefthook install`.
|
|
2
|
+
#
|
|
3
|
+
# pre-commit: scan for secrets (trufflehog) and run the test suite (bin/test).
|
|
4
|
+
# Both are wrapped in `nix develop --command` because the hook fires outside the
|
|
5
|
+
# flake devshell, so trufflehog / bundler / scampi wouldn't otherwise be on PATH.
|
|
6
|
+
pre-commit:
|
|
7
|
+
commands:
|
|
8
|
+
secrets:
|
|
9
|
+
run: nix develop --command trufflehog git file://. --since-commit HEAD --only-verified --fail
|
|
10
|
+
tests:
|
|
11
|
+
run: nix develop --command bin/test
|
data/lib/kube/schema/instance.rb
CHANGED
|
@@ -102,6 +102,21 @@ module Kube
|
|
|
102
102
|
(gvk_index.keys + custom_kinds).uniq.sort
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
+
# All API groups known to this version, including any custom schemas
|
|
106
|
+
# registered via Kube::Schema.register. The core API group is the
|
|
107
|
+
# empty string.
|
|
108
|
+
#
|
|
109
|
+
# instance.api_groups # => ["", "apps", "argoproj.io", "batch", ...]
|
|
110
|
+
#
|
|
111
|
+
# @return [Array<String>] sorted, deduplicated group names
|
|
112
|
+
def api_groups
|
|
113
|
+
custom_groups = Schema.custom_schemas.keys.filter_map do |key|
|
|
114
|
+
parts = key.split("/")
|
|
115
|
+
parts.first if parts.size == 3
|
|
116
|
+
end
|
|
117
|
+
(gvk_index.values.flatten.map { |entry| entry[:group] } + custom_groups).uniq.sort
|
|
118
|
+
end
|
|
119
|
+
|
|
105
120
|
# Look up a sub-spec definition by short name (e.g. "Container",
|
|
106
121
|
# "ContainerPort", "Volume", "Probe"). Returns a class that
|
|
107
122
|
# inherits from Kube::Schema::SubSpec.
|
|
@@ -489,6 +504,32 @@ if __FILE__ == $0
|
|
|
489
504
|
end
|
|
490
505
|
end
|
|
491
506
|
|
|
507
|
+
describe "#api_groups" do
|
|
508
|
+
it "returns a sorted array of group names including the core group" do
|
|
509
|
+
groups = instance.api_groups
|
|
510
|
+
expect(groups).to be_an(Array)
|
|
511
|
+
expect(groups).to eq(groups.sort)
|
|
512
|
+
expect(groups).to include("")
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
it "includes built-in groups, including ones without dots" do
|
|
516
|
+
expect(instance.api_groups).to include("apps", "batch", "rbac.authorization.k8s.io")
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
it "includes groups from the merged CRD definition bundles" do
|
|
520
|
+
expect(instance.api_groups).to include("kubevirt.io", "argoproj.io")
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
it "includes groups from registered custom schemas" do
|
|
524
|
+
Kube::Schema.register("TenantVmClaim",
|
|
525
|
+
schema: { "type" => "object" },
|
|
526
|
+
api_version: "tradeportal.ai/v1")
|
|
527
|
+
expect(instance.api_groups).to include("tradeportal.ai")
|
|
528
|
+
ensure
|
|
529
|
+
Kube::Schema.reset_custom_schemas!
|
|
530
|
+
end
|
|
531
|
+
end
|
|
532
|
+
|
|
492
533
|
describe "KubeVirt schemas" do
|
|
493
534
|
it "resolves VirtualMachine" do
|
|
494
535
|
klass = instance["VirtualMachine"]
|
data/lib/kube/schema/version.rb
CHANGED
data/lib/kube/schema.rb
CHANGED
|
@@ -160,6 +160,16 @@ module Kube
|
|
|
160
160
|
schema_versions.last
|
|
161
161
|
end
|
|
162
162
|
|
|
163
|
+
# All API groups known to the default schema version, including any
|
|
164
|
+
# custom schemas registered via .register. The core group is "".
|
|
165
|
+
#
|
|
166
|
+
# Kube::Schema.api_groups # => ["", "apps", "argoproj.io", "batch", ...]
|
|
167
|
+
#
|
|
168
|
+
# @return [Array<String>] sorted, deduplicated group names
|
|
169
|
+
def api_groups
|
|
170
|
+
self[schema_version || DEFAULT_VERSION].api_groups
|
|
171
|
+
end
|
|
172
|
+
|
|
163
173
|
def has_version?(version)
|
|
164
174
|
schema_versions.include?(version)
|
|
165
175
|
end
|
|
@@ -314,5 +324,15 @@ if __FILE__ == $0
|
|
|
314
324
|
expect(Kube::Schema.has_version?("0.0.1")).to be false
|
|
315
325
|
end
|
|
316
326
|
end
|
|
327
|
+
|
|
328
|
+
describe ".api_groups" do
|
|
329
|
+
it "delegates to the default version's instance" do
|
|
330
|
+
expect(Kube::Schema.api_groups).to eq(Kube::Schema[Kube::Schema::DEFAULT_VERSION].api_groups)
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
it "includes core and built-in groups" do
|
|
334
|
+
expect(Kube::Schema.api_groups).to include("", "apps", "batch")
|
|
335
|
+
end
|
|
336
|
+
end
|
|
317
337
|
end
|
|
318
338
|
end
|