Spin up helloworld container for POC#18
Open
nicklathe wants to merge 1 commit into
Open
Conversation
Signed-off-by: Nick Lathe <nick.lathe@code.org>
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.
Here was the plan to create this change:
PLAN: Hello-world app driven by Kargo
Goal
Stand up a small, fully isolated app that Kargo watches and deploys, to prove out
the watch → promote → deploy → DNS pipeline without depending on the (currently broken)
code-dot-orgimage/chart.docker.io/library/nginx(the official nginx image, serving itsstatic "Welcome to nginx!" page on
:80; public, so no pull credentials needed). Itreflects no request data back, and publishes well-maintained immutable semver tags
(e.g.
1.27.3), so the Warehouse uses the cleanSemVer+cacheByTag: trueform.hello.k8s.code.org(single-level name, covered by the existing*.k8s.code.orgwildcard ACM cert, so TLS is automatic).kargo-project-helloworld) and a brand-newArgoCD app (
helloworld). The existingcodeaiproject is left completely untouched.How it will work end to end
main.apps/helloworld/application.yaml; the parentkargoapp (via a new source entry) bootstraps the new Kargo project.helloworldapp using the starting image already invalues.yaml, so it's healthy immediately (before Kargo ever promotes).autoPromotionEnabled: true) runs the Stage: clone repo → write thetag into
apps/helloworld/values.yaml→ commit + push tomain→argocd-update.code.ai/dns-namelabel on the Ingress andcreates the
hello.k8s.code.orgRoute53 record automatically.Files to CREATE
A. Deployment target —
apps/helloworld/A small local Helm chart plus an ArgoCD Application, mirroring the multi-source
pattern codeai uses (chart from one source, image value from a
$valuesfile that Kargorewrites).
apps/helloworld/application.yaml— ArgoCDApplicationnamedhelloworld.apps/helloworld/chartwithvalueFiles: [$values/apps/helloworld/values.yaml]; source 2 = this repo asref: values.helloworld,syncOptions: [CreateNamespace=true, ServerSideApply=true],automated prune + selfHeal.
argocd-updateis authorized):kargo.akuity.io/authorized-stage: kargo-project-helloworld:devkargo.akuity.io/project: kargo-project-helloworldapps/helloworld/values.yaml— the file Kargo rewrites on each promotion.image: docker.io/library/nginx:1.27.3← real (immutable) starting value so theapp is healthy before the first promotion.
dnsName: helloapps/helloworld/chart/Chart.yaml— minimal chart metadata (type: application).apps/helloworld/chart/values.yaml— defaults:image,dnsName: hello,replicas: 1.apps/helloworld/chart/templates/deployment.yaml— Deployment running thenginxcontainer oncontainerPort: 80, with readiness/livenesshttpGet /probes.apps/helloworld/chart/templates/service.yaml— ClusterIP Service:80 → 80.apps/helloworld/chart/templates/ingress.yaml— Ingress fronting the Service:ingressClassName: aws-alb(the cluster default ALB class).code.ai/dns-name: {{ .Values.dnsName }}→ external-dns createshello.k8s.code.org.hello.k8s.code.orgso the ALB auto-discovers the wildcard ACM cert for HTTPS.B. Kargo project —
apps/kargo/projects/helloworld/Mirrors
apps/kargo/projects/codeai/structure.project.yaml—kind: Project, namekargo-project-helloworld.namespace.yaml— namespacekargo-project-helloworldwith the requiredkargo.akuity.io/project: "true"label.project-config.yaml—promotionPolicies: [{ stage: dev, autoPromotionEnabled: true }].application.yaml— ArgoCDApplicationnamedkargo-project-helloworldthatrecurses this dir (excluding
application.yaml), modeled on codeai's project app.warehouse.yaml—kind: Warehousenamedkargo-project-helloworld:repoURL: docker.io/library/nginximageSelectionStrategy: SemVerwithsemverConstraint: '>=1.27.0'cacheByTag: true— nginx patch tags (e.g.1.27.3) are immutable, so caching is safe.git-<sha>regex or amd64/arm64 ignores — those are codeai-specific)stages/dev.yaml—kind: Stagenameddev, modeled on codeai'sstaging.yaml:requestedFreightfrom Warehousekargo-project-helloworld,direct: true.git-clone→yaml-update(path./gitops/apps/helloworld/values.yaml,key
image, valuedocker.io/library/nginx:${{ imageFrom("docker.io/library/nginx").Tag }})→
git-commit(messagePromote helloworld dev to <tag> [skip ci]) →git-push→
argocd-update(apphelloworld, namespaceargocd).imageFrom(...)argument isdocker.io/library/nginx— must exactly matchthe Warehouse
repoURLor promotion fails.File to EDIT (1)
apps/kargo/application.yaml— add a 4th source so the parentkargoapp bootstrapsthe new project's Application (same pattern as the existing codeai source):
This is the only non-auto-discovered registration step.
Open questions / risks to confirm during execution
EKS Auto Mode ALB annotations. The cluster uses the EKS Auto Mode ALB controller
(
eks.amazonaws.com/alb), not the standalone AWS Load Balancer Controller. The exactalb.ingress.kubernetes.io/*annotation set (and whether the ACM cert is auto-discoveredby host vs. needs an explicit
certificate-arn) should be confirmed against thecode-dot-org base Ingress before relying on HTTPS. Plan: start minimal (default
aws-albclass + host rule + dns-name label); if HTTPS doesn't come up, add thecertificate-arn/listen-ports annotations to match the working codeai ingress.Kargo git-push credentials. Promotion pushes to this repo using the shared
cred-type: gitsecret inkargo-shared-resources. This works for codeai, whichimplies the controller treats that namespace as global credentials — so the new project
should inherit it. Confirm the first promotion actually pushes; if it fails on auth,
the fix is to make the git credential available to
kargo-project-helloworld.nginx tag format. Assumes the official nginx image publishes full
X.Y.Zsemvertags (it does, e.g.
1.27.3). WithstrictSemvers(default), partial tags like1.27or
1are ignored and the Warehouse picks the newest full-semver tag matching>=1.27.0— produced on the first poll and auto-promoted.Verification (after merge)
helloworldandkargo-project-helloworldapps go Synced/Healthy.
devStage promotes;a
Promote helloworld dev to <tag> [skip ci]commit lands onmain.kubectl -n helloworld get pods,svc,ingresskubectl -n kargo-project-helloworld get warehouse,freight,stagecurl -i https://hello.k8s.code.orgreturns the nginx welcome page over HTTPS.Rollback
Delete
apps/helloworld/andapps/kargo/projects/helloworld/, revert theapps/kargo/application.yamledit, merge. ArgoCD prunes all resources; external-dns(
policy: sync) removes the Route53 record automatically.Execution order
apps/helloworld/(chart + Application + values).apps/kargo/projects/helloworld/(project, namespace, config, app, warehouse, stage).apps/kargo/application.yaml(add the 4th source).helm template/kustomize buildlocally to sanity-check the chart renders.main. ArgoCD + Kargo do the rest.