metatron 0.10.1 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfe544a98c67ba6ae97f9e09fac9a58483c169fd067f89484b2d454f2d290d43
4
- data.tar.gz: b40a06690c8eaf0f226e82ebe17a24916724e178bd8b63765dfed4a9ee9f8762
3
+ metadata.gz: 3e624bf8ef1365843b3a1af54bdb89b377776358f84693d7f1a2dad737494393
4
+ data.tar.gz: e6c7576f3b2a6d3ca1d81aa1a6ee3295ae7d19811854173eb3e850343d34b19f
5
5
  SHA512:
6
- metadata.gz: cfe09b2799cef530b00ce400f56d880236ef7c263806f81300a97139da739c57358a3ea5708f69c230c14d554a341b4d7f10c88536f112a85a18d52799d7f892
7
- data.tar.gz: 2d6aa1b21ead7c64f227d9c819164fa07a06c0a7ac312981b73a5d0c4c83915d01d72258507285ed1468287471eadda77d697dca340a4c4c9b7aedb9fde0af16
6
+ metadata.gz: 3c1002350e83eb88f492b81930bde8636dd7de7ff7b21abb28b1f1d719ebc8f07e334495270d5440bcf92f8af5493add44a6d9e852e42eda6cde4efa52e734c4
7
+ data.tar.gz: 3628be437221e7d0608afd2944510bc05f65a5d388feb01fd044d3f0c24f6d84e7788360b04286525a4bddc90697246f9611f4ab693c39544062cac21d1245c5
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.10.1"
2
+ ".": "0.11.0"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.11.0](https://github.com/jgnagy/metatron/compare/metatron/v0.10.1...metatron/v0.11.0) (2025-03-28)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **templates:** secret now base64 encodes
9
+ * **templates:** omit attribute when default
10
+
11
+ ### Code Refactoring
12
+
13
+ * **templates:** omit attribute when default ([0add60c](https://github.com/jgnagy/metatron/commit/0add60c5ef9faca5e1c7be050415ef3a1f15227b))
14
+ * **templates:** secret now base64 encodes ([3d263ec](https://github.com/jgnagy/metatron/commit/3d263ec85b9d7e87b987c2fcf4c6fc9664eb84d6))
15
+
3
16
  ## [0.10.1](https://github.com/jgnagy/metatron/compare/metatron/v0.10.0...metatron/v0.10.1) (2025-03-21)
4
17
 
5
18
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metatron (0.10.1)
4
+ metatron (0.11.0)
5
+ base64
5
6
  json (~> 2.6)
6
7
  rack (>= 2.2.8, < 4)
7
8
 
@@ -10,6 +11,7 @@ GEM
10
11
  specs:
11
12
  ast (2.4.2)
12
13
  backport (1.2.0)
14
+ base64 (0.2.0)
13
15
  benchmark (0.4.0)
14
16
  byebug (11.1.3)
15
17
  diff-lcs (1.6.0)
@@ -23,9 +25,9 @@ GEM
23
25
  language_server-protocol (3.17.0.4)
24
26
  lint_roller (1.1.0)
25
27
  logger (1.6.6)
26
- nokogiri (1.18.3-arm64-darwin)
28
+ nokogiri (1.18.4-arm64-darwin)
27
29
  racc (~> 1.4)
28
- nokogiri (1.18.3-x86_64-linux-gnu)
30
+ nokogiri (1.18.4-x86_64-linux-gnu)
29
31
  racc (~> 1.4)
30
32
  observer (0.1.2)
31
33
  ostruct (0.6.1)
@@ -7,15 +7,38 @@ module Metatron
7
7
  include Concerns::Annotated
8
8
  include Concerns::Namespaced
9
9
 
10
- attr_accessor :additional_labels, :type, :data
10
+ attr_accessor :additional_labels, :type, :data, :string_data
11
11
 
12
- def initialize(name, data = {})
12
+ alias stringData string_data
13
+
14
+ def initialize(name, provided_string_data = nil, string_data: nil, data: nil)
13
15
  super(name)
16
+ @string_data = string_data || provided_string_data
14
17
  @data = data
15
18
  @additional_labels = {}
16
19
  @type = "Opaque"
17
20
  end
18
21
 
22
+ def formatted_data
23
+ data_hash = {}
24
+
25
+ # Only include one of data or string_data, preferring data if both are present
26
+ return data_hash unless data || string_data
27
+
28
+ # If string_data is provided, it should be a hash of string values
29
+ # and will be base64 encoded
30
+ if string_data
31
+ data_hash[:data] = string_data.transform_values do |value|
32
+ Base64.strict_encode64(value.to_s).gsub("\n", "")
33
+ end
34
+ end
35
+
36
+ # If data is provided, it should be a hash of base64 encoded values
37
+ data_hash[:data] = data if data
38
+
39
+ data_hash
40
+ end
41
+
19
42
  def render
20
43
  {
21
44
  apiVersion:,
@@ -24,9 +47,8 @@ module Metatron
24
47
  name:,
25
48
  labels: base_labels.merge(additional_labels)
26
49
  }.merge(formatted_annotations).merge(formatted_namespace).compact,
27
- type:,
28
- stringData: data
29
- }.compact
50
+ type:
51
+ }.compact.merge(formatted_data).compact
30
52
  end
31
53
  end
32
54
  end
@@ -40,6 +40,10 @@ module Metatron
40
40
  ports&.any? ? { ports: } : {}
41
41
  end
42
42
 
43
+ def formatted_publish_not_ready_addresses
44
+ publish_not_ready_addresses ? { publishNotReadyAddresses: } : {}
45
+ end
46
+
43
47
  def render
44
48
  {
45
49
  apiVersion:,
@@ -51,9 +55,8 @@ module Metatron
51
55
  spec: {
52
56
  type:,
53
57
  selector: selector.merge(additional_selector_labels),
54
- publishNotReadyAddresses:,
55
58
  clusterIP:
56
- }.compact.merge(formatted_ports)
59
+ }.compact.merge(formatted_ports).merge(formatted_publish_not_ready_addresses)
57
60
  }
58
61
  end
59
62
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Metatron
4
- VERSION = "0.10.1"
4
+ VERSION = "0.11.0"
5
5
  end
data/lib/metatron.rb CHANGED
@@ -6,6 +6,9 @@ require "securerandom"
6
6
  require "time"
7
7
  require "logger"
8
8
 
9
+ # external requirements
10
+ require "base64"
11
+
9
12
  # The top-level module for Metatron
10
13
  module Metatron
11
14
  class Error < StandardError; end
data/metatron.gemspec CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.required_ruby_version = "~> 3.1"
29
29
 
30
+ spec.add_dependency "base64"
30
31
  spec.add_dependency "json", "~> 2.6"
31
32
  spec.add_dependency "rack", ">= 2.2.8", "< 4"
32
33
 
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metatron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.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-03-21 00:00:00.000000000 Z
11
+ date: 2025-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: json
15
29
  requirement: !ruby/object:Gem::Requirement