feat(chart): render extraManifests and serviceMonitor#1348
Open
tlongwell-block wants to merge 1 commit into
Open
feat(chart): render extraManifests and serviceMonitor#1348tlongwell-block wants to merge 1 commit into
tlongwell-block wants to merge 1 commit into
Conversation
Both `extraManifests` and `serviceMonitor` were declared in values.yaml and values.schema.json but consumed by no template — setting either produced no output (a silent no-op that's easy to miss in review). Add the two missing renderers: - templates/extramanifests.yaml: ranges over .Values.extraManifests, runs each entry through `tpl` (so entries may reference release values/helpers) and emits it as its own document. Lets operators ship companion objects (Istio mesh glue, NetworkPolicies, etc.) without forking the chart. - templates/servicemonitor.yaml: Prometheus Operator ServiceMonitor selecting the relay Service by the chart's selector labels (the subset the Service carries in its own metadata.labels) and scraping the named `metrics` port, gated on serviceMonitor.enabled. Add helm-unittest coverage: empty defaults emit nothing; an extraManifests entry tpl-resolves release values; the ServiceMonitor is omitted unless enabled and scrapes the metrics port when on. Full suite green (32 tests). Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co> Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.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.
What
Render the
extraManifestsandserviceMonitorvalues. Both are declared invalues.yamlandvalues.schema.json, but no template consumed either — so setting them produced no output. That's a silent no-op: the chart looks configured but ships nothing, which is easy to miss in review.Why
The Coder/tf-stacks Buzz deploy needs to attach companion Istio mesh objects (VirtualService, Sidecar, ServiceEntry, mesh Service) and a Prometheus ServiceMonitor alongside the relay.
extraManifestsis the standard escape hatch for the former;serviceMonitoralready existed for the latter. Making them actually render lets that deploy stay on the official chart verbatim instead of forking it or wrapping it in an umbrella chart.Changes (3 new files, no edits to existing templates)
templates/extramanifests.yaml— ranges over.Values.extraManifests, runs each entry throughtpl(so entries can reference release values/helpers like{{ include "buzz.fullname" . }}) and emits it as its own document.templates/servicemonitor.yaml— Prometheus OperatorServiceMonitor, gated onserviceMonitor.enabled. Selects the relay Service by the chart's selector labels (name+instance) — the subset the Service actually carries in itsmetadata.labels— and scrapes the namedmetricsport.tests/extras_test.yaml— helm-unittest coverage: empty defaults emit nothing; anextraManifestsentry tpl-resolves release values; theServiceMonitoris omitted unless enabled, and when on it selects the right labels and scrapes themetricsport.Note on the ServiceMonitor selector
A
ServiceMonitormatches a Service by the Service'smetadata.labels. The relay Service's metadata labels (buzz.labels) carryname+instancebut notapp.kubernetes.io/component: relay— that component label only appears in the Service'sspec.selector. So the selector here usesbuzz.selectorLabels, notbuzz.relaySelectorLabels; using the relay selector would have matched zero Services (the same silent-no-op class this PR fixes). The chart renders exactly one Service, so name+instance is a precise match.Verification
helm templaterenders both; empty defaults produce zero objects.metadata.labels(matches).helm unittest .— 32 tests / 7 suites green.helm lintclean.