Skip to content

feat(k8s): apply the Application path builds in deploy-stack - #6713

Merged
dan-petty merged 8 commits into
mainfrom
feat/6681-deploy-stack-application-manifests
Nov 22, 2026
Merged

dan-petty merged 8 commits into
mainfrom
feat/6681-deploy-stack-application-manifests

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

devops k8s deploy-stack builds the path sources of the Argo CD
Applications of APPLICATIONS_BY_STACK with Kustomize, as Argo CD does,
and applies each build with kubectl apply -f - before the charts. It
stops when the cluster refuses a build. teardown-stack deletes each
build. A source of another repository is fetched at its
targetRevision, and a path out of its repository stops the command. A
row of MANIFESTS_BY_STACK stays only where the build of its
Application holds more objects.

The dry runs list the objects in details.path_sources (deploy) and in
details.path_source_deletes (teardown, in the order of the deletes).
kubectl kustomize gets the proxy 127.0.0.1:9 and
GIT_ALLOW_PROTOCOL=file, so a remote target fails at once, and
details.kustomize_fetches gives the error. Go still downloads an http
or https URL of a loopback address, which can be a port-forward to a
cluster. The owner decides this exception.

Closes #6681

Change: openspec/changes/archive/2026-11-22-6681-deploy-stack-application-manifests/

@dan-petty dan-petty added type/feature Type feature: a new function scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 22, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Review points for the owner (no person steps):

  1. Rule of the issue, applied to each Application. The issue says: when the build of an Application holds more objects than the fixed list, keep the fixed list for that stack. The census shows that the builds of argocd and otel hold only the objects of their rows, while argo-workflows-manifests and ingress hold more. So the stack infra takes the builds of argocd and otel and keeps the two other rows. With the rule for a full stack, infra would keep all 4 rows, and dan-petty/homelab#94 (the NetworkPolicy of Argo CD) would get no build on a cluster without Argo CD.
  2. llm keeps its fixed list. The build of Application llm holds the gateway database and the ServiceMonitor, which need the CRDs of the charts, and the k8s gate row refuses a ServiceMonitor before the charts. dan-petty/homelab#88 (the Valkey of Open WebUI from infra) and the llm and argo-workflows folders of dan-petty/homelab#87 thus need a later change: the fixed paths, or a post-Helm split of the build.
  3. A remote base in a dry run. The dry run builds each folder of the checkout with kubectl kustomize as a local read. Kustomize has no option that refuses a remote base, so a kustomization of the checkout that names https://github.com/dan-petty/infra//...?ref=vX.Y.Z makes Kustomize fetch it, also in a dry run. The current tree holds no remote base. The acceptance criteria of dan-petty/homelab#87 and feat(security): complete security scanner migration to BaseSecurityScanner and ScannerRegistry #88 ask the dry run to list the objects of such a build, so they need this fetch. Decide whether a dry run may fetch a public base, or whether it lists the folder only for a kustomization with a remote base.
  4. Dry-run shape. render_dry_run_result cuts a value at nesting depth 3, so details.path_sources is a map from <application>: <path> to a list of <kind> <namespace>/<name> strings, and it holds at most 50 objects for each build (the collection cap of the dry-run model).
  5. Proof of the object parity. For each of the 6 stacks, the objects of details.manifests and details.path_sources of uv run devops k8s deploy-stack --stack <stack> --no-push-secrets --dry-run equal the objects of details.manifests on 671f24192: 22 for infra, 46 for llm, 1 for logging, 42 for devops, 1 for gitea, 0 for chat.

@dan-petty
dan-petty force-pushed the feat/6681-deploy-stack-application-manifests branch 3 times, most recently from 97f2a83 to 4298c34 Compare November 22, 2026 02:44
@dan-petty

Copy link
Copy Markdown
Owner Author

Review points for the owner (the merge confirms them)

  1. A loopback address is the one route the dry run cannot close. Go never sends a request for localhost or a loopback IP through a proxy, and no environment key changes that (golang.org/x/net/http/httpproxy, useProxy). So a kustomization of the checkout that names http://127.0.0.1/... is still fetched in a dry run; no request leaves the host. Each other URL fails at once on the closed proxy, and git refuses each transport but file, loopback included. Only a network namespace would close this route, and it is not portable.
  2. A change to the subprocess env guard. build_subprocess_env now accepts two caller keys with exactly one value each: GIT_ALLOW_PROTOCOL=file and GIT_SSH_COMMAND=false (CONST_GIT_LOCAL_ONLY_ENV). Both only restrict git; every other value and the lower-case keys stay refused, and tests cover both cases.
  3. A behavior change outside deploy-stack. path_source_folder now refuses a path source that leaves its repository, so devops k8s image-pins and devops k8s security-audit also stop on such a source (the same check as argocd_gate.py).
  4. In a dry run, each failed build is listed in details.kustomize_fetches and the dry run goes on, also for a local error such as a missing resource; the real run still stops on any failed build.

…#6681)

Kustomize fetches a remote base or component and has no option that
refuses it, so the dry runs of deploy-stack and teardown-stack read the
kustomization fields first. A folder that reaches a URL or a git
repository gets no build, and details.kustomize_fetches lists its remote
targets. The teardown tests cover the order of the deletes and a failed
build. The design gives the objects as strings and the build site.
)

A parser of the loader rule of Kustomize missed remote loads. A review
sent HTTP requests in dry runs through the path of a PatchTransformer,
a file of a ConfigMapGenerator and an env file whose URL holds `=`. So
the parser goes.

The stack dry runs now start kubectl kustomize with the proxy keys at
the closed port 127.0.0.1:9, an empty NO_PROXY, GIT_ALLOW_PROTOCOL=file
and GIT_SSH_COMMAND=false. The env guard accepts the two git keys with
these values only. Go sends each request to a host that is not a
loopback address to the proxy, and git refuses each transport but
file, so a remote target fails the build at once. A failed dry-run
build gives the first line of the kubectl error in
details.kustomize_fetches, and the dry run goes on. The real run does
not change.
Go sends an http or https request to a loopback address with no proxy,
and no environment key changes this. So the dry-run builds download
such a URL, also of a remote base, which Kustomize first loads as a
file. The request can reach a kubectl port-forward to a cluster, so it
is not a local read. The spec, the design, the proposal, k8s/README.md,
the docstrings and the --dry-run help now state this. A git remote at
a loopback address still fails, and a live case shows it.

A path source whose path goes out of the folder of its repository now
raises ApplicationSourceError, as argocd_gate refuses it, so no build
reads a folder outside the checkout.

details.kustomize_fetches gives the error of kubectl as one line, from
its prefix to its end. The error of a builtin transformer holds its
config on lines of its own and gives the cause last. A live case adds
the path of an entry of patches.

An object with no namespace in the build shows as `<kind> <name>`. The
documents no longer call each such object one of the cluster scope.
@dan-petty
dan-petty force-pushed the feat/6681-deploy-stack-application-manifests branch from 4298c34 to d8dd318 Compare November 22, 2026 02:56
@dan-petty
dan-petty marked this pull request as ready for review November 22, 2026 03:04
@dan-petty
dan-petty merged commit d905dbd into main Nov 22, 2026
30 checks passed
@dan-petty
dan-petty deleted the feat/6681-deploy-stack-application-manifests branch November 22, 2026 03:06
dan-petty pushed a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.192.0](v0.191.1...v0.192.0)
(2026-11-22)


### Features

* **k8s:** apply the Application path builds in deploy-stack
([#6713](#6713))
([d905dbd](d905dbd))
* **k8s:** render a credential-free planner ConfigMap
([#6723](#6723))
([745108e](745108e))


### Bug Fixes

* **k8s:** split the network policies whose egress skips their ingress
([#6721](#6721))
([235fea0](235fea0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(k8s): build deploy-stack manifests from the Applications

1 participant