kube_schema 1.11.0 → 2.0.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/.envrc +1 -0
- data/.github/FUNDING.yml +3 -0
- data/.rubocop.yml +226 -5984
- data/CHANGELOG.md +127 -2
- data/DEPRECATIONS.md +172 -0
- data/Gemfile +13 -3
- data/Gemfile.lock +41 -31
- data/RELEASE.md +161 -0
- data/Rakefile +1 -1
- data/bin/rubocop +3 -0
- data/bin/test +2 -9
- data/cops/begin_block_assignment.rb +34 -0
- data/cops/comment_structure.rb +307 -0
- data/cops/constant_matches_path.rb +142 -0
- data/cops/multiline_method_arguments.rb +89 -0
- data/cops/no_conditional_assignment.rb +186 -0
- data/cops/no_console_logging.rb +62 -0
- data/cops/no_modifier_if.rb +74 -0
- data/cops/no_return.rb +152 -0
- data/cops/support/prism_source.rb +234 -0
- data/cops/use_tap.rb +100 -0
- data/flake.lock +42 -5
- data/flake.nix +28 -21
- data/gemset.nix +983 -0
- data/kube_schema.gemspec +4 -2
- data/lib/kube/errors.rb +652 -645
- data/lib/kube/monkey_patches.rb +5 -6
- data/lib/kube/schema/instance.rb +344 -363
- data/lib/kube/schema/lazy.rb +370 -0
- data/lib/kube/schema/manifest.rb +289 -310
- data/lib/kube/schema/resource.rb +352 -356
- data/lib/kube/schema/sub_spec.rb +261 -293
- data/lib/kube/schema.rb +173 -172
- data/lib/{kube/schema → kube_schema}/version.rb +1 -1
- data/lib/kube_schema.rb +6 -0
- data/readme.md +5 -0
- metadata +50 -9
- data/bin/increment-version +0 -45
- data/bin/release-gem +0 -32
- data/bin/tag-version +0 -19
- data/lib/kube/schema/version.rb.erb +0 -7
data/lib/kube/schema.rb
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative 'monkey_patches'
|
|
4
4
|
require_relative 'errors'
|
|
5
|
-
|
|
5
|
+
# Requires lib/kube_schema/version.rb, not schema/version.rb.
|
|
6
|
+
# `gem kit bump` derives the version file from the gem name.
|
|
7
|
+
require_relative '../kube_schema/version'
|
|
6
8
|
require_relative 'schema/resource'
|
|
7
9
|
require_relative 'schema/sub_spec'
|
|
10
|
+
require_relative 'schema/lazy'
|
|
8
11
|
require_relative 'schema/instance'
|
|
9
12
|
require_relative 'schema/manifest'
|
|
10
13
|
|
|
@@ -33,15 +36,9 @@ module Kube
|
|
|
33
36
|
attr_reader :custom_schemas
|
|
34
37
|
|
|
35
38
|
# Register a standalone JSON Schema for a custom resource kind.
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
# Registered kinds take precedence over built-in definitions.
|
|
40
|
-
#
|
|
41
|
-
# @param kind [String] The Kubernetes Kind (e.g. "Certificate")
|
|
42
|
-
# @param schema [Hash, String, Pathname] JSON Schema as a Hash,
|
|
43
|
-
# a JSON string, or a file path to a .json file
|
|
44
|
-
# @param api_version [String] The apiVersion (e.g. "cert-manager.io/v1")
|
|
39
|
+
# @parameter kind [String] the Kubernetes Kind, e.g. "Certificate".
|
|
40
|
+
# @parameter schema [Hash, String, Pathname] a Hash, a JSON string, or a path to a .json file.
|
|
41
|
+
# @parameter api_version [String] the apiVersion, e.g. "cert-manager.io/v1".
|
|
45
42
|
#
|
|
46
43
|
# @example Register from a local file
|
|
47
44
|
# Kube::Schema.register("Certificate",
|
|
@@ -59,47 +56,53 @@ module Kube
|
|
|
59
56
|
require "json"
|
|
60
57
|
require "json_schemer"
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
else
|
|
70
|
-
JSON.parse(path)
|
|
71
|
-
end
|
|
59
|
+
case schema
|
|
60
|
+
when Hash
|
|
61
|
+
parsed = schema
|
|
62
|
+
when String, Pathname
|
|
63
|
+
path = schema.to_s
|
|
64
|
+
if File.exist?(path)
|
|
65
|
+
parsed = JSON.parse(File.read(path))
|
|
72
66
|
else
|
|
73
|
-
|
|
74
|
-
"schema must be a Hash, a JSON string, or a file path — got #{schema.class}"
|
|
67
|
+
parsed = JSON.parse(path)
|
|
75
68
|
end
|
|
69
|
+
else
|
|
70
|
+
raise ArgumentError,
|
|
71
|
+
"schema must be a Hash, a JSON string, or a file path — got #{schema.class}"
|
|
72
|
+
end
|
|
76
73
|
|
|
77
|
-
# Key by
|
|
78
|
-
#
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
# Key by GVK so lookups can be fully-qualified.
|
|
75
|
+
# A bare kind key collides when two CRDs share a kind.
|
|
76
|
+
if api_version
|
|
77
|
+
key = "#{api_version}/#{kind}"
|
|
78
|
+
else
|
|
79
|
+
key = kind
|
|
80
|
+
end
|
|
82
81
|
@custom_schemas[key] = {
|
|
83
|
-
|
|
84
|
-
defaults: { "apiVersion" => api_version, "kind" => kind }.freeze
|
|
82
|
+
entry: Lazy::Spill.write(key, parsed),
|
|
83
|
+
defaults: { "apiVersion" => api_version, "kind" => kind }.freeze,
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
# Invalidate cached resource classes
|
|
88
|
-
# new registration takes effect immediately.
|
|
86
|
+
# Invalidate cached resource classes so this registration applies.
|
|
89
87
|
@instances.each_value { |inst| inst.send(:clear_resource_cache!) }
|
|
90
88
|
|
|
91
89
|
kind
|
|
92
90
|
end
|
|
93
91
|
|
|
94
92
|
# Remove all custom schema registrations.
|
|
95
|
-
#
|
|
93
|
+
# @returns [void] clears custom schemas and resource caches.
|
|
96
94
|
def reset_custom_schemas!
|
|
95
|
+
Lazy::Spill.clear
|
|
97
96
|
@custom_schemas.clear
|
|
98
97
|
@instances.each_value { |inst| inst.send(:clear_resource_cache!) }
|
|
99
98
|
end
|
|
100
99
|
|
|
101
|
-
#
|
|
102
|
-
#
|
|
100
|
+
# @example
|
|
101
|
+
# Kube::Schema["1.34"] # => cached Instance (supports ["Deployment"] chaining)
|
|
102
|
+
# Kube::Schema["Deployment"] # => Resource via the default version
|
|
103
|
+
#
|
|
104
|
+
# @parameter key [String] a version string or a Kind name.
|
|
105
|
+
# @returns [Instance, Class] the version Instance or a Resource subclass.
|
|
103
106
|
def [](key)
|
|
104
107
|
if key.start_with?("v") && Gem::Version.correct?(key.sub("v", ""))
|
|
105
108
|
raise Kube::IncorrectVersionFormat,
|
|
@@ -113,7 +116,7 @@ module Kube
|
|
|
113
116
|
else
|
|
114
117
|
raise Kube::UnknownVersionError.new(
|
|
115
118
|
"\n#{key} is an unknown version..." +
|
|
116
|
-
"\nAvailable: #{schema_versions.join(", ")}"
|
|
119
|
+
"\nAvailable: #{schema_versions.join(", ")}",
|
|
117
120
|
)
|
|
118
121
|
end
|
|
119
122
|
else
|
|
@@ -123,31 +126,31 @@ module Kube
|
|
|
123
126
|
end
|
|
124
127
|
end
|
|
125
128
|
|
|
126
|
-
# Build a typed Resource from a raw hash.
|
|
127
|
-
#
|
|
128
|
-
# Looks up the "kind" key in the hash and resolves it to the
|
|
129
|
-
# correct Resource subclass via the schema registry. The hash
|
|
130
|
-
# may use string or symbol keys.
|
|
129
|
+
# Build a typed Resource from a raw hash's "kind".
|
|
131
130
|
#
|
|
131
|
+
# @example
|
|
132
132
|
# Kube::Schema.parse("kind" => "Deployment", "apiVersion" => "apps/v1")
|
|
133
133
|
# Kube::Schema.parse(kind: "Pod", apiVersion: "v1", metadata: { name: "web" })
|
|
134
134
|
#
|
|
135
|
-
# @
|
|
136
|
-
# @
|
|
137
|
-
# @
|
|
135
|
+
# @parameter hash [Hash] a resource hash with at least a "kind" key.
|
|
136
|
+
# @returns [Resource] a schema-validated Resource instance.
|
|
137
|
+
# @raises [ArgumentError] if the hash is nil, not a Hash, or missing "kind".
|
|
138
138
|
def parse(hash)
|
|
139
|
-
|
|
139
|
+
unless hash.is_a?(Hash)
|
|
140
|
+
raise ArgumentError, "Expected a Hash, got #{hash.class}"
|
|
141
|
+
end
|
|
140
142
|
|
|
141
143
|
kind = hash["kind"] || hash[:kind]
|
|
142
|
-
|
|
144
|
+
if kind.nil?
|
|
145
|
+
raise ArgumentError, "Hash must contain a \"kind\" key"
|
|
146
|
+
end
|
|
143
147
|
|
|
144
148
|
resource_class = self[kind]
|
|
145
149
|
resource_class.new(hash)
|
|
146
150
|
end
|
|
147
151
|
|
|
148
|
-
# Available Kubernetes versions, read from the
|
|
149
|
-
#
|
|
150
|
-
# @return [Array<String>] sorted version strings like ["1.19", "1.20", ...]
|
|
152
|
+
# Available Kubernetes versions, read from the schemas directory.
|
|
153
|
+
# @returns [Array(String)] sorted version strings like ["1.19", "1.20", ...].
|
|
151
154
|
def schema_versions
|
|
152
155
|
@schema_versions ||=
|
|
153
156
|
Dir.glob(File.join(SCHEMAS_DIR, "v*.json")).map do |file_path|
|
|
@@ -155,17 +158,18 @@ module Kube
|
|
|
155
158
|
end.sort_by { Gem::Version.new(_1) }
|
|
156
159
|
end
|
|
157
160
|
|
|
158
|
-
# The latest Kubernetes version
|
|
161
|
+
# The latest Kubernetes version in the schemas directory.
|
|
162
|
+
# @returns [String] the latest available version string.
|
|
159
163
|
def latest_version
|
|
160
164
|
schema_versions.last
|
|
161
165
|
end
|
|
162
166
|
|
|
163
|
-
# All API groups
|
|
164
|
-
# custom schemas registered via .register. The core group is "".
|
|
167
|
+
# All API groups for the default version, plus custom ones.
|
|
165
168
|
#
|
|
169
|
+
# @example
|
|
166
170
|
# Kube::Schema.api_groups # => ["", "apps", "argoproj.io", "batch", ...]
|
|
167
171
|
#
|
|
168
|
-
# @
|
|
172
|
+
# @returns [Array(String)] sorted, deduplicated group names.
|
|
169
173
|
def api_groups
|
|
170
174
|
self[schema_version || DEFAULT_VERSION].api_groups
|
|
171
175
|
end
|
|
@@ -178,161 +182,158 @@ module Kube
|
|
|
178
182
|
end
|
|
179
183
|
|
|
180
184
|
|
|
181
|
-
if __FILE__ == $0
|
|
182
|
-
require "bundler/setup"
|
|
183
|
-
require "rspec/autorun"
|
|
184
185
|
|
|
185
|
-
|
|
186
|
-
describe "::VERSION" do
|
|
187
|
-
it "is defined" do
|
|
188
|
-
expect(Kube::Schema::VERSION).not_to be_nil
|
|
189
|
-
end
|
|
186
|
+
__END__
|
|
190
187
|
|
|
191
|
-
|
|
192
|
-
expect(Kube::Schema::VERSION).to match(/\A\d+\.\d+\.\d+\z/)
|
|
193
|
-
end
|
|
194
|
-
end
|
|
188
|
+
require "kube/schema"
|
|
195
189
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
190
|
+
describe "Kube::Schema" do
|
|
191
|
+
describe "::VERSION" do
|
|
192
|
+
it "is defined" do
|
|
193
|
+
Kube::Schema::VERSION.should.not.be.nil
|
|
200
194
|
end
|
|
201
195
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
expect(versions).not_to be_empty
|
|
207
|
-
expect(versions).to all(match(/\A\d+\.\d+/))
|
|
208
|
-
end
|
|
196
|
+
it "is a valid semver string" do
|
|
197
|
+
Kube::Schema::VERSION.should.match(/\A\d+\.\d+\.\d+\z/)
|
|
198
|
+
end
|
|
199
|
+
end
|
|
209
200
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
201
|
+
describe "::DEFAULT_VERSION" do
|
|
202
|
+
it "is a version present in schema_versions" do
|
|
203
|
+
Kube::Schema.schema_versions.should.include Kube::Schema::DEFAULT_VERSION
|
|
204
|
+
end
|
|
205
|
+
end
|
|
215
206
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
207
|
+
describe ".schema_versions" do
|
|
208
|
+
it "returns an array of version strings" do
|
|
209
|
+
versions = Kube::Schema.schema_versions
|
|
210
|
+
versions.should.be.kind_of Array
|
|
211
|
+
versions.should.not.be.empty
|
|
212
|
+
versions.should.satisfy("every version looks like a minor release") { |vs| vs.all? { |v| v =~ /\A\d+\.\d+/ } }
|
|
219
213
|
end
|
|
220
214
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
end
|
|
215
|
+
it "is sorted by Gem::Version" do
|
|
216
|
+
versions = Kube::Schema.schema_versions
|
|
217
|
+
versions.should == versions.sort_by { |v| Gem::Version.new(v) }
|
|
225
218
|
end
|
|
226
219
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
expect(instance).to be_a(Kube::Schema::Instance)
|
|
232
|
-
expect(instance.version).to eq("1.34")
|
|
233
|
-
end
|
|
220
|
+
it "does not include a leading 'v' prefix" do
|
|
221
|
+
Kube::Schema.schema_versions.should.satisfy("no 'v' prefix") { |vs| vs.none? { |v| v.start_with?("v") } }
|
|
222
|
+
end
|
|
223
|
+
end
|
|
234
224
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
225
|
+
describe ".latest_version" do
|
|
226
|
+
it "returns the last element of schema_versions" do
|
|
227
|
+
Kube::Schema.latest_version.should == Kube::Schema.schema_versions.last
|
|
228
|
+
end
|
|
229
|
+
end
|
|
240
230
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
231
|
+
describe ".[]" do
|
|
232
|
+
describe "with a version string" do
|
|
233
|
+
it "returns an Instance for a known version" do
|
|
234
|
+
instance = Kube::Schema["1.34"]
|
|
235
|
+
instance.should.be.kind_of Kube::Schema::Instance
|
|
236
|
+
instance.version.should == "1.34"
|
|
244
237
|
end
|
|
245
238
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
klass = Kube::Schema["Deployment"]
|
|
249
|
-
expect(klass).to be_a(Class)
|
|
250
|
-
expect(klass).to be < Kube::Schema::Resource
|
|
251
|
-
end
|
|
239
|
+
it "caches Instance objects by version" do
|
|
240
|
+
Kube::Schema["1.34"].should.be.identical_to Kube::Schema["1.34"]
|
|
252
241
|
end
|
|
253
242
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
expect { Kube::Schema["v1.34"] }.to raise_error(
|
|
257
|
-
Kube::IncorrectVersionFormat,
|
|
258
|
-
/Don't preface the version with a "v"/
|
|
259
|
-
)
|
|
260
|
-
end
|
|
261
|
-
|
|
262
|
-
it "suggests the correct format in the error message" do
|
|
263
|
-
expect { Kube::Schema["v1.34"] }.to raise_error(
|
|
264
|
-
Kube::IncorrectVersionFormat,
|
|
265
|
-
/Use Kube::Schema\["1\.34"\] instead/
|
|
266
|
-
)
|
|
267
|
-
end
|
|
243
|
+
it "raises UnknownVersionError for an invalid version" do
|
|
244
|
+
lambda { Kube::Schema["0.0.1"] }.should.raise(Kube::UnknownVersionError)
|
|
268
245
|
end
|
|
269
246
|
end
|
|
270
247
|
|
|
271
|
-
describe "
|
|
272
|
-
it "returns a
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
expect(resource.apiVersion).to eq("apps/v1")
|
|
248
|
+
describe "with a resource name" do
|
|
249
|
+
it "returns a Class that subclasses Resource" do
|
|
250
|
+
klass = Kube::Schema["Deployment"]
|
|
251
|
+
klass.should.be.kind_of Class
|
|
252
|
+
klass.should.be < Kube::Schema::Resource
|
|
277
253
|
end
|
|
254
|
+
end
|
|
278
255
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
expect(resource.metadata.name).to eq("web")
|
|
256
|
+
describe "with a 'v'-prefixed version string" do
|
|
257
|
+
it "raises IncorrectVersionFormat" do
|
|
258
|
+
error = lambda { Kube::Schema["v1.34"] }.should.raise(Kube::IncorrectVersionFormat)
|
|
259
|
+
error.message.should.match(/Don't preface the version with a "v"/)
|
|
284
260
|
end
|
|
285
261
|
|
|
286
|
-
it "
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
expect(resource.class.defaults).to eq({ "apiVersion" => "v1", "kind" => "Service" })
|
|
262
|
+
it "suggests the correct format in the error message" do
|
|
263
|
+
error = lambda { Kube::Schema["v1.34"] }.should.raise(Kube::IncorrectVersionFormat)
|
|
264
|
+
error.message.should.match(/Use Kube::Schema\["1\.34"\] instead/)
|
|
290
265
|
end
|
|
266
|
+
end
|
|
267
|
+
end
|
|
291
268
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
parsed = Kube::Schema.parse(original.to_h)
|
|
301
|
-
expect(parsed.kind).to eq("Deployment")
|
|
302
|
-
expect(parsed.metadata.name).to eq("web")
|
|
303
|
-
end
|
|
269
|
+
describe ".parse" do
|
|
270
|
+
it "returns a typed Resource for a known kind" do
|
|
271
|
+
resource = Kube::Schema.parse("kind" => "Deployment", "apiVersion" => "apps/v1")
|
|
272
|
+
resource.should.be.kind_of Kube::Schema::Resource
|
|
273
|
+
resource.kind.should == "Deployment"
|
|
274
|
+
resource.apiVersion.should == "apps/v1"
|
|
275
|
+
end
|
|
304
276
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
277
|
+
it "works with symbol keys" do
|
|
278
|
+
resource = Kube::Schema.parse(kind: "Pod", apiVersion: "v1", metadata: { name: "web" })
|
|
279
|
+
resource.should.be.kind_of Kube::Schema::Resource
|
|
280
|
+
resource.kind.should == "Pod"
|
|
281
|
+
resource.metadata.name.should == "web"
|
|
282
|
+
end
|
|
308
283
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
284
|
+
it "returns a class backed by the correct schema" do
|
|
285
|
+
resource = Kube::Schema.parse("kind" => "Service", "apiVersion" => "v1")
|
|
286
|
+
resource.class.schema.should.not.be.nil
|
|
287
|
+
resource.class.defaults.should == { "apiVersion" => "v1", "kind" => "Service" }
|
|
288
|
+
end
|
|
312
289
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
290
|
+
it "round-trips through to_h" do
|
|
291
|
+
original = Kube::Schema["Deployment"].new {
|
|
292
|
+
metadata.name = "web"
|
|
293
|
+
spec.replicas = 3
|
|
294
|
+
spec.selector.matchLabels = { app: "web" }
|
|
295
|
+
spec.template.metadata.labels = { app: "web" }
|
|
296
|
+
spec.template.spec.containers = [{ name: "web", image: "nginx" }]
|
|
297
|
+
}
|
|
298
|
+
parsed = Kube::Schema.parse(original.to_h)
|
|
299
|
+
parsed.kind.should == "Deployment"
|
|
300
|
+
parsed.metadata.name.should == "web"
|
|
316
301
|
end
|
|
317
302
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
303
|
+
it "raises ArgumentError for a non-Hash" do
|
|
304
|
+
error = lambda { Kube::Schema.parse("not a hash") }.should.raise(ArgumentError)
|
|
305
|
+
error.message.should.match(/Expected a Hash/)
|
|
306
|
+
end
|
|
322
307
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
308
|
+
it "raises ArgumentError when kind is missing" do
|
|
309
|
+
error = lambda { Kube::Schema.parse("apiVersion" => "v1") }.should.raise(ArgumentError)
|
|
310
|
+
error.message.should.match(/kind/)
|
|
326
311
|
end
|
|
327
312
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
313
|
+
it "raises RuntimeError for an unknown kind" do
|
|
314
|
+
lambda { Kube::Schema.parse("kind" => "BogusKind", "apiVersion" => "v1") }.should.raise(RuntimeError)
|
|
315
|
+
end
|
|
316
|
+
end
|
|
332
317
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
318
|
+
describe ".has_version?" do
|
|
319
|
+
it "returns true for a known version" do
|
|
320
|
+
Kube::Schema.has_version?(Kube::Schema::DEFAULT_VERSION).should.be.true
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
it "returns false for an unknown version" do
|
|
324
|
+
Kube::Schema.has_version?("0.0.1").should.be.false
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
describe ".api_groups" do
|
|
329
|
+
it "delegates to the default version's instance" do
|
|
330
|
+
Kube::Schema.api_groups.should == Kube::Schema[Kube::Schema::DEFAULT_VERSION].api_groups
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
it "includes core and built-in groups" do
|
|
334
|
+
Kube::Schema.api_groups.should.include ""
|
|
335
|
+
Kube::Schema.api_groups.should.include "apps"
|
|
336
|
+
Kube::Schema.api_groups.should.include "batch"
|
|
336
337
|
end
|
|
337
338
|
end
|
|
338
339
|
end
|
data/lib/kube_schema.rb
ADDED
data/readme.md
CHANGED
|
@@ -16,6 +16,11 @@ Please see the [project documentation](https://general-intelligence-systems.gith
|
|
|
16
16
|
|
|
17
17
|
- [Schema Versions](https://general-intelligence-systems.github.io/kube_schema/guides/schema-versions/index) - This guide covers working with different Kubernetes schema versions.
|
|
18
18
|
|
|
19
|
+
## Contributing
|
|
20
|
+
|
|
21
|
+
- [RELEASE.md](RELEASE.md) -- how a version is cut: `gem kit bump`, the changelog, and the gates that run before anything reaches RubyGems.
|
|
22
|
+
- [DEPRECATIONS.md](DEPRECATIONS.md) -- the deprecation policy those gates enforce.
|
|
23
|
+
|
|
19
24
|
## Related Projects
|
|
20
25
|
|
|
21
26
|
- [kube_cluster](https://github.com/general-intelligence-systems/kube_cluster) -- OOP resource management with dirty tracking and persistence
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kube_schema
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan K
|
|
@@ -10,19 +10,33 @@ cert_chain: []
|
|
|
10
10
|
date: 1980-01-01 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
13
|
+
name: gem_kit-release
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '3
|
|
18
|
+
version: '0.3'
|
|
19
19
|
type: :development
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '3
|
|
25
|
+
version: '0.3'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: scampi
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1.0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.0'
|
|
26
40
|
- !ruby/object:Gem::Dependency
|
|
27
41
|
name: rake
|
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -51,6 +65,20 @@ dependencies:
|
|
|
51
65
|
- - "~>"
|
|
52
66
|
- !ruby/object:Gem::Version
|
|
53
67
|
version: '2.1'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: gem_kit
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0.2'
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0.2'
|
|
54
82
|
- !ruby/object:Gem::Dependency
|
|
55
83
|
name: rubyshell
|
|
56
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -90,6 +118,7 @@ extensions: []
|
|
|
90
118
|
extra_rdoc_files: []
|
|
91
119
|
files:
|
|
92
120
|
- ".envrc"
|
|
121
|
+
- ".github/FUNDING.yml"
|
|
93
122
|
- ".github/workflows/convert-schemas.yml"
|
|
94
123
|
- ".github/workflows/gh-pages.yml"
|
|
95
124
|
- ".github/workflows/update-crds-catalog.yml"
|
|
@@ -98,21 +127,31 @@ files:
|
|
|
98
127
|
- ".gitignore"
|
|
99
128
|
- ".rubocop.yml"
|
|
100
129
|
- CHANGELOG.md
|
|
130
|
+
- DEPRECATIONS.md
|
|
101
131
|
- Gemfile
|
|
102
132
|
- Gemfile.lock
|
|
103
133
|
- LICENSE
|
|
134
|
+
- RELEASE.md
|
|
104
135
|
- Rakefile
|
|
105
136
|
- assets/validation-error.png
|
|
106
137
|
- bin/console
|
|
107
138
|
- bin/copy-schemas-over
|
|
108
139
|
- bin/create-cdi-x-values
|
|
109
140
|
- bin/create-kubevirt-x-values
|
|
110
|
-
- bin/
|
|
111
|
-
- bin/release-gem
|
|
141
|
+
- bin/rubocop
|
|
112
142
|
- bin/setup
|
|
113
|
-
- bin/tag-version
|
|
114
143
|
- bin/test
|
|
115
144
|
- bin/update-schema-index
|
|
145
|
+
- cops/begin_block_assignment.rb
|
|
146
|
+
- cops/comment_structure.rb
|
|
147
|
+
- cops/constant_matches_path.rb
|
|
148
|
+
- cops/multiline_method_arguments.rb
|
|
149
|
+
- cops/no_conditional_assignment.rb
|
|
150
|
+
- cops/no_console_logging.rb
|
|
151
|
+
- cops/no_modifier_if.rb
|
|
152
|
+
- cops/no_return.rb
|
|
153
|
+
- cops/support/prism_source.rb
|
|
154
|
+
- cops/use_tap.rb
|
|
116
155
|
- examples/basic.rb
|
|
117
156
|
- examples/custom_crds.rb
|
|
118
157
|
- examples/manifest.rb
|
|
@@ -120,6 +159,7 @@ files:
|
|
|
120
159
|
- examples/vcluster.rb
|
|
121
160
|
- flake.lock
|
|
122
161
|
- flake.nix
|
|
162
|
+
- gemset.nix
|
|
123
163
|
- guides/block-dsl/readme.md
|
|
124
164
|
- guides/getting-started/readme.md
|
|
125
165
|
- guides/links.yaml
|
|
@@ -132,11 +172,12 @@ files:
|
|
|
132
172
|
- lib/kube/monkey_patches.rb
|
|
133
173
|
- lib/kube/schema.rb
|
|
134
174
|
- lib/kube/schema/instance.rb
|
|
175
|
+
- lib/kube/schema/lazy.rb
|
|
135
176
|
- lib/kube/schema/manifest.rb
|
|
136
177
|
- lib/kube/schema/resource.rb
|
|
137
178
|
- lib/kube/schema/sub_spec.rb
|
|
138
|
-
- lib/
|
|
139
|
-
- lib/
|
|
179
|
+
- lib/kube_schema.rb
|
|
180
|
+
- lib/kube_schema/version.rb
|
|
140
181
|
- readme.md
|
|
141
182
|
- schemas/cdi-definitions.json
|
|
142
183
|
- schemas/crd-definitions.json
|