Make the registry hostname configurable and drop the CA mount
buildDocker.groovy hardcoded harbor.35.238.248.203.nip.io as the push target, so the registry could not move without editing this shared library and every consumer moving in the same commit. It now reads config.harbor_registry, whose default lives in homelabPipeline.groovy beside harbor_project and every other key. The stage errors rather than defaulting when the value is missing. Carrying a second copy of the literal would leave two defaults free to disagree, and an unset value would otherwise build an image named "null/<project>/<repo>" — which docker accepts as a hostname and then fails to resolve, pointing nowhere near the cause. The dind pod no longer mounts the registry CA. That mount existed because the registry was a nip.io name, which no public CA will issue for, so cert-manager signed Harbor from a private CA; the node pool was told to trust it for pulls, but a push comes from dockerd inside the build pod, which has its own trust store. harbor.infra.deployshed.com carries a Let's Encrypt certificate that both already trust, so the mount, its volume and the whole arrangement go away rather than being repointed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LEsTefWWifp4ikvhHF5s6N
This commit is contained in:
co-authored by
Claude Opus 5
parent
a9119d7b8e
commit
6d743cbe48
@@ -13,11 +13,12 @@ property of the Jenkins it runs on.
|
||||
**What differs from the homelab copy**, all of it a consequence of GKE
|
||||
being a real cloud rather than one VM:
|
||||
|
||||
- **The registry hostname** is `harbor.35.238.248.203.nip.io`, in the push
|
||||
target and in all five fallback Dockerfiles.
|
||||
- **Harbor speaks TLS.** The homelab's dind passes `--insecure-registry`;
|
||||
here the pod mounts the private CA into dockerd's trust store instead.
|
||||
Node trust covers pulls only — a push is a separate client.
|
||||
- **The registry hostname** is `harbor.infra.deployshed.com`, in the push
|
||||
target (`harbor_registry`, see the table below) and in all five fallback
|
||||
Dockerfiles.
|
||||
- **Harbor speaks TLS, with a public certificate.** The homelab's dind
|
||||
passes `--insecure-registry`; here nothing is needed at all, because
|
||||
Let's Encrypt issues for the real domain and dockerd already trusts it.
|
||||
- **`helm_repo_url` uses cluster DNS**, since the clone happens inside a
|
||||
build pod. The homelab points it at an ingress hostname.
|
||||
- **`build-tools` is not in this repo.** It lives in
|
||||
@@ -46,6 +47,7 @@ in after checkout; repo-committed values win over the Jenkinsfile call).
|
||||
|---|---|---|
|
||||
| `service_name` | `repo_name` | Second path segment under `devops-helm-charts/values/` |
|
||||
| `argo_app_name` | `repo_name` | Must match the ArgoCD Application's `metadata.name` |
|
||||
| `harbor_registry` | `harbor.infra.deployshed.com` | The registry hostname images are pushed to and pulled from. Must be spelled identically here, in the `dockerconfigjson` `auths` key, and in Harbor's `externalURL` — docker matches both stored credentials and TLS trust by exact hostname, so a mismatch fails as `unauthorized` rather than as a name problem |
|
||||
| `harbor_project` | `apps-registry` | Must already exist in Harbor, and be public unless you also wire an `imagePullSecret` — the app values assume anonymous pull. A push to a missing project fails as `unauthorized: project <name> not found` |
|
||||
| `helm_repo_url` | `devops-helm-charts-gcp`, over cluster DNS | `http://gitea-http.gitea.svc.cluster.local:3000/gitadmin/…` — pod-to-pod, so it never leaves the cluster and comes back through the ingress |
|
||||
| `image_tag_yq_path` | `.deployment.image.tag` | **Override this if the app's chart isn't `1.0.0`** — e.g. `sts-2.0.0` uses `.podtemplate.image.tag` instead. Getting this wrong doesn't fail loudly: `yq -i` creates the path if missing rather than erroring, silently leaving the real field un-bumped. |
|
||||
@@ -89,7 +91,7 @@ a `podTemplate` (`resources/org/homelab/dind-pod.yaml`) via
|
||||
## Build-tools image
|
||||
|
||||
The `docker-cli` container runs
|
||||
`harbor.35.238.248.203.nip.io/base-images/build-tools:1`, which bakes in
|
||||
`harbor.infra.deployshed.com/base-images/build-tools:1`, which bakes in
|
||||
git, yq, bash, python3 with pip and venv, and curl, so nothing is installed
|
||||
on demand on every build.
|
||||
|
||||
@@ -103,14 +105,19 @@ until that pin is bumped. Bump the tag rather than overwriting one.
|
||||
|
||||
## Registry trust
|
||||
|
||||
`dind-pod.yaml` mounts the `registry-ca` ConfigMap (published by
|
||||
`devops-infra-argo-config-gcp`) into the dind container at
|
||||
`/etc/docker/certs.d/harbor.35.238.248.203.nip.io/ca.crt`.
|
||||
Nothing to configure. Harbor is reached at `harbor.infra.deployshed.com`,
|
||||
which carries a publicly trusted Let's Encrypt certificate, so both
|
||||
containerd on the node (pulls) and dockerd in the build pod (pushes) accept
|
||||
it out of the box.
|
||||
|
||||
Without it, pushes fail TLS verification while pulls of the same image
|
||||
succeed, which reads like a broken registry. The reason is that the two are
|
||||
different clients: pulls are performed by containerd on the node, which was
|
||||
told to trust this CA when the node pool was created, whereas the push comes
|
||||
from dockerd inside the build pod, which has its own trust store. The
|
||||
directory name must be the registry hostname exactly — dockerd looks the
|
||||
path up by host and silently ignores a mismatch.
|
||||
This used to be a real piece of setup, and the history is worth keeping
|
||||
because reintroducing a nip.io registry name would bring it all back. A
|
||||
nip.io address cannot have a public certificate — it is not on the public
|
||||
suffix list, and every `*.nip.io` certificate on the internet shares one
|
||||
rate limit — so cert-manager signed Harbor from a private CA instead. The
|
||||
node pool was told to trust that CA at creation, which covered pulls; the
|
||||
push came from dockerd inside the build pod, a separate client with its own
|
||||
trust store, so `dind-pod.yaml` had to mount the CA at
|
||||
`/etc/docker/certs.d/<registry host>/ca.crt` as well. The failure when that
|
||||
mount was missing was thoroughly confusing: pushes failed TLS verification
|
||||
while pulls of the very same image succeeded.
|
||||
|
||||
Reference in New Issue
Block a user