From 8d908370294f164c2fea089a305abc1223486738 Mon Sep 17 00:00:00 2001 From: Nick Lathe Date: Tue, 9 Jun 2026 16:14:02 -0700 Subject: [PATCH] Spin up helloworld container for POC Signed-off-by: Nick Lathe --- apps/helloworld/application.yaml | 38 ++++++++++++++++ apps/helloworld/chart/Chart.yaml | 5 +++ .../chart/templates/deployment.yaml | 36 ++++++++++++++++ apps/helloworld/chart/templates/ingress.yaml | 30 +++++++++++++ apps/helloworld/chart/templates/service.yaml | 13 ++++++ apps/helloworld/chart/values.yaml | 5 +++ apps/helloworld/values.yaml | 4 ++ apps/kargo/application.yaml | 5 +++ .../projects/helloworld/application.yaml | 27 ++++++++++++ apps/kargo/projects/helloworld/namespace.yaml | 6 +++ .../projects/helloworld/project-config.yaml | 9 ++++ apps/kargo/projects/helloworld/project.yaml | 4 ++ .../kargo/projects/helloworld/stages/dev.yaml | 43 +++++++++++++++++++ apps/kargo/projects/helloworld/warehouse.yaml | 12 ++++++ 14 files changed, 237 insertions(+) create mode 100644 apps/helloworld/application.yaml create mode 100644 apps/helloworld/chart/Chart.yaml create mode 100644 apps/helloworld/chart/templates/deployment.yaml create mode 100644 apps/helloworld/chart/templates/ingress.yaml create mode 100644 apps/helloworld/chart/templates/service.yaml create mode 100644 apps/helloworld/chart/values.yaml create mode 100644 apps/helloworld/values.yaml create mode 100644 apps/kargo/projects/helloworld/application.yaml create mode 100644 apps/kargo/projects/helloworld/namespace.yaml create mode 100644 apps/kargo/projects/helloworld/project-config.yaml create mode 100644 apps/kargo/projects/helloworld/project.yaml create mode 100644 apps/kargo/projects/helloworld/stages/dev.yaml create mode 100644 apps/kargo/projects/helloworld/warehouse.yaml diff --git a/apps/helloworld/application.yaml b/apps/helloworld/application.yaml new file mode 100644 index 00000000..76a5e2dd --- /dev/null +++ b/apps/helloworld/application.yaml @@ -0,0 +1,38 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: helloworld + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io + annotations: + # Authorizes the Kargo dev stage to run argocd-update against this app. + kargo.akuity.io/authorized-stage: kargo-project-helloworld:dev + labels: + app.kubernetes.io/managed-by: kargo + kargo.akuity.io/project: kargo-project-helloworld +spec: + project: default + sources: + # The chart lives in this repo; the image tag comes from values.yaml below, + # which the Kargo dev stage rewrites on each promotion. + - repoURL: https://github.com/code-dot-org/k8s-gitops.git + targetRevision: main + path: apps/helloworld/chart + helm: + releaseName: helloworld + valueFiles: + - $values/apps/helloworld/values.yaml + - repoURL: https://github.com/code-dot-org/k8s-gitops.git + targetRevision: main + ref: values + destination: + server: https://kubernetes.default.svc + namespace: helloworld + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - ServerSideApply=true + - CreateNamespace=true diff --git a/apps/helloworld/chart/Chart.yaml b/apps/helloworld/chart/Chart.yaml new file mode 100644 index 00000000..619d88e7 --- /dev/null +++ b/apps/helloworld/chart/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: helloworld +description: Minimal static nginx app used to exercise the Kargo image pipeline +type: application +version: 0.1.0 diff --git a/apps/helloworld/chart/templates/deployment.yaml b/apps/helloworld/chart/templates/deployment.yaml new file mode 100644 index 00000000..1019bd42 --- /dev/null +++ b/apps/helloworld/chart/templates/deployment.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: helloworld + labels: + app.kubernetes.io/name: helloworld +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + app.kubernetes.io/name: helloworld + template: + metadata: + labels: + app.kubernetes.io/name: helloworld + spec: + containers: + - name: nginx + image: {{ .Values.image | quote }} + ports: + - name: http + containerPort: 80 + readinessProbe: + httpGet: + path: / + port: http + livenessProbe: + httpGet: + path: / + port: http + resources: + requests: + cpu: 10m + memory: 32Mi + limits: + memory: 64Mi diff --git a/apps/helloworld/chart/templates/ingress.yaml b/apps/helloworld/chart/templates/ingress.yaml new file mode 100644 index 00000000..f5364e3a --- /dev/null +++ b/apps/helloworld/chart/templates/ingress.yaml @@ -0,0 +1,30 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: helloworld + labels: + # external-dns maps this label to .k8s.code.org (see apps/infra/external-dns). + code.ai/dns-name: {{ .Values.dnsName }} + annotations: + argocd.argoproj.io/ignore-default-links: "true" + link.argocd.argoproj.io/external-link: https://{{ .Values.dnsName }}.k8s.code.org/ + # ALB settings mirror the proven set used by the Kargo ingress (apps/kargo/values.yaml). + # The wildcard ACM cert (*.k8s.code.org) is auto-discovered by host, so no cert ARN needed. + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/target-type: ip + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]' + alb.ingress.kubernetes.io/ssl-redirect: "443" + alb.ingress.kubernetes.io/backend-protocol: HTTP +spec: + ingressClassName: aws-alb + rules: + - host: {{ .Values.dnsName }}.k8s.code.org + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: helloworld + port: + name: http diff --git a/apps/helloworld/chart/templates/service.yaml b/apps/helloworld/chart/templates/service.yaml new file mode 100644 index 00000000..a3118fe6 --- /dev/null +++ b/apps/helloworld/chart/templates/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: helloworld + labels: + app.kubernetes.io/name: helloworld +spec: + selector: + app.kubernetes.io/name: helloworld + ports: + - name: http + port: 80 + targetPort: http diff --git a/apps/helloworld/chart/values.yaml b/apps/helloworld/chart/values.yaml new file mode 100644 index 00000000..def7bb8d --- /dev/null +++ b/apps/helloworld/chart/values.yaml @@ -0,0 +1,5 @@ +# Defaults. Overridden at deploy time by $values/apps/helloworld/values.yaml, +# whose `image` key is rewritten by Kargo on each promotion. +image: docker.io/library/nginx:1.27.3 +dnsName: hello +replicas: 1 diff --git a/apps/helloworld/values.yaml b/apps/helloworld/values.yaml new file mode 100644 index 00000000..9cc92bf5 --- /dev/null +++ b/apps/helloworld/values.yaml @@ -0,0 +1,4 @@ +# Image tag is managed by Kargo (kargo-project-helloworld "dev" stage promotions). +# A real, immutable starting tag keeps the app healthy before the first promotion. +image: docker.io/library/nginx:1.27.3 +dnsName: hello diff --git a/apps/kargo/application.yaml b/apps/kargo/application.yaml index 4bac8e0c..40879a64 100644 --- a/apps/kargo/application.yaml +++ b/apps/kargo/application.yaml @@ -20,6 +20,11 @@ spec: path: apps/kargo/projects/codeai directory: include: application.yaml + - repoURL: https://github.com/code-dot-org/k8s-gitops.git + targetRevision: main + path: apps/kargo/projects/helloworld + directory: + include: application.yaml destination: server: https://kubernetes.default.svc namespace: kargo diff --git a/apps/kargo/projects/helloworld/application.yaml b/apps/kargo/projects/helloworld/application.yaml new file mode 100644 index 00000000..4971279c --- /dev/null +++ b/apps/kargo/projects/helloworld/application.yaml @@ -0,0 +1,27 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: kargo-project-helloworld + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io + annotations: + argocd.argoproj.io/sync-wave: "1" +spec: + project: default + source: + repoURL: https://github.com/code-dot-org/k8s-gitops.git + targetRevision: main + path: apps/kargo/projects/helloworld + directory: + recurse: true + exclude: application.yaml + destination: + server: https://kubernetes.default.svc + namespace: kargo + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - ServerSideApply=true diff --git a/apps/kargo/projects/helloworld/namespace.yaml b/apps/kargo/projects/helloworld/namespace.yaml new file mode 100644 index 00000000..6ff112dd --- /dev/null +++ b/apps/kargo/projects/helloworld/namespace.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: kargo-project-helloworld + labels: + kargo.akuity.io/project: "true" diff --git a/apps/kargo/projects/helloworld/project-config.yaml b/apps/kargo/projects/helloworld/project-config.yaml new file mode 100644 index 00000000..ec0fa281 --- /dev/null +++ b/apps/kargo/projects/helloworld/project-config.yaml @@ -0,0 +1,9 @@ +apiVersion: kargo.akuity.io/v1alpha1 +kind: ProjectConfig +metadata: + name: kargo-project-helloworld + namespace: kargo-project-helloworld +spec: + promotionPolicies: + - stage: dev + autoPromotionEnabled: true diff --git a/apps/kargo/projects/helloworld/project.yaml b/apps/kargo/projects/helloworld/project.yaml new file mode 100644 index 00000000..c24e1f07 --- /dev/null +++ b/apps/kargo/projects/helloworld/project.yaml @@ -0,0 +1,4 @@ +apiVersion: kargo.akuity.io/v1alpha1 +kind: Project +metadata: + name: kargo-project-helloworld diff --git a/apps/kargo/projects/helloworld/stages/dev.yaml b/apps/kargo/projects/helloworld/stages/dev.yaml new file mode 100644 index 00000000..1c7c6d60 --- /dev/null +++ b/apps/kargo/projects/helloworld/stages/dev.yaml @@ -0,0 +1,43 @@ +apiVersion: kargo.akuity.io/v1alpha1 +kind: Stage +metadata: + name: dev + namespace: kargo-project-helloworld +spec: + requestedFreight: + - origin: + kind: Warehouse + name: kargo-project-helloworld + sources: + direct: true + promotionTemplate: + spec: + vars: + - name: gitopsRepo + value: https://github.com/code-dot-org/k8s-gitops.git + steps: + - uses: git-clone + config: + repoURL: ${{ vars.gitopsRepo }} + checkout: + - branch: main + path: ./gitops + - uses: yaml-update + config: + path: ./gitops/apps/helloworld/values.yaml + updates: + - key: image + value: docker.io/library/nginx:${{ imageFrom("docker.io/library/nginx").Tag }} + - uses: git-commit + config: + path: ./gitops + message: | + Promote helloworld dev to ${{ imageFrom("docker.io/library/nginx").Tag }} [skip ci] + - uses: git-push + config: + path: ./gitops + - uses: argocd-update + config: + apps: + - name: helloworld + namespace: argocd diff --git a/apps/kargo/projects/helloworld/warehouse.yaml b/apps/kargo/projects/helloworld/warehouse.yaml new file mode 100644 index 00000000..785dbbbd --- /dev/null +++ b/apps/kargo/projects/helloworld/warehouse.yaml @@ -0,0 +1,12 @@ +apiVersion: kargo.akuity.io/v1alpha1 +kind: Warehouse +metadata: + name: kargo-project-helloworld + namespace: kargo-project-helloworld +spec: + subscriptions: + - image: + repoURL: docker.io/library/nginx + imageSelectionStrategy: SemVer + semverConstraint: '>=1.27.0' + cacheByTag: true # nginx patch tags (e.g. 1.27.3) are immutable, caching is safe