metatron 0.8.8 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 391fa61dd0511b360cf7a0327d6b5de19d9094908349feb79804ef2695db0950
4
- data.tar.gz: 1db1d4a4590db27056933cb052445f2fecb4a856d024e0df8322e7379e3414ba
3
+ metadata.gz: 384d0a3e91cc449b09e5e1ccd514e966e0bea42603da9f01a8498ac25ce943aa
4
+ data.tar.gz: f50cf239982f715745308a39ce3027b413ca105b4e41ffc33c097c3489c5f5e4
5
5
  SHA512:
6
- metadata.gz: 305f8fd71865860a6f85e21c79f0f6426bcb0cf260e63483d09c192a326de713db53f1da8a64728c336627ea239d6cb55c25272f56ca44785ed48d1c7300a6d9
7
- data.tar.gz: effcc2c4603ead394a4a816412cf0460ff9c52a21621987492b17433e239fb8f695e014b252a463f32cecd41d76f5d6cb112bbbd32417ab93aaad5e7c971a148
6
+ metadata.gz: abb52677bdcf1dd2ed1365af61d02861edbed89b04235db5f4c5fb980c2bb44cfca95a868805f1b84f495b4a5650977c8ca4bb44dc3fd384f0235391decfcf18
7
+ data.tar.gz: f058f18da99307cac67532bba657fa470f934c83cdf27e2d97cb589d8aa6a1601989c32bb107686ed940ce4189769ea7816fd1c187575915c8bedb4e216c49f6
@@ -0,0 +1,85 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [ "main" ]
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+ id-token: write
12
+
13
+ jobs:
14
+ lint:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: .ruby-version
24
+ bundler-cache: true
25
+
26
+ - name: Lint code for consistent style
27
+ run: bundle exec rubocop -f github
28
+
29
+ yard:
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout code
33
+ uses: actions/checkout@v4
34
+
35
+ - name: Set up Ruby
36
+ uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: .ruby-version
39
+ bundler-cache: true
40
+
41
+ - name: Generate YARD documentation
42
+ run: bundle exec rake yard
43
+
44
+ test:
45
+ runs-on: ubuntu-latest
46
+ strategy:
47
+ matrix:
48
+ ruby-version: ['3.3', '3.4']
49
+
50
+ steps:
51
+ - name: Checkout code
52
+ uses: actions/checkout@v4
53
+
54
+ - name: Set up Ruby
55
+ uses: ruby/setup-ruby@v1
56
+ with:
57
+ ruby-version: ${{ matrix.ruby-version }}
58
+ bundler-cache: true
59
+
60
+ - name: Run tests
61
+ run: bundle exec rake spec
62
+
63
+ release:
64
+ runs-on: ubuntu-latest
65
+ needs: [ lint, yard, test ]
66
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
67
+ steps:
68
+ - uses: googleapis/release-please-action@v4
69
+ id: release
70
+ with:
71
+ # The token to use for authentication
72
+ token: ${{ secrets.AUTO_RELEASE_TOKEN }}
73
+
74
+ - uses: actions/checkout@v4
75
+ if: ${{ steps.release.outputs.release_created }}
76
+ - name: Set up Ruby
77
+ uses: ruby/setup-ruby@v1
78
+ if: ${{ steps.release.outputs.release_created }}
79
+ with:
80
+ bundler-cache: true
81
+ ruby-version: .ruby-version
82
+
83
+ # Release
84
+ - uses: rubygems/release-gem@v1
85
+ if: ${{ steps.release.outputs.release_created }}
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.9.0"
3
+ }
data/.rubocop.yml CHANGED
@@ -1,7 +1,9 @@
1
1
  require:
2
- - rubocop-rake
3
2
  - rubocop-rspec
4
3
 
4
+ plugins:
5
+ - rubocop-rake
6
+
5
7
  Layout/LineLength:
6
8
  Max: 100
7
9
 
data/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## [0.9.0](https://github.com/jgnagy/metatron/compare/metatron-v0.8.8...metatron/v0.9.0) (2025-02-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * **templates:** add priority class template ([a735e47](https://github.com/jgnagy/metatron/commit/a735e470d0a2f5c7c471ec95a7559cbbe8349268))
9
+ * **templates:** add support for pod priority ([f73d7b2](https://github.com/jgnagy/metatron/commit/f73d7b293c26eb0b5e2f65212c87a32b701b2151))
10
+
11
+ ## [0.8.8](https://github.com/jgnagy/metatron/compare/v0.8.2...v0.8.8) (2025-02-16)
12
+
13
+
14
+ ### Features
15
+
16
+ * adding support for LimitRange resource ([b779d47](https://github.com/jgnagy/metatron/commit/b779d4764ccf5b0e687ff328e69808ae12ff3c30))
17
+ * adds dataSource and dataSourceRef to PVCs ([5339a4e](https://github.com/jgnagy/metatron/commit/5339a4ea732695530814e281f6d0ae2de3e7889d))
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metatron (0.8.8)
4
+ metatron (0.9.0)
5
5
  json (~> 2.6)
6
6
  rack (>= 2.2.8, < 4)
7
7
 
@@ -12,7 +12,7 @@ GEM
12
12
  backport (1.2.0)
13
13
  benchmark (0.4.0)
14
14
  byebug (11.1.3)
15
- diff-lcs (1.5.1)
15
+ diff-lcs (1.6.0)
16
16
  docile (1.4.1)
17
17
  jaro_winkler (1.6.0)
18
18
  json (2.10.1)
@@ -21,7 +21,8 @@ GEM
21
21
  kramdown-parser-gfm (1.1.0)
22
22
  kramdown (~> 2.0)
23
23
  language_server-protocol (3.17.0.4)
24
- logger (1.6.5)
24
+ lint_roller (1.1.0)
25
+ logger (1.6.6)
25
26
  nokogiri (1.18.2-arm64-darwin)
26
27
  racc (~> 1.4)
27
28
  nokogiri (1.18.2-x86_64-linux-gnu)
@@ -43,7 +44,7 @@ GEM
43
44
  regexp_parser (2.10.0)
44
45
  reverse_markdown (3.0.0)
45
46
  nokogiri
46
- rexml (3.4.0)
47
+ rexml (3.4.1)
47
48
  rspec (3.13.0)
48
49
  rspec-core (~> 3.13.0)
49
50
  rspec-expectations (~> 3.13.0)
@@ -57,9 +58,10 @@ GEM
57
58
  diff-lcs (>= 1.2.0, < 2.0)
58
59
  rspec-support (~> 3.13.0)
59
60
  rspec-support (3.13.2)
60
- rubocop (1.71.2)
61
+ rubocop (1.72.1)
61
62
  json (~> 2.3)
62
- language_server-protocol (>= 3.17.0)
63
+ language_server-protocol (~> 3.17.0.2)
64
+ lint_roller (~> 1.1.0)
63
65
  parallel (~> 1.10)
64
66
  parser (>= 3.3.0.2)
65
67
  rainbow (>= 2.2.2, < 4.0)
@@ -73,8 +75,9 @@ GEM
73
75
  rubocop (~> 1.41)
74
76
  rubocop-factory_bot (2.26.1)
75
77
  rubocop (~> 1.61)
76
- rubocop-rake (0.6.0)
77
- rubocop (~> 1.0)
78
+ rubocop-rake (0.7.1)
79
+ lint_roller (~> 1.1)
80
+ rubocop (>= 1.72.1)
78
81
  rubocop-rspec (2.31.0)
79
82
  rubocop (~> 1.40)
80
83
  rubocop-capybara (~> 2.17)
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ require "rubocop/rake_task"
8
8
  require "yard"
9
9
 
10
10
  RSpec::Core::RakeTask.new(:spec)
11
- RuboCop::RakeTask.new(:rubocop)
11
+ RuboCop::RakeTask.new(:rubocop) # (moved to dedicated github action job)
12
12
  YARD::Rake::YardocTask.new
13
13
 
14
14
  desc "allows running a demo controller"
@@ -16,41 +16,4 @@ task :demo do
16
16
  system("rackup --host 0.0.0.0 -P #{File.expand_path(".")}/tmp/daemon.pid")
17
17
  end
18
18
 
19
- desc "automatically bump the gem's version"
20
- task :bump, [:type] do |_t, args|
21
- type = args[:type] || ENV["TYPE"] || "patch"
22
- current_version = Metatron::VERSION
23
- new_version = calculate_new_version(type)
24
- puts "Bumping gem version from #{current_version} to #{new_version}"
25
- update_version(new_version)
26
- update_gem_lock
27
- end
28
-
29
19
  task default: %i[spec rubocop yard]
30
-
31
- def calculate_new_version(type)
32
- version = Metatron::VERSION.split(".").map(&:to_i)
33
- case type
34
- when "patch"
35
- version[2] += 1
36
- when "minor"
37
- version[1] += 1
38
- version[2] = 0
39
- when "major"
40
- version[0] += 1
41
- version[1] = 0
42
- version[2] = 0
43
- end
44
-
45
- version.join(".")
46
- end
47
-
48
- def update_gem_lock
49
- system("bundle lock --update")
50
- end
51
-
52
- def update_version(new_version)
53
- file = File.read("lib/metatron/version.rb")
54
- new_contents = file.gsub(/VERSION = "(.+)"/, %(VERSION = "#{new_version}"))
55
- File.write("lib/metatron/version.rb", new_contents)
56
- end
@@ -15,8 +15,6 @@ module Metatron
15
15
  def finalize = raise NotImplementedError
16
16
  def sync = raise NotImplementedError
17
17
 
18
- private
19
-
20
18
  STRATEGY = {
21
19
  "/customize" => { data: :customize, etag: :calculate_customize_etag },
22
20
  # finalize calls should be rare and unique enough that we don't need to worry about ETags
@@ -24,6 +22,8 @@ module Metatron
24
22
  "/sync" => { data: :sync, etag: :calculate_sync_etag }
25
23
  }.freeze
26
24
 
25
+ private
26
+
27
27
  def _call
28
28
  return access_control_allow_methods if request.options?
29
29
  return not_found unless request.post?
@@ -12,10 +12,10 @@ module Metatron
12
12
  :affinity, :automount_service_account_token, :containers,
13
13
  :dns_policy, :enable_service_links, :hostname, :host_ipc, :host_network,
14
14
  :host_pid, :image_pull_secrets, :init_containers, :node_selector,
15
- :node_name, :persistent_volume_claims, :pod_annotations, :restart_policy,
16
- :scheduler_name, :security_context, :service_account,
17
- :service_account_name, :share_process_namespace, :subdomain,
18
- :termination_grace_period_seconds, :tolerations, :volumes
15
+ :node_name, :persistent_volume_claims, :pod_annotations,
16
+ :priority_class_name, :restart_policy, :scheduler_name, :security_context,
17
+ :service_account, :service_account_name, :share_process_namespace,
18
+ :subdomain, :termination_grace_period_seconds, :tolerations, :volumes
19
19
 
20
20
  initializer :pod_producer_initialize
21
21
 
@@ -26,6 +26,7 @@ module Metatron
26
26
  alias_method :hostIPC, :host_ipc
27
27
  alias_method :hostNetwork, :host_network
28
28
  alias_method :hostPID, :host_pid
29
+ alias_method :priorityClassName, :priority_class_name
29
30
  alias_method :nodeSelector, :node_selector
30
31
  alias_method :nodeName, :node_name
31
32
  alias_method :restartPolicy, :restart_policy
@@ -48,6 +49,7 @@ module Metatron
48
49
  @node_selector = {}
49
50
  @persistent_volume_claims = []
50
51
  @pod_annotations = {}
52
+ @priority_class_name = nil
51
53
  @restart_policy = nil
52
54
  @security_context = {}
53
55
  @termination_grace_period_seconds = nil
@@ -82,6 +84,18 @@ module Metatron
82
84
  pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
83
85
  end
84
86
 
87
+ def formatted_priority_class_name
88
+ return {} unless priority_class_name
89
+
90
+ if priority_class_name.is_a?(String)
91
+ { priorityClassName: priority_class_name }
92
+ elsif priority_class_name.is_a?(PriorityClass)
93
+ { priorityClassName: priority_class_name.name }
94
+ else
95
+ raise "priority_class_name must be a String or a PriorityClass"
96
+ end
97
+ end
98
+
85
99
  def formatted_security_context
86
100
  security_context && !security_context.empty? ? { securityContext: } : {}
87
101
  end
@@ -138,6 +152,7 @@ module Metatron
138
152
  .merge(formatted_init_containers)
139
153
  .merge(formatted_image_pull_secrets)
140
154
  .merge(formatted_node_selector)
155
+ .merge(formatted_priority_class_name)
141
156
  .compact
142
157
  }.compact
143
158
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metatron
4
+ module Templates
5
+ # Template for the PriorityClass k8s resource
6
+ class PriorityClass < Template
7
+ include Concerns::Annotated
8
+
9
+ attr_accessor :additional_labels, :description, :global_default, :value
10
+
11
+ alias global_default? global_default
12
+ alias globalDefault global_default
13
+
14
+ def initialize(name)
15
+ super
16
+ @api_version = "scheduling.k8s.io/v1"
17
+ @additional_labels = {}
18
+ @description = nil
19
+ @global_default = false
20
+ @value = 0
21
+ end
22
+
23
+ def render
24
+ {
25
+ apiVersion:,
26
+ kind:,
27
+ metadata: {
28
+ name:,
29
+ labels: base_labels.merge(additional_labels)
30
+ }.merge(formatted_annotations),
31
+ description:,
32
+ globalDefault:,
33
+ value:
34
+ }.compact
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Metatron
4
- VERSION = "0.8.8"
4
+ VERSION = "0.9.0"
5
5
  end
data/lib/metatron.rb CHANGED
@@ -35,6 +35,7 @@ require "metatron/templates/limit_range"
35
35
  require "metatron/templates/namespace"
36
36
  require "metatron/templates/network_policy"
37
37
  require "metatron/templates/persistent_volume_claim"
38
+ require "metatron/templates/priority_class"
38
39
  require "metatron/templates/replica_set"
39
40
  require "metatron/templates/resource_quota"
40
41
  require "metatron/templates/role"
data/metatron.gemspec CHANGED
@@ -14,11 +14,12 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
16
  spec.metadata["source_code_uri"] = "https://github.com/jgnagy/metatron"
17
+ spec.metadata["changelog_uri"] = "https://github.com/jgnagy/metatron/blob/main/CHANGELOG.md"
17
18
 
18
19
  # Specify which files should be added to the gem when it is released.
19
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
21
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ `git ls-files -z`.split("\x0").reject { _1.match(%r{^(test|spec|features)/}) }
22
23
  end
23
24
  spec.bindir = "exe"
24
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -0,0 +1,17 @@
1
+ {
2
+ "bootstrap-sha": "35ed7bd080d69b5e323fa748735b4a7ea885f224",
3
+ "last-release-sha": "35ed7bd080d69b5e323fa748735b4a7ea885f224",
4
+ "packages": {
5
+ ".": {
6
+ "package-name": "metatron",
7
+ "changelog-path": "CHANGELOG.md",
8
+ "release-type": "ruby",
9
+ "bump-minor-pre-major": false,
10
+ "bump-patch-for-minor-pre-major": false,
11
+ "draft": false,
12
+ "prerelease": false,
13
+ "version-file": "lib/metatron/version.rb"
14
+ }
15
+ },
16
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
17
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metatron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-12 00:00:00.000000000 Z
11
+ date: 2025-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -219,11 +219,13 @@ executables: []
219
219
  extensions: []
220
220
  extra_rdoc_files: []
221
221
  files:
222
+ - ".github/workflows/ci.yml"
222
223
  - ".gitignore"
223
- - ".roxanne.yml"
224
+ - ".release-please-manifest.json"
224
225
  - ".rspec"
225
226
  - ".rubocop.yml"
226
227
  - ".ruby-version"
228
+ - CHANGELOG.md
227
229
  - CODE_OF_CONDUCT.md
228
230
  - CONTRIBUTING.md
229
231
  - Gemfile
@@ -255,6 +257,7 @@ files:
255
257
  - lib/metatron/templates/network_policy.rb
256
258
  - lib/metatron/templates/persistent_volume_claim.rb
257
259
  - lib/metatron/templates/pod.rb
260
+ - lib/metatron/templates/priority_class.rb
258
261
  - lib/metatron/templates/replica_set.rb
259
262
  - lib/metatron/templates/resource_quota.rb
260
263
  - lib/metatron/templates/role.rb
@@ -265,15 +268,14 @@ files:
265
268
  - lib/metatron/templates/stateful_set.rb
266
269
  - lib/metatron/version.rb
267
270
  - metatron.gemspec
268
- - scripts/build.sh
269
- - scripts/release.sh
270
- - scripts/test.sh
271
+ - release-please-config.json
271
272
  homepage: https://github.com/jgnagy/metatron
272
273
  licenses:
273
274
  - MIT
274
275
  metadata:
275
276
  homepage_uri: https://github.com/jgnagy/metatron
276
277
  source_code_uri: https://github.com/jgnagy/metatron
278
+ changelog_uri: https://github.com/jgnagy/metatron/blob/main/CHANGELOG.md
277
279
  post_install_message:
278
280
  rdoc_options: []
279
281
  require_paths:
data/.roxanne.yml DELETED
@@ -1,14 +0,0 @@
1
- version: 1.0
2
- stages:
3
- build:
4
- image: ruby:3.3
5
- scripts:
6
- - ./scripts/build.sh
7
- test:
8
- image: ruby:3.3
9
- scripts:
10
- - ./scripts/test.sh
11
- release:
12
- image: ruby:3.3
13
- only:
14
- - main
data/scripts/build.sh DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
-
3
- gem install bundler
4
- bundle install --jobs=4
5
- rm -rf pkg/*.gem
6
- bundle exec rake build
data/scripts/release.sh DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
-
3
- gem install bundler
4
- bundle install --jobs=4
5
- rm -rf pkg/*.gem
6
- bundle exec rake build
7
- bundle exec gem push pkg/*.gem
data/scripts/test.sh DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
-
3
- gem install bundler
4
- bundle install --jobs=4
5
- gem build ./metatron.gemspec
6
- bundle exec rake