Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions apps/helloworld/application.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions apps/helloworld/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions apps/helloworld/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions apps/helloworld/chart/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: helloworld
labels:
# external-dns maps this label to <value>.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
13 changes: 13 additions & 0 deletions apps/helloworld/chart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions apps/helloworld/chart/values.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions apps/helloworld/values.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions apps/kargo/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions apps/kargo/projects/helloworld/application.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions apps/kargo/projects/helloworld/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: kargo-project-helloworld
labels:
kargo.akuity.io/project: "true"
9 changes: 9 additions & 0 deletions apps/kargo/projects/helloworld/project-config.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions apps/kargo/projects/helloworld/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kargo.akuity.io/v1alpha1
kind: Project
metadata:
name: kargo-project-helloworld
43 changes: 43 additions & 0 deletions apps/kargo/projects/helloworld/stages/dev.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions apps/kargo/projects/helloworld/warehouse.yaml
Original file line number Diff line number Diff line change
@@ -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