Skip to content
Open
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
8 changes: 6 additions & 2 deletions apps/codeai/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
This app's deployment definitions live under `deployments/`.
This app's deployment metadata lives under `deployments/` on `main`.

Docker image tag writeback is done by the GitHub Actions workflow [`k8s-commit-image-ref-to-argocd.yml`](https://github.com/code-dot-org/code-dot-org/blob/staging/.github/workflows/k8s-commit-image-ref-to-argocd.yml).
Rendered manifests are generated by Kargo onto long-lived `stage/<deployment>`
branches and deployed by Argo CD from `apps/codeai/deployments/<deployment>/deploy`.

The checked-in `values.yaml` files are legacy context from the old Helm flow and
are no longer part of the active rendered-branch promotion path.
19 changes: 8 additions & 11 deletions apps/codeai/applicationset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,24 @@ spec:
repoURL: https://github.com/code-dot-org/k8s-gitops.git
revision: main
files:
- path: apps/codeai/deployments/*/deployment.yaml
- path: apps/codeai/deployments/staging/deployment.yaml
- path: apps/codeai/deployments/test/deployment.yaml
- path: apps/codeai/deployments/levelbuilder/deployment.yaml
- path: apps/codeai/deployments/production/deployment.yaml
template:
metadata:
name: codeai-{{path.basename}}
labels:
app.kubernetes.io/managed-by: kargo
kargo.akuity.io/project: kargo-project-codeai
annotations:
kargo.akuity.io/authorized-stage: kargo-project-codeai:{{path.basename}}
spec:
project: default
sources:
- repoURL: https://github.com/code-dot-org/code-dot-org.git
targetRevision: '{{sourceRevision}}'
path: k8s/helm
helm:
releaseName: '{{path.basename}}'
valueFiles:
- $values/apps/codeai/envTypes/{{envType}}.values.yaml
- $values/apps/codeai/deployments/{{path.basename}}/values.yaml
- repoURL: https://github.com/code-dot-org/k8s-gitops.git
targetRevision: main
ref: values
targetRevision: '{{branch}}'
path: apps/codeai/deployments/{{path.basename}}/deploy
destination:
server: https://kubernetes.default.svc
namespace: '{{namespace}}'
Expand Down
3 changes: 3 additions & 0 deletions apps/codeai/deployments/levelbuilder/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
envType: levelbuilder
namespace: levelbuilder
branch: stage/levelbuilder
5 changes: 0 additions & 5 deletions apps/codeai/deployments/levelbuilder/deployment.yaml.disabled

This file was deleted.

3 changes: 3 additions & 0 deletions apps/codeai/deployments/production/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
envType: production
namespace: production
branch: stage/production
5 changes: 0 additions & 5 deletions apps/codeai/deployments/production/deployment.yaml.disabled

This file was deleted.

2 changes: 1 addition & 1 deletion apps/codeai/deployments/staging/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
envType: staging
namespace: staging
branch: staging
branch: stage/staging
4 changes: 1 addition & 3 deletions apps/codeai/deployments/test/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
envType: test
namespace: test
# FIXME: for quicker testing, avoid waiting on DTTs and DTPs, let alone DTLs.
# branch: test
branch: staging
branch: stage/test
1 change: 0 additions & 1 deletion apps/codeai/envTypes/levelbuilder/deployment.patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ spec:
spec:
containers:
- name: dashboard
image: ghcr.io/code-dot-org/code-dot-org:replace-me
env:
- name: RAILS_ENV
value: levelbuilder
Expand Down
5 changes: 2 additions & 3 deletions apps/codeai/envTypes/levelbuilder/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ labels:
includeTemplates: true
patches:
- path: deployment.patch.yaml
# TODO: enable these when gitops envType values start setting dashboard_workers again.
# - path: locals.yml.patch.yaml
# - path: deployment.resources.patch.yaml
- path: locals.yml.patch.yaml
- path: deployment.resources.patch.yaml
5 changes: 2 additions & 3 deletions apps/codeai/envTypes/production/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ labels:
includeTemplates: true
patches:
- path: deployment.patch.yaml
# TODO: enable these when gitops envType values start setting dashboard_workers again.
# - path: locals.yml.patch.yaml
# - path: deployment.resources.patch.yaml
- path: locals.yml.patch.yaml
- path: deployment.resources.patch.yaml
1 change: 0 additions & 1 deletion apps/codeai/envTypes/staging/deployment.patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ spec:
spec:
containers:
- name: dashboard
image: ghcr.io/code-dot-org/code-dot-org:replace-me
env:
- name: RAILS_ENV
value: staging
Expand Down
5 changes: 2 additions & 3 deletions apps/codeai/envTypes/staging/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ labels:
includeTemplates: true
patches:
- path: deployment.patch.yaml
# TODO: enable these when gitops envType values start setting dashboard_workers again.
# - path: locals.yml.patch.yaml
# - path: deployment.resources.patch.yaml
- path: locals.yml.patch.yaml
- path: deployment.resources.patch.yaml
5 changes: 2 additions & 3 deletions apps/codeai/envTypes/test/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ labels:
includeTemplates: true
patches:
- path: deployment.patch.yaml
# TODO: enable these when gitops envType values start setting dashboard_workers again.
# - path: locals.yml.patch.yaml
# - path: deployment.resources.patch.yaml
- path: locals.yml.patch.yaml
- path: deployment.resources.patch.yaml
6 changes: 6 additions & 0 deletions apps/codeai/kargo/templates/deploy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../src/k8s/kustomize/base
components:
- ../envType
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: codeai-service-health
namespace: kargo-project-codeai
spec:
args:
- name: namespace
- name: serviceName
metrics:
- name: service-health
provider:
job:
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: curl
image: curlimages/curl:8.12.1
command:
- sh
- -ceu
- |
curl --fail --silent --show-error \
"http://{{args.serviceName}}.{{args.namespace}}.svc.cluster.local:3000/health_check" >/dev/null
8 changes: 5 additions & 3 deletions apps/kargo-project-codeai/project-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ spec:
- stage: staging
autoPromotionEnabled: true
- stage: test
autoPromotionEnabled: false
- stage: production
autoPromotionEnabled: false
autoPromotionEnabled: true
- stage: levelbuilder
autoPromotionEnabled: false
- stage: review-infra-changes
autoPromotionEnabled: true
- stage: production
autoPromotionEnabled: true
77 changes: 64 additions & 13 deletions apps/kargo-project-codeai/stages/levelbuilder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,87 @@ metadata:
name: levelbuilder
namespace: kargo-project-codeai
spec:
vars:
- name: gitopsRepo
value: https://github.com/code-dot-org/k8s-gitops.git
- name: sourceRepo
value: https://github.com/code-dot-org/code-dot-org.git
- name: imageRepo
value: ghcr.io/code-dot-org/code-dot-org
- name: deployment
value: levelbuilder
- name: envType
value: levelbuilder
- name: targetBranch
value: stage/levelbuilder
- name: renderPath
value: apps/codeai/deployments/levelbuilder/deploy
- name: sourceCommit
value: ${{ commitFrom(vars.sourceRepo).ID }}
requestedFreight:
- origin:
kind: Warehouse
name: kargo-project-codeai
name: codeai
sources:
stages:
- test
autoPromotionOptions:
selectionPolicy: MatchUpstream
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
path: ./meta
- branch: ${{ vars.targetBranch }}
create: true
path: ./out
- uses: git-clone
config:
repoURL: ${{ vars.sourceRepo }}
checkout:
- commit: ${{ vars.sourceCommit }}
path: ./src
sparse:
- k8s/kustomize
- uses: git-clear
config:
path: ./out
- uses: copy
config:
inPath: ./meta/apps/codeai/kargo/templates/deploy
outPath: ./render/deploy
- uses: copy
config:
path: ./gitops/apps/codeai/deployments/levelbuilder/values.yaml
updates:
- key: image
value: ghcr.io/code-dot-org/code-dot-org:${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }}
inPath: ./meta/apps/codeai/envTypes/${{ vars.envType }}
outPath: ./render/envType
- uses: copy
config:
inPath: ./meta/apps/codeai/envTypes/components
outPath: ./render/components
- uses: kustomize-set-image
config:
path: ./render/deploy
images:
- image: code-dot-org
newName: ${{ vars.imageRepo }}
tag: ${{ imageFrom(vars.imageRepo).Tag }}
- uses: kustomize-build
config:
path: ./render/deploy
outPath: ./out/${{ vars.renderPath }}
- uses: git-commit
config:
path: ./gitops
path: ./out
message: |
Promote levelbuilder to ${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} [skip ci]
Render ${{ vars.deployment }} for ${{ vars.sourceCommit }} / ${{ imageFrom(vars.imageRepo).Tag }}
- uses: git-push
config:
path: ./gitops
path: ./out
- uses: argocd-update
config:
apps:
- name: codeai-levelbuilder
31 changes: 7 additions & 24 deletions apps/kargo-project-codeai/stages/production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,16 @@ spec:
requestedFreight:
- origin:
kind: Warehouse
name: kargo-project-codeai
name: codeai
sources:
stages:
- test
- review-infra-changes
autoPromotionOptions:
selectionPolicy: MatchUpstream
promotionTemplate:
spec:
vars:
- name: gitopsRepo
value: https://github.com/code-dot-org/k8s-gitops.git
steps:
- uses: git-clone
- uses: argocd-update
config:
repoURL: ${{ vars.gitopsRepo }}
checkout:
- branch: main
path: ./gitops
- uses: yaml-update
config:
path: ./gitops/apps/codeai/deployments/production/values.yaml
updates:
- key: image
value: ghcr.io/code-dot-org/code-dot-org:${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }}
- uses: git-commit
config:
path: ./gitops
message: |
Promote production to ${{ imageFrom("ghcr.io/code-dot-org/code-dot-org").Tag }} [skip ci]
- uses: git-push
config:
path: ./gitops
apps:
- name: codeai-production
Loading