kube_schema 0.1.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09be5c8cac27b3bc049d05aef19dd35849ac980fada6d98f128a586b60b0c37b'
4
- data.tar.gz: 9950d4a8c34efdb1e3d43f96e47e78b39ee8f03721e573593bfbc3d07d2d6257
3
+ metadata.gz: a3654febeda5eae33eb74325e527cf6263bccc5b5675c3c2a142e9d5e0a7d9f8
4
+ data.tar.gz: 46d33f8016d1baa4ef8f46bd0ae98194809fa419ea28bb81c7edcd660a8570e7
5
5
  SHA512:
6
- metadata.gz: c6ca7851071453fbebd179df6f04904a15a7f8f328bf95b6a640d99fedc97b92afd721efc8c8ea0eb43df7067722ea287bdfb2116f4aa919b2310bb755981faa
7
- data.tar.gz: b9a390d76fea243933febca94d3fe704a0194d0b8d976086210d399bc2f34f4041b4504dfeb7c6b23cf929e7d04cd6286a18047ac97cbd1b9066be89b9c781e5
6
+ metadata.gz: 3a74bf94f1367c7d62418d49d17042e038700ee398fcb7ed90818e5e3de3616c8408ac4d084863b59d7173431c1cfa9432e30050ce7a4a16efaed5d98c256992
7
+ data.tar.gz: 27e327721a7c06fe994d00f62061293a7526bdad0825f3fdfc518001f5ef0c8d8cff5ff8a5a9d7c1cd788674a7068354c9abb5b4dc148bd78a395262aa072a2e
@@ -0,0 +1,35 @@
1
+ name: Convert Kubernetes Schemas
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ # “At 10:10 on every 2nd day-of-month.”
7
+ - cron: "10 10 */2 * *"
8
+
9
+ jobs:
10
+ convert:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: checkout
14
+ uses: actions/checkout@v4
15
+ with:
16
+ ref: schemas
17
+
18
+ - uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: '3.3'
21
+ bundler-cache: true
22
+
23
+ - name: bundle install
24
+ run: bundle install
25
+
26
+ - name: convert-the-schemas-bro
27
+ run: bin/convert-schemas
28
+
29
+ - uses: stefanzweifel/git-auto-commit-action@v5
30
+ with:
31
+ branch: schemas
32
+ commit_message: "Workflow Run: convert-schemas.yml"
33
+ commit_user_name: Nathan K
34
+ commit_user_email: nathankidd@hey.com
35
+ commit_author: Nathan K <nathankidd@hey.com>
@@ -0,0 +1,35 @@
1
+ name: Update CRD Schemas
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ # “At 10:10 on every 2nd day-of-month.”
7
+ - cron: "10 10 */2 * *"
8
+
9
+ jobs:
10
+ update:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: checkout schemas branch
14
+ uses: actions/checkout@v4
15
+ with:
16
+ ref: schemas
17
+
18
+ - name: download crds-catalog index
19
+ run: curl -fsSL -o crds-catalog.yaml https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/index.yaml
20
+
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: '3.3'
24
+ bundler-cache: true
25
+
26
+ - name: download the crds from catalog
27
+ run: "bin/update-crds"
28
+
29
+ - uses: stefanzweifel/git-auto-commit-action@v5
30
+ with:
31
+ branch: schemas
32
+ commit_message: "Update crds-catalog.yaml"
33
+ commit_user_name: Nathan K
34
+ commit_user_email: nathankidd@hey.com
35
+ commit_author: Nathan K <nathankidd@hey.com>
@@ -0,0 +1,32 @@
1
+ name: Update Schema Index
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ # "At 10:30 on every 2nd day-of-month." (after update-schemas)
7
+ - cron: "30 10 */2 * *"
8
+
9
+ jobs:
10
+ update-index:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout current branch
14
+ uses: actions/checkout@v4
15
+
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: '3.3'
19
+
20
+ - name: Build schema index
21
+ run: |
22
+ git fetch origin schemas --depth=1
23
+ bin/update-schema-index
24
+
25
+ - name: Commit schema index
26
+ uses: stefanzweifel/git-auto-commit-action@v5
27
+ with:
28
+ commit_message: "Workflow Run: update-schema-index.yml"
29
+ commit_user_name: Nathan K
30
+ commit_user_email: nathankidd@hey.com
31
+ commit_author: Nathan K <nathankidd@hey.com>
32
+ file_pattern: "data/*.txt"
@@ -0,0 +1,35 @@
1
+ name: Update Kubernetes Schemas
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ # “At 10:10 on every 2nd day-of-month.”
7
+ - cron: "10 10 */2 * *"
8
+
9
+ jobs:
10
+ update:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: checkout
14
+ uses: actions/checkout@v4
15
+ with:
16
+ ref: schemas
17
+
18
+ - uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: '3.3'
21
+ bundler-cache: true
22
+
23
+ - name: bundle install
24
+ run: bundle install
25
+
26
+ - name: update-the-schemas-bro
27
+ run: bin/update-schemas
28
+
29
+ - uses: stefanzweifel/git-auto-commit-action@v5
30
+ with:
31
+ branch: schemas
32
+ commit_message: "Workflow Run: update-schemas.yml"
33
+ commit_user_name: Nathan K
34
+ commit_user_email: nathankidd@hey.com
35
+ commit_author: Nathan K <nathankidd@hey.com>
data/.gitignore CHANGED
@@ -1,7 +1,7 @@
1
1
  *.gem
2
+ .direnv
2
3
  /.bundle/
3
4
  /coverage/
4
5
  /pkg/
5
6
  /tmp/
6
7
  /vendor/bundle
7
- Gemfile.lock
data/AGENTS.md ADDED
@@ -0,0 +1 @@
1
+ The "schemas" branch is FUCKING HUGE!!!!!!!!!!!! DO NOT FUCKING DOWNLOAD IT!!!!!!
data/Gemfile.lock ADDED
@@ -0,0 +1,75 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ kube_schema (0.1.1)
5
+ black_hole_struct (~> 0.1)
6
+ json_schemer (~> 2.5)
7
+ rubyshell (~> 1.5)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.8.9)
13
+ public_suffix (>= 2.0.2, < 8.0)
14
+ ast (2.4.3)
15
+ bigdecimal (4.0.1)
16
+ black_hole_struct (0.1.3)
17
+ hana (1.3.7)
18
+ json (2.19.2)
19
+ json-schema (6.2.0)
20
+ addressable (~> 2.8)
21
+ bigdecimal (>= 3.1, < 5)
22
+ json_schemer (2.5.0)
23
+ bigdecimal
24
+ hana (~> 1.3)
25
+ regexp_parser (~> 2.0)
26
+ simpleidn (~> 0.2)
27
+ language_server-protocol (3.17.0.5)
28
+ lint_roller (1.1.0)
29
+ mcp (0.8.0)
30
+ json-schema (>= 4.1)
31
+ minitest (5.27.0)
32
+ parallel (1.27.0)
33
+ parser (3.3.10.2)
34
+ ast (~> 2.4.1)
35
+ racc
36
+ prism (1.9.0)
37
+ public_suffix (7.0.5)
38
+ racc (1.8.1)
39
+ rainbow (3.1.1)
40
+ rake (13.3.1)
41
+ regexp_parser (2.11.3)
42
+ rubocop (1.85.1)
43
+ json (~> 2.3)
44
+ language_server-protocol (~> 3.17.0.2)
45
+ lint_roller (~> 1.1.0)
46
+ mcp (~> 0.6)
47
+ parallel (~> 1.10)
48
+ parser (>= 3.3.0.2)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ regexp_parser (>= 2.9.3, < 3.0)
51
+ rubocop-ast (>= 1.49.0, < 2.0)
52
+ ruby-progressbar (~> 1.7)
53
+ unicode-display_width (>= 2.4.0, < 4.0)
54
+ rubocop-ast (1.49.1)
55
+ parser (>= 3.3.7.2)
56
+ prism (~> 1.7)
57
+ ruby-progressbar (1.13.0)
58
+ rubyshell (1.5.0)
59
+ simpleidn (0.2.3)
60
+ unicode-display_width (3.2.0)
61
+ unicode-emoji (~> 4.1)
62
+ unicode-emoji (4.2.0)
63
+
64
+ PLATFORMS
65
+ ruby
66
+ x86_64-linux
67
+
68
+ DEPENDENCIES
69
+ kube_schema!
70
+ minitest (~> 5.0)
71
+ rake (~> 13.0)
72
+ rubocop (~> 1.21)
73
+
74
+ BUNDLED WITH
75
+ 2.6.9
data/README.md CHANGED
@@ -1,15 +1,36 @@
1
- # kube_schema
1
+ # KubeSchema
2
2
 
3
- A template for creating Ruby gems.
3
+ Ruby objects for Kubernetes OpenAPI schemas.
4
+
5
+ ## Installation
6
+
7
+ ```ruby
8
+ gem "kube_schema"
9
+ ```
4
10
 
5
11
  ## Usage
6
12
 
7
- ```bash
8
- git clone https://github.com/n-at-han-k/kube_schema
9
- cd kube_schema
10
- bin/rename-gem my-new-gem
11
- bin/update-spec
12
- bin/choose-license
13
- bin/increment-version patch
14
- bin/release-gem
13
+ ```ruby
14
+ Deployment = KubeSchema["1.33.6"]["Deployment"]
15
+
16
+ app = Deployment.new do
17
+ self.description = "My app"
18
+ self.type = "custom"
19
+ end
20
+
21
+ app.description # => "My app"
22
+ app.type # => "custom"
23
+ app.properties # => {"apiVersion" => ..., "kind" => ..., ...}
24
+ ```
25
+
26
+ ```ruby
27
+ class RailsApp < KubeSchema["1.33.6"]["Deployment"]
28
+ def is_the_best?
29
+ true
30
+ end
31
+ end
32
+
33
+ app = RailsApp.new
34
+ app.is_the_best? # => true
35
+ app.description # => "Deployment enables declarative updates for Pods and ReplicaSets."
15
36
  ```
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "fileutils"
5
+ require 'debug'
6
+ require 'rubyshell'
7
+
8
+ DATA_DIR = File.expand_path("../data", __dir__)
9
+
10
+ sh do
11
+ lines =
12
+ git("ls-tree -r --name-only origin/schemas --")
13
+ .lines
14
+ .map(&:chomp)
15
+
16
+ groups = {}
17
+
18
+ lines.each do |line|
19
+ if line.split("/").count < 2
20
+ next
21
+ elsif line.split("/").count > 2
22
+ groups[line.split("/").first] ||= []
23
+ groups[line.split("/").first] << line
24
+ else
25
+ groups["crds"] ||= []
26
+ groups["crds"] << line
27
+ end
28
+ end
29
+
30
+ groups.each do |group, values|
31
+ FileUtils.mkdir_p(group)
32
+ File.write("data/#{group}.txt", values.join("\n"))
33
+ end
34
+ end
data/kube_schema.gemspec CHANGED
@@ -31,4 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "minitest", "~> 5.0"
32
32
  spec.add_development_dependency "rake", "~> 13.0"
33
33
  spec.add_development_dependency "rubocop", "~> 1.21"
34
+
35
+ spec.add_dependency "rubyshell", "~> 1.5"
36
+ spec.add_dependency "json_schemer", "~> 2.5"
37
+ spec.add_dependency "black_hole_struct", "~> 0.1"
34
38
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module KubeSchema
6
+ # Represents a single Kubernetes version's OpenAPI schema.
7
+ # Lazily loads the JSON and builds an index of group/version/kind strings
8
+ # mapped back to definition keys.
9
+ #
10
+ # instance = KubeSchema::Instance.new("v1.33.6")
11
+ # instance["Deployment"]
12
+ # instance["apps/v1/Deployment"]
13
+ # instance.list_resources #=> sorted array of "group/version/kind" strings
14
+ #
15
+ class Instance
16
+ attr_reader :version
17
+
18
+ def initialize(version)
19
+ @resource_classes = {}
20
+
21
+ is_a_version = -> (v) { Gem::Version.correct?(v) }
22
+
23
+ if is_a_version.(version)
24
+ @version = version
25
+ else
26
+ raise UnknownVersionError.new(
27
+ "\n#{version} is an unknown version..." +
28
+ "\nUse `KubeSchema.schema_versions` to get a list."
29
+ )
30
+ end
31
+ end
32
+
33
+ # Look up a resource by full "group/version/kind" or by bare "Kind".
34
+ # Returns a class that inherits from KubeSchema::Resource, or nil.
35
+ def [](key)
36
+ KubeSchema::SchemaIndex.new(version).find(key.downcase).then do |path|
37
+ if path.nil?
38
+ raise "No resource schema found for #{key}!!!!!!!"
39
+ else
40
+ @resource_classes[key] ||= begin
41
+ #schema_hash = @data["definitions"][key]
42
+ Class.new(::KubeSchema::Resource) do
43
+ #@schema = schema_hash
44
+
45
+ #def self.schema
46
+ # @schema || superclass.schema
47
+ #end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "black_hole_struct"
5
+
6
+ module KubeSchema
7
+ class Resource
8
+
9
+ # Subclasses generated by Instance#[] have a class-level .schema.
10
+ # When called directly via KubeSchema.parse(hash), the hash is passed in.
11
+ def initialize(hash = nil, &block)
12
+ @data = BlackHoleStruct.new(hash)
13
+ @data.instance_exec(&block) if block
14
+ end
15
+
16
+ # Gets overridden by the factory in KubeSchema::Instance
17
+ def self.schema
18
+ nil
19
+ end
20
+
21
+ def to_h
22
+ @data.to_h
23
+ end
24
+
25
+ def ==(other)
26
+ other.is_a?(Resource) && to_h == other.to_h
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'net/http'
5
+ require 'uri'
6
+
7
+ module KubeSchema
8
+ # Lazily downloads individual schema JSON files from the schemas branch
9
+ # on GitHub and caches them locally under Gem.cache_home (XDG_CACHE_HOME).
10
+ #
11
+ # Usage:
12
+ # KubeSchema::SchemaCache.fetch("cert-manager.io/certificate_v1")
13
+ # # => "/home/user/.cache/kube_schema/schemas/cert-manager.io/certificate_v1.json"
14
+ #
15
+ # KubeSchema::SchemaCache.read("v1.33.6/deployment")
16
+ # # => "{...json contents...}"
17
+ #
18
+ module SchemaCache
19
+ BASE_URL = 'https://raw.githubusercontent.com/general-intelligence-systems/kube_schema/refs/heads/schemas'
20
+
21
+ class DownloadError < StandardError; end
22
+
23
+ class << self
24
+ # Root directory for cached schemas.
25
+ # Defaults to ~/.cache/kube_schema/schemas (or $XDG_CACHE_HOME/kube_schema/schemas).
26
+ def cache_dir
27
+ @cache_dir ||= File.join(Gem.cache_home, 'kube_schema', 'schemas')
28
+ end
29
+
30
+ # Override the cache directory (useful for testing).
31
+ attr_writer :cache_dir
32
+
33
+ # Returns the local file path for a schema, downloading it if not cached.
34
+ # The file_path should NOT include the .json extension.
35
+ #
36
+ # SchemaCache.fetch("cert-manager.io/certificate_v1")
37
+ # # => "/home/user/.cache/kube_schema/schemas/cert-manager.io/certificate_v1.json"
38
+ #
39
+ def fetch(file_path)
40
+ local = local_path(file_path)
41
+ return local if File.exist?(local)
42
+
43
+ download!(file_path, local)
44
+ local
45
+ end
46
+
47
+ # Returns the JSON content as a String, downloading if necessary.
48
+ def read(file_path)
49
+ File.read(fetch(file_path))
50
+ end
51
+
52
+ # Returns the local path where a schema would be cached (without downloading).
53
+ def local_path(file_path)
54
+ File.join(cache_dir, "#{file_path}.json")
55
+ end
56
+
57
+ # Returns true if the schema is already cached locally.
58
+ def cached?(file_path)
59
+ File.exist?(local_path(file_path))
60
+ end
61
+
62
+ # Removes a single cached schema file.
63
+ def evict(file_path)
64
+ path = local_path(file_path)
65
+ File.delete(path) if File.exist?(path)
66
+ end
67
+
68
+ # Removes the entire cache directory.
69
+ def clear!
70
+ FileUtils.rm_rf(cache_dir)
71
+ end
72
+
73
+ private
74
+
75
+ def download!(file_path, local)
76
+ url = "#{BASE_URL}/#{file_path}.json"
77
+ uri = URI.parse(url)
78
+
79
+ response = Net::HTTP.get_response(uri)
80
+
81
+ unless response.is_a?(Net::HTTPSuccess)
82
+ raise DownloadError,
83
+ "Failed to download schema: #{url} (HTTP #{response.code})"
84
+ end
85
+
86
+ FileUtils.mkdir_p(File.dirname(local))
87
+ File.write(local, response.body)
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,27 @@
1
+ module KubeSchema
2
+ class SchemaIndex
3
+ def initialize(version)
4
+ @version = version
5
+ end
6
+
7
+ def find(query)
8
+ all_paths.select { _1.include?(query.downcase) }.first
9
+ end
10
+
11
+ def all_paths
12
+ custom_resource_paths + kubernetes_paths
13
+ end
14
+
15
+ def custom_resource_paths
16
+ File.read(SCHEMA_INDEX + "/crds.txt").lines.map do |line|
17
+ line.chomp.gsub(".json", "")
18
+ end
19
+ end
20
+
21
+ def kubernetes_paths
22
+ File.read(SCHEMA_INDEX + "/v#{@version}.txt").lines.map do |line|
23
+ line.chomp.gsub(".json", "").split("/")[1..-1].join("/")
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubeSchema
4
- VERSION = "0.1.1"
4
+ VERSION = "1.0.0"
5
5
  end
data/lib/kube_schema.rb CHANGED
@@ -1,6 +1,67 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "kube_schema/version"
3
+ require_relative 'kube_schema/version'
4
+ require_relative 'kube_schema/resource'
5
+ require_relative 'kube_schema/instance'
6
+ require_relative 'kube_schema/schema_cache'
7
+ require_relative 'kube_schema/schema_index'
4
8
 
5
9
  module KubeSchema
10
+ class UnknownVersionError < StandardError; end
11
+
12
+ @schema_version = nil
13
+ @instances = {}
14
+
15
+ GEM_ROOT = File.expand_path("..", __dir__).freeze
16
+ SCHEMA_INDEX = File.join(GEM_ROOT, "data").freeze
17
+ DEFAULT_VERSION = "1.34.4" # 2025-04-16
18
+
19
+ class << self
20
+ # Set a default Kubernetes version for bare lookups like KubeSchema["Deployment"].
21
+ # When nil, the latest version found in the schemas directory is used.
22
+ attr_accessor :schema_version
23
+
24
+ # KubeSchema["1.33.6"] => cached Instance (supports ["Deployment"] chaining)
25
+ # KubeSchema["Deployment"] => Resource via the default version
26
+ # KubeSchema["apps/v1/Deployment"] => Resource via the default version
27
+ def [](key)
28
+ is_a_version = -> (key) { Gem::Version.correct?(key) }
29
+
30
+ if is_a_version.(key)
31
+ if has_version?(key)
32
+ @instances[key] ||= Instance.new(key)
33
+ else
34
+ raise UnknownVersionError.new(
35
+ "\n#{key} is an unknown version..." +
36
+ "\nUse `KubeSchema.schema_versions` to get a list."
37
+ )
38
+ end
39
+ else
40
+ Instance.new(schema_version || DEFAULT_VERSION)[key]
41
+ end
42
+ end
43
+
44
+ # Build a Resource from a hash.
45
+ # KubeSchema.parse(KubeSchema["Deployment"].to_h) == KubeSchema["Deployment"]
46
+ def parse(hash)
47
+ raise NotImplementedError
48
+ end
49
+
50
+ def schema_versions
51
+ @schema_versions ||=
52
+ Dir.glob(SCHEMA_INDEX + "/v*.txt").map do |file_path|
53
+ file_path.split("/").last.gsub(".txt", "")[1..-1]
54
+ end.sort_by { Gem::Version.new(_1) }
55
+ end
56
+
57
+ # The latest Kubernetes version available in the schemas directory,
58
+ # determined by sorting the filenames with Gem::Version.
59
+ def latest_version
60
+ schema_versions.last
61
+ end
62
+
63
+ def has_version?(version)
64
+ schema_versions.include?(version)
65
+ end
66
+ end
6
67
  end
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: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan K
@@ -51,6 +51,48 @@ dependencies:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '1.21'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rubyshell
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.5'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.5'
68
+ - !ruby/object:Gem::Dependency
69
+ name: json_schemer
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.5'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.5'
82
+ - !ruby/object:Gem::Dependency
83
+ name: black_hole_struct
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.1'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.1'
54
96
  description: 'Abstractions are God. Let''s give praise and build on the shoulders
55
97
  of giants by using objects to represent schemas. It was written and to it became.
56
98
 
@@ -62,9 +104,14 @@ extensions: []
62
104
  extra_rdoc_files: []
63
105
  files:
64
106
  - ".envrc"
107
+ - ".github/workflows/convert-schemas.yml"
108
+ - ".github/workflows/update-crds-catalog.yml"
109
+ - ".github/workflows/update-schema-index.yml"
110
+ - ".github/workflows/update-schemas.yml"
65
111
  - ".gitignore"
112
+ - AGENTS.md
66
113
  - Gemfile
67
- - LICENSE
114
+ - Gemfile.lock
68
115
  - README.md
69
116
  - Rakefile
70
117
  - bin/console
@@ -73,11 +120,14 @@ files:
73
120
  - bin/setup
74
121
  - bin/tag-version
75
122
  - bin/test
76
- - flake.lock
123
+ - bin/update-schema-index
77
124
  - flake.nix
78
125
  - kube_schema.gemspec
79
- - kube_schema.gemspec.erb
80
126
  - lib/kube_schema.rb
127
+ - lib/kube_schema/instance.rb
128
+ - lib/kube_schema/resource.rb
129
+ - lib/kube_schema/schema_cache.rb
130
+ - lib/kube_schema/schema_index.rb
81
131
  - lib/kube_schema/version.rb
82
132
  - lib/kube_schema/version.rb.erb
83
133
  homepage: https://github.com/n-at-han-k/kube_schema
data/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
data/flake.lock DELETED
@@ -1,61 +0,0 @@
1
- {
2
- "nodes": {
3
- "nixpkgs": {
4
- "locked": {
5
- "lastModified": 1773821835,
6
- "narHash": "sha256-TJ3lSQtW0E2JrznGVm8hOQGVpXjJyXY2guAxku2O9A4=",
7
- "owner": "NixOS",
8
- "repo": "nixpkgs",
9
- "rev": "b40629efe5d6ec48dd1efba650c797ddbd39ace0",
10
- "type": "github"
11
- },
12
- "original": {
13
- "owner": "NixOS",
14
- "ref": "nixos-unstable",
15
- "repo": "nixpkgs",
16
- "type": "github"
17
- }
18
- },
19
- "root": {
20
- "inputs": {
21
- "nixpkgs": "nixpkgs",
22
- "utils": "utils"
23
- }
24
- },
25
- "systems": {
26
- "locked": {
27
- "lastModified": 1681028828,
28
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
29
- "owner": "nix-systems",
30
- "repo": "default",
31
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
32
- "type": "github"
33
- },
34
- "original": {
35
- "owner": "nix-systems",
36
- "repo": "default",
37
- "type": "github"
38
- }
39
- },
40
- "utils": {
41
- "inputs": {
42
- "systems": "systems"
43
- },
44
- "locked": {
45
- "lastModified": 1731533236,
46
- "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
47
- "owner": "numtide",
48
- "repo": "flake-utils",
49
- "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
50
- "type": "github"
51
- },
52
- "original": {
53
- "owner": "numtide",
54
- "repo": "flake-utils",
55
- "type": "github"
56
- }
57
- }
58
- },
59
- "root": "root",
60
- "version": 7
61
- }
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/kube_schema/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "<%= gem_name %>"
7
- spec.version = KubeSchema::VERSION
8
- spec.authors = [<%= authors.map { |a| %("#{a}") }.join(", ") %>]
9
- spec.email = [<%= emails.map { |e| %("#{e}") }.join(", ") %>]
10
-
11
- spec.summary = "<%= summary %>"
12
-
13
- spec.description = <<~DESC
14
- <%= description %>
15
- DESC
16
-
17
- spec.homepage = "<%= homepage %>"
18
- spec.license = "<%= license %>"
19
- spec.required_ruby_version = ">= <%= ruby_version %>"
20
-
21
- spec.metadata["homepage_uri"] = spec.homepage
22
- spec.metadata["source_code_uri"] = spec.homepage
23
- spec.metadata["documentation_uri"] = spec.homepage
24
- spec.metadata["rubygems_mfa_required"] = "true"
25
-
26
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|data)/}) }
27
- spec.bindir = "exe"
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
- spec.require_paths = ["lib"]
30
-
31
- spec.add_development_dependency "minitest", "~> 5.0"
32
- spec.add_development_dependency "rake", "~> 13.0"
33
- spec.add_development_dependency "rubocop", "~> 1.21"
34
- end