Repository navigation
Conversation
…ds and werf charts
Four gaps of the deployment graph, closed together.
Images named from a default value keep their Image; the edge says so.
A Dockerfile FROM / COPY --from filled by an ARG default (an ARG chain
names each ARG) carries default_of, as do compose `${X:-d}` images and
`docker build -t ${IMAGE:-x}` tags. An override found in the repository
adds its own edge: compose build.args and --build-arg make the Image the
build names DEPEND_ON the base they choose {override_of}; compose's .env
replacing an inline default marks the effective edge override_of and keeps
the default as {ref: image_default}, an image the service does not run.
Helm template images render (helm_template.c): a bounded Go
text/template + Sprig evaluator over the vendored gotmpl grammar, with
values read the way Helm reads them (go-yaml v2 scalars, float64 numbers,
Helm's coalesce). Each templated container image renders from its chart
family's defaults -- include / define helpers, with / range / if, subchart
values under their alias, global -- and the object USES it {default_of:
the values keys read}; the chart DEPLOYS it. A value that does not render
(a .Release field, lookup, a missing define, a field of a missing map, a
function not modelled) names no Image; a rendered value is checked against
the image reference grammar first. Releases render their charts with their
values: a Flux HelmRelease's spec.values, a kustomize helmCharts entry's
valuesFile + valuesInline (a chart in chartHome now links locally), a
Terraform helm_release's values + set (literals only; set_sensitive is
never read) -- each image that differs is the release's own DEPLOYS
{override_of}. A release of a chart outside the repository names images by
convention only where its values' `repository` names a registry host
{inferred: values}; a host-less one names none.
A chart DEPLOYS the CRDs of its crds/ {phase: crds}. A werf `.helm` dir
beside werf.yaml is a chart named after the werf project.
Incremental runs: a werf.yaml edit and a werf chart's values / templates
decline like a Chart.yaml chart's; a release's values file (a kustomize
valuesFile, a Terraform file()) declines too -- Terraform's now IMPORTS
{local_name: values} it, like kustomize's valuesFile.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This branch has not been deployed
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.
Summary
This closes the four gaps recorded in #2663's "Found, not changed here" and #2654's "Default values still name images".
include/definehelpers and release values, by a bounded Go template evaluator (src/pipeline/helm_template.c).crds/..helm/dir is a chart.No new node label or edge type is added. The image identity rules of #2654 stay: no registry host is ever invented.
1. Default-valued images (
pass_docker.c,pass_ci.c,pass_shell.c)FROM/COPY --fromfilled by anARGdefaultdefault_of: ["GO","BASE"], every ARG of a chainimage: ${X:-d},.envnot setting Xdefault_of: ["X"]docker build -t ${IMAGE:-x}(also throughIMAGE=${IMAGE:-x})default_of: ["IMAGE"]build.args,docker build --build-argoverride_of: ["GO"],dockerfile,tool,file,build_line.envreplacing an inline defaultoverride_of,override_source: ".env"; the default kept as{ref: image_default}(not run, so the env join and hubs ignore it)${X:-d}with noARG Xis not marked, because no build argument can set it.2. Helm template images (
helm_template.c,pass_k8s.c,pass_terraform.c)Values are read the way Helm reads them:
%v(1.10→1.1,20231010→2.023101e+07);nulldeletes a key;--settyping forset.Templates render with Go text/template semantics:
{{-/-}}trimming;if/else if/with/range(map keys sorted) /break;define/template/block/include/tpl;and/or;Anything not modelled is UNKNOWN, and an image that reads an UNKNOWN names no Image:
.Release.*,.Capabilities,lookup, a missing define, a field of a missing map. A rendered value is checked against the image reference grammar before it names an Image.What the graph gets:
global; a dependencyconditionthat is false disables the subchart.{default_of: <values keys read>}.<release> -DEPLOYS {via, ref: image, image, override_of}-> Image. Release sources:spec.values;helmChartsvaluesFile+valuesInline. A chart withoutrepo:now links to the chart incharts/instead of an external node;helm_releasevalues = [...](heredoc,file(),yamlencode) thenset(block or provider-v3 list). Literals only: an interpolation orset_listleaves the release unread.set_sensitiveis never read.repository(+tag/digest/registry), and only when the reference names a registry host. That gives{inferred: values, values_key}; a host-less repository names none.3. and 4.
crds/and werfcrds/:Chart -DEPLOYS {via: chart, phase: crds}->each CRD of<chart>/crds/.werf.yamlbeside a.helm/withoutChart.yamlmakes a Chart named after the werf project, and the dir links like any chart: objects, values, includes, images.deploy.helmChartDiris not followed.Incremental runs (
pipeline_incremental.c)These edits now decline to the full rebuild, like their Chart.yaml-chart equivalents:
werf.yamledit (helm_chart_changed);valuesFileor a Terraformfile()(helm_release_values_changed). Terraform's values file now getsIMPORTS {local_name: values}, like kustomize'svaluesFile.No index format bump: the change only adds edges and properties.
Proof on real input
All 20 pinned infra corpora, base
9f85f104against this branch.Oracle:
helm templatewith Helm 4.3.1, local only,--kube-version 1.30.0, on every root chart whose dependencies are in the repository (84 charts).include({{ include "x.podSpec" . | nindent }}). There is noimage:key in the template to render; recorded below.helm_libis a symlink not in the corpus copy, and two charts are required-value or YAML errors.What the graph gains:
{default_of}{default_of}{inferred: values}(home-ops 28){default_of}(ARG defaults, chains){override_of}(--build-arg, deckhouse){phase: crds}includeCALLS edges are now drawn, and the similarity pass moves accordingly (+14 / −1 SEMANTICALLY_RELATED).helm template -f / --setoutput.Tests
All of these are RED on
9f85f104by their assertions, then green:probe_docker_default_images_marked_and_overridesprobe_helm_template_images_render_with_defaults: a bitnami-stylecommon.images.imagehelper,with, the if/else digest branch, a subchart alias with overlay and global;.Release.Name, a missing define and a field of a missing map render nothing.probe_helm_release_images: HelmRelease local and external, kustomize local, Terraformset.probe_helm_chart_crds_and_werf_chartincremental_werf_values_edit_keeps_chart_edgeandincremental_release_values_edit_rebuilds. With only their decline rule reverted they are RED at the edit.probe_helm_chart_deploys_its_objectsnow expects its templatednginximage (host-less, kept as written).helm_values_follow_helm_semanticsunit-tests the values rules. It tests the new module directly, so it has no RED-on-base run.Verification
lint-no-suppressandlint-memory-coreare clean.Found, not changed here
include(5 of 110 oracle images): the container'simage:key is in the define, not the template.helm.values/valuesObject, FluxvaluesFrom/chart.spec.valuesFiles, kustomizevaluesMerge/additionalValuesFiles/helmGlobals.chartHome, werfdeploy.helmChartDir, subcharttags.docker run/docker pullin scripts, Makefile?=, skaffoldbuildArgs, compose multi-file merges,docker-bake.hcl,--targetstage pruning.image:gets no override edge: its Service source would go stale on a Dockerfile-only edit.crds/, but files there containing{{are still skeletonized before parsing.