Repository navigation
test: cover every template and helper; fix nested overlays after adopt - #12
Merged
Merged
Conversation
Add regression asserts for every template (apiVersion, kind, typeFor, namespace scope), the pod template overlays on all workloads, named and keyed arrays, default-container, RBAC refs, generic helpers, components and adopt. The new adopt test found a bug: after adopt, overlays on an array inside an array item (e.g. containers_.c.env_) were ignored, because each item was adopted again when rendering and its upstream array won. Items are now adopted once, up front, so later overlays apply on top. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds tests for everything
k8s.libsonnetdoes, and fixes a bug inadoptthat the new tests found.Tests (
tests/k8s_test.jsonnet)apiVersionandkind,typeForfinds it, and only namespaced kinds get the shared namespace.typeForfalls back to the plainObjectfor unknown kinds and groups.PodTemplateSpecoverlays.ObjectTemplateMetalabels land on both the object and its pods.containers_,initContainers_,volumes_,env_,ports_,volumeMounts_, Serviceports_.default-container: set for one main container plus sidecars; not set for two main containers or none.name:volumeClaimTemplates_,endpoints_,podMetricsEndpoints_,selector_.matchExpressions_, VaultSecretsecrets_.applyOverlayEach,deriveEach,asKeyedArray,asNamedArray,orray); mounted components getting the parent'sk8s,envConfandconf;RootComponent.adopt: nested overlays, new containers after adopt, unknown kinds unchanged.Bug fix (
adoptNamedArray)After
adopt, an overlay on an array inside an array item was ignored:Each item was adopted again when the output was built, and its upstream
envarray won over the overlay. Items are now adopted once, whenadoptruns, so later overlays apply on top. New containers added afteradoptstill get theContainertemplate.examples/adopt.goldenis unchanged.just testpasses.🤖 Generated with Claude Code