kubernetes_template_rendering 0.6.1 → 0.6.2

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: 5db190341419a622d7593eea77f9ad5525839c0c2039d540edd55a6ce8117479
4
- data.tar.gz: ac8e1ec55caccb59e15cc7b552c58e433f14ac3d3946b9100a1895cfcab97ea2
3
+ metadata.gz: 7c71eb502c7b52355ee6d9040a8401a6e7937477b4ffc81b725951187340e325
4
+ data.tar.gz: 07e31b80f5c7c2e0d95860d10a4a73390dd919eeed86000867e151faad9f7113
5
5
  SHA512:
6
- metadata.gz: 34090f91339fc87a45fb91bd3174f281953d952f618ee91b035fb4ecc1dca9c9f2f1cbc8c0f7450cdac739c93229e5b18c4a7e547d22bc735f550808747de74b
7
- data.tar.gz: 8bac2935eb16a00898e10f132f8fb5260a71feae470719267111ea2118c3a2d25267130e8d71683936e4faa40473aa8616f2ba90060abdbcf1af29e2a8c721be
6
+ metadata.gz: 3113be1c65d2e3f356e82b0b3388f9a090fab3945dcc9c54720146f12f9f95d8c95e7dd7fae7af0c00687aa6e557cf84c7fc6de5754f16c7e831fe101b283770
7
+ data.tar.gz: 64b29afd0de7680e0a8c4aa57010268bc3e1e0bb6ec502c11d91e1ac518d633371d8b1b8f7fa368cb71b73f5e89754e42fecc36cbdd56e698077064269316e0a
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.6.2] - 2026-07-15
8
+ ### Fixed
9
+ - Fixed the `--reconcile` sweep root for entries whose `subdirectory:` nests more than one level deep (e.g. `subdirectory: exclude-argocd/auth`). The sweep root is now the entry's canonical base — `<region>/<cluster_type>/<color>` for non-SPP entries and `<region>/<cluster_type>/<color>/spp/SPP-PLACEHOLDER` for SPP entries — regardless of `subdirectory:` depth, rather than the immediate parent of the rendered output directory. Previously a nested `subdirectory:` pushed the sweep root one level too deep, so when a `subdirectory:` was renamed or nested deeper the files left at the old shallower path were siblings of the sweep root and were never swept.
10
+
11
+ ### Changed
12
+ - Under `--reconcile`, non-SPP entries must now render within their canonical `<region>/<cluster_type>/<color>` base; an entry that renders outside it (only reachable via the deprecated `directory:` field) hard-errors before any writes. This completes the reconcile layout hard-validation deferred in ADR-0001 — SPP entries were already constrained to the `spp/SPP-PLACEHOLDER` prefix. See ADR-0001.
13
+
7
14
  ## [0.6.1] - 2026-07-08
8
15
  ### Fixed
9
16
  - Fixed `variable_overrides` and `source_repo` not being forwarded to child `Resource` instances created by `DeployGroupedResource`. Previously, `--variable-override` values (e.g. `deploySha`) were silently unavailable inside all `*-deploy.jsonnet` and `*-deploy.yaml.erb` templates, causing a `KeyError` at render time. `DeployGroupedResource#initialize` now accepts both as optional keyword arguments and passes them through to each `Resource.new` call in `#render`. `ResourceSet#grouped_resources` is updated to supply both values.
@@ -74,12 +74,13 @@ module KubernetesTemplateRendering
74
74
 
75
75
  # Bounded reconcile scope roots for this entry, one per region × color.
76
76
  #
77
- # The sweep root is the parent directory of the entry's rendered `output_directory`, derived
78
- # from the actual `directory:` pattern rather than assuming a fixed layout. For a
79
- # `.../<service>` pattern that parent is the `<region>/<cluster_type>/<color>` base; for a
80
- # `<region>/<service>` pattern it is `<region>`. The parent is shared with sibling entries, so
81
- # leftovers from a deleted/renamed entry under it are swept. The renderer validates each
82
- # `base_root` stays within `rendered_directory` (out-of-prefix, full or relative, is a hard error).
77
+ # The sweep root is the entry's canonical base `<region>/<cluster_type>/<color>` for a non-SPP
78
+ # entry, or `<region>/<cluster_type>/<color>/spp/SPP-PLACEHOLDER` for an SPP one independent of
79
+ # how deep the `subdirectory:` nests. Anchoring at the canonical base (rather than the rendered
80
+ # `output_directory`'s parent) keeps the sweep root fixed when a `subdirectory:` is renamed or
81
+ # nested deeper, so leftovers at the old shallower path are still swept. The renderer validates
82
+ # that the `output_directory` actually falls within this root before sweeping (an entry that
83
+ # renders elsewhere — only reachable via the deprecated `directory:` field — is a hard error).
83
84
  #
84
85
  # Each scope also carries `spp:` (whether this entry is an SPP definition) and `spp_base_root:`
85
86
  # (the canonical `<region>/<cluster_type>/<color>/spp/SPP-PLACEHOLDER` prefix for that region ×
@@ -88,8 +89,10 @@ module KubernetesTemplateRendering
88
89
  @regions.flat_map do |plain_region|
89
90
  @colors.map do |c|
90
91
  output_directory = File.join(@rendered_directory, format(@target_output_directory, plain_region: plain_region, color: c, type: @kubernetes_cluster_type))
92
+ base_path = File.join(@rendered_directory, format(BASE_OUTPUT_DIRECTORY, plain_region: plain_region, color: c, type: @kubernetes_cluster_type))
91
93
  spp_base_root = File.join(@rendered_directory, format(SPP_BASE_OUTPUT_DIRECTORY, plain_region: plain_region, color: c, type: @kubernetes_cluster_type))
92
- { base_root: File.dirname(output_directory), output_directory: output_directory, spp: @spp, spp_base_root: spp_base_root }
94
+ base_root = @spp ? spp_base_root : base_path
95
+ { base_root: base_root, output_directory: output_directory, spp: @spp, spp_base_root: spp_base_root }
93
96
  end
94
97
  end
95
98
  end
@@ -92,6 +92,11 @@ module KubernetesTemplateRendering
92
92
  scopes.each do |scope|
93
93
  validate_within_scope!(scope[:base_root], @rendered_directory)
94
94
  validate_spp_layout!(scope)
95
+ # Every entry must render within its canonical root so reconcile owns exactly what it sweeps.
96
+ # SPP entries are already constrained to the spp/SPP-PLACEHOLDER prefix by validate_spp_layout!;
97
+ # a non-SPP entry can only escape its base via the deprecated `directory:` field, which reconcile
98
+ # cannot own — so reject it before any writes rather than sweep a tree it does not render into.
99
+ validate_within_scope!(scope[:output_directory], scope[:base_root]) unless scope[:spp]
95
100
  end
96
101
 
97
102
  base_roots = []
@@ -142,7 +147,8 @@ module KubernetesTemplateRendering
142
147
  # is always re-rendered (it is the expansion source) and each target is freshly expanded from it,
143
148
  # so both are marker-safe. Unrequested SPP siblings are not re-rendered this run and stay excluded.
144
149
  def spp_reconcile_roots(scope)
145
- root = spp_sweep_root(scope)
150
+ # base_root is the canonical `.../spp/SPP-PLACEHOLDER` prefix for SPP entries.
151
+ root = scope[:base_root]
146
152
  return [root] if @spps.empty?
147
153
  return [root] unless root.include?(ResourceSet::SPP_PLACEHOLDER)
148
154
 
@@ -153,13 +159,6 @@ module KubernetesTemplateRendering
153
159
  Pathname.new(root).relative_path_from(Pathname.new(@rendered_directory)).each_filename.include?(SPP_FENCE_DIRNAME)
154
160
  end
155
161
 
156
- # When the directory pattern has no service subdirectory (e.g. `.../spp/SPP-PLACEHOLDER`),
157
- # base_root lands at the `spp/` level itself — sweeping that would touch all SPP siblings.
158
- # Use output_directory (= `spp/<spp-name>`) in that case instead.
159
- def spp_sweep_root(scope)
160
- File.basename(scope[:base_root]) == SPP_FENCE_DIRNAME ? scope[:output_directory] : scope[:base_root]
161
- end
162
-
163
162
  def reconcile_sweep(reconciler, scopes)
164
163
  scopes[:base_roots].each { |r| reconciler.sweep!(root: r, fences: [File.join(r, SPP_FENCE_DIRNAME)]) }
165
164
  scopes[:spp_roots].each { |r| reconciler.sweep!(root: r) }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubernetesTemplateRendering
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubernetes_template_rendering
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Octothorpe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-08 00:00:00.000000000 Z
11
+ date: 2026-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport