Compare commits
30 Commits
renovation
...
f59c51a823
| Author | SHA1 | Date | |
|---|---|---|---|
| f59c51a823 | |||
| 44b092fabd | |||
|
|
219b822bcf | ||
| f4d3951e85 | |||
| b9b9062a27 | |||
| 58b9995283 | |||
| 39e7cc81fc | |||
| bddd387bab | |||
| 30dc34e700 | |||
| f8de42521e | |||
| 796cdf0669 | |||
| f9f9312195 | |||
| 80db5e8920 | |||
| b1fa450372 | |||
| 06e0ab0fb3 | |||
| 5d9d29e186 | |||
| f487d5e7c1 | |||
| 9bc0bce407 | |||
| 05d69ecd08 | |||
| 67e6f0d93a | |||
| 09cbd3a8f7 | |||
| 6695625f8e | |||
| a7343bcf86 | |||
| 17682e9cfc | |||
| 03a85a43f5 | |||
| 2dd3bfc27a | |||
| 5e23103a14 | |||
| 5960df4f34 | |||
| f9541e6943 | |||
| c10bbb6029 |
11
.dockerignore
Normal file
11
.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.git
|
||||||
|
.gitea
|
||||||
|
.github
|
||||||
|
.devcontainer
|
||||||
|
target
|
||||||
|
build
|
||||||
|
.gradle
|
||||||
|
k6
|
||||||
|
k8s
|
||||||
|
overlays
|
||||||
|
*.md
|
||||||
165
.gitea/workflows/build-lab.yml
Normal file
165
.gitea/workflows/build-lab.yml
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
name: Build and Push to ACR (lab)
|
||||||
|
|
||||||
|
# Dispatch only while the lab path is proven. Builds the image for the dispatched commit, then
|
||||||
|
# renders score-lab.yaml with the platform's provisioners and commits the result to deploy/lab,
|
||||||
|
# which Argo CD delivers.
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}-lab
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
AZURE_FEDERATED_TOKEN_FILE: /var/run/secrets/azure/tokens/azure-identity-token
|
||||||
|
ACR_LOGIN_SERVER: cruciblecoredevacr.azurecr.io
|
||||||
|
# Platform provisioners release. Upgrading is a change to this pin.
|
||||||
|
PROVISIONERS_VERSION: v0.1.2
|
||||||
|
SCORE_K8S_VERSION: 0.19.0
|
||||||
|
SCORE_K8S_SHA256: 7c62f3585f1864cad7c4032557e183cb65fef22a7a15f3cbe22365849ca95e2c
|
||||||
|
ORAS_VERSION: 1.2.3
|
||||||
|
ORAS_SHA256: b4efc97a91f471f323f193ea4b4d63d8ff443ca3aab514151a30751330852827
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build and Push
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'workflow_dispatch'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Azure CLI
|
||||||
|
run: |
|
||||||
|
command -v az &>/dev/null || curl -sL https://aka.ms/InstallAzureCLIDeb | bash
|
||||||
|
|
||||||
|
- name: Install Docker CLI
|
||||||
|
run: |
|
||||||
|
command -v docker &>/dev/null || (apt-get update -qq && apt-get install -y docker.io)
|
||||||
|
docker --version
|
||||||
|
|
||||||
|
- name: Azure login (OIDC)
|
||||||
|
run: |
|
||||||
|
az login \
|
||||||
|
--service-principal \
|
||||||
|
--username "$AZURE_CLIENT_ID" \
|
||||||
|
--tenant "$AZURE_TENANT_ID" \
|
||||||
|
--federated-token "$(cat $AZURE_FEDERATED_TOKEN_FILE)"
|
||||||
|
echo "✓ Azure login successful"
|
||||||
|
|
||||||
|
- name: Get ACR details
|
||||||
|
run: |
|
||||||
|
# Pinned: `az acr list` returns whichever registry the identity sees first.
|
||||||
|
ACR_NAME=cruciblecoredevacr
|
||||||
|
echo "ACR_NAME=$ACR_NAME" >> $GITHUB_ENV
|
||||||
|
echo "ACR_LOGIN_SERVER=${ACR_NAME}.azurecr.io" >> $GITHUB_ENV
|
||||||
|
echo "✓ Using ACR: ${ACR_NAME}.azurecr.io"
|
||||||
|
|
||||||
|
- name: ACR Login
|
||||||
|
run: |
|
||||||
|
ACR_TOKEN=$(az acr login --name "$ACR_NAME" --expose-token --output tsv --query accessToken)
|
||||||
|
docker login "$ACR_LOGIN_SERVER" \
|
||||||
|
--username 00000000-0000-0000-0000-000000000000 \
|
||||||
|
--password "$ACR_TOKEN"
|
||||||
|
echo "✓ ACR login successful"
|
||||||
|
|
||||||
|
- name: Build and Push Docker image
|
||||||
|
run: |
|
||||||
|
IMAGE_TAG="${{ gitea.sha }}"
|
||||||
|
IMAGE_FULL="${ACR_LOGIN_SERVER}/demo-vivek-11:${IMAGE_TAG}"
|
||||||
|
IMAGE_LATEST="${ACR_LOGIN_SERVER}/demo-vivek-11:latest"
|
||||||
|
docker build -t "$IMAGE_FULL" -t "$IMAGE_LATEST" .
|
||||||
|
docker push "$IMAGE_FULL"
|
||||||
|
docker push "$IMAGE_LATEST"
|
||||||
|
echo "IMAGE_FULL=$IMAGE_FULL" >> $GITHUB_ENV
|
||||||
|
echo "✓ Pushed: $IMAGE_FULL"
|
||||||
|
|
||||||
|
- name: Build Summary
|
||||||
|
run: |
|
||||||
|
echo "### ✅ Build Successful" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| | |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| **Service** | demo-vivek-11 |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| **Commit** | ${{ gitea.sha }} |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| **Image** | $IMAGE_FULL |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
render:
|
||||||
|
name: Render manifests
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
command -v az &>/dev/null || curl -sL https://aka.ms/InstallAzureCLIDeb | bash
|
||||||
|
python3 -c 'import yaml' 2>/dev/null || (apt-get update -qq && apt-get install -y python3-yaml)
|
||||||
|
mkdir -p "$HOME/bin" && cd "$(mktemp -d)"
|
||||||
|
curl -fsSL -o score-k8s.tgz "https://github.com/score-spec/score-k8s/releases/download/${SCORE_K8S_VERSION}/score-k8s_${SCORE_K8S_VERSION}_linux_amd64.tar.gz"
|
||||||
|
curl -fsSL -o oras.tgz "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz"
|
||||||
|
echo "${SCORE_K8S_SHA256} score-k8s.tgz" | sha256sum -c -
|
||||||
|
echo "${ORAS_SHA256} oras.tgz" | sha256sum -c -
|
||||||
|
tar -xzf score-k8s.tgz score-k8s && tar -xzf oras.tgz oras
|
||||||
|
install -m 0755 score-k8s oras "$HOME/bin/"
|
||||||
|
echo "$HOME/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Azure login (OIDC)
|
||||||
|
run: |
|
||||||
|
az login \
|
||||||
|
--service-principal \
|
||||||
|
--username "$AZURE_CLIENT_ID" \
|
||||||
|
--tenant "$AZURE_TENANT_ID" \
|
||||||
|
--federated-token "$(cat $AZURE_FEDERATED_TOKEN_FILE)"
|
||||||
|
|
||||||
|
- name: Pull platform provisioners
|
||||||
|
run: |
|
||||||
|
az acr login --name "${ACR_LOGIN_SERVER%%.*}" --expose-token --output tsv --query accessToken \
|
||||||
|
| oras login "$ACR_LOGIN_SERVER" --username 00000000-0000-0000-0000-000000000000 --password-stdin
|
||||||
|
oras pull "${ACR_LOGIN_SERVER}/score-provisioners:${PROVISIONERS_VERSION}" -o "$HOME/provisioners"
|
||||||
|
ls -1 "$HOME/provisioners"
|
||||||
|
|
||||||
|
- name: Render score-lab.yaml
|
||||||
|
run: |
|
||||||
|
P="$HOME/provisioners"
|
||||||
|
OUT="$PWD/deploy/lab"
|
||||||
|
WORK="$(mktemp -d)"
|
||||||
|
cp score-lab.yaml "$WORK/score.yaml"
|
||||||
|
cd "$WORK"
|
||||||
|
score-k8s init --no-sample --quiet \
|
||||||
|
$(for f in "$P"/*.provisioners.yaml; do printf -- '--provisioners %s ' "$f"; done) \
|
||||||
|
$(for f in "$P"/*.tpl.yaml; do printf -- '--patch-templates %s ' "$f"; done)
|
||||||
|
# Platform rule: only the platform's provisioners, so an unsupported resource type fails.
|
||||||
|
rm -f .score-k8s/zz-default.provisioners.yaml
|
||||||
|
CRUCIBLE_ENV=lab score-k8s generate score.yaml --quiet \
|
||||||
|
--image "${ACR_LOGIN_SERVER}/demo-vivek-11:${{ gitea.sha }}" \
|
||||||
|
--namespace demo-vivek-11 \
|
||||||
|
-o manifests.yaml
|
||||||
|
python3 "$P/policy-check.py" manifests.yaml
|
||||||
|
python3 "$P/split.py" manifests.yaml "$OUT"
|
||||||
|
|
||||||
|
- name: Commit rendered manifests
|
||||||
|
run: |
|
||||||
|
git config user.name "gitea-actions"
|
||||||
|
git config user.email "gitea-actions@noreply.gitea.kyndemo.live"
|
||||||
|
git add deploy/lab
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "deploy/lab is already up to date"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
SHA="${{ gitea.sha }}"
|
||||||
|
git commit -m "deploy(lab): render ${SHA:0:12} [skip ci]"
|
||||||
|
# No rebase: gradlew.bat and mvnw.cmd always show as modified in a checkout (line endings),
|
||||||
|
# and git will not rebase a dirty tree. If the branch moved during the run, run it again.
|
||||||
|
git push origin "HEAD:${{ gitea.ref_name }}" || {
|
||||||
|
echo "::error::${{ gitea.ref_name }} moved while this job ran; run the workflow again"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
157
.gitea/workflows/deploy-labs.yaml
Normal file
157
.gitea/workflows/deploy-labs.yaml
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
name: Deploy to Orchestrator (lab)
|
||||||
|
|
||||||
|
# Creates or updates the Argo CD Application and the hub route for the lab, from score-lab.yaml.
|
||||||
|
# Run after "Build and Push to ACR (lab)", which renders deploy/lab. Dispatch only.
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
PO_API_URL: https://api.dev.orchestrator.crucible.kyndemo.live
|
||||||
|
PO_ORG_ID: crucible
|
||||||
|
PO_AUTH_TOKEN: ${{ secrets.PO_AUTH_TOKEN }}
|
||||||
|
# ONE ORCHESTRATOR PROJECT PER APPLICATION.
|
||||||
|
#
|
||||||
|
# This used to be the shared `apps-cluster` project with one environment per app, which
|
||||||
|
# made every app a peer of every other: the Orchestrator tab on any component listed the
|
||||||
|
# entire estate, and an app had exactly one environment named after itself, so there was
|
||||||
|
# nowhere for dev/staging/prod to live.
|
||||||
|
#
|
||||||
|
# That shape existed to avoid a Terraform pull request against config/projects.tf for every
|
||||||
|
# scaffolded app. That constraint turned out not to be real -- `octl create project`,
|
||||||
|
# `octl create runner-rule` and `octl create environment` are all runtime operations, so
|
||||||
|
# the workflow below builds the whole thing on first deploy and needs no repository change.
|
||||||
|
# Its own project, NOT demo-vivek-11. Sharing it would reuse deploy.yml's runner rule (the dev
|
||||||
|
# apps runner) and overwrite the dev workload with this file.
|
||||||
|
#
|
||||||
|
# Bound to the lab HUB's runner: what the orchestrator creates here is the Argo CD Application
|
||||||
|
# and the public route, and both live on the hub. Argo CD delivers the workload to the spoke
|
||||||
|
# from deploy/lab.
|
||||||
|
PROJECT_ID: demo-vivek-11-lab
|
||||||
|
# The runner a project's workloads execute on. This is NOT cosmetic: the Kubernetes and
|
||||||
|
# Helm providers are ambient, so a workload lands in whichever cluster its runner lives in,
|
||||||
|
# and Terraform state is keyed per runner. A project bound to the wrong runner deploys to
|
||||||
|
# the wrong cluster, and repointing it afterwards orphans the state it already owns.
|
||||||
|
PO_RUNNER_ID: crucible-orchestrator-dev-platform-lab-runner
|
||||||
|
OCTL_VERSION: 1.0.0
|
||||||
|
IMAGE: cruciblecoredevacr.azurecr.io/demo-vivek-11
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
guard:
|
||||||
|
name: Platform guard
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
ready: ${{ steps.check.outputs.ready }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Check platform initialized
|
||||||
|
id: check
|
||||||
|
run: |
|
||||||
|
if [ -f ".platform/initialized.md" ]; then
|
||||||
|
echo "ready=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "ready=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "Skipping: .platform/initialized.md not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy to Orchestrator
|
||||||
|
needs: guard
|
||||||
|
if: >-
|
||||||
|
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && needs.guard.outputs.ready == 'true') ||
|
||||||
|
(github.event_name == 'workflow_dispatch')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install octl
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
curl -fsSLo /tmp/octl.tar.gz \
|
||||||
|
"https://github.com/stellwerk-labs/platform-orchestrator-cli/releases/download/v${OCTL_VERSION}/platform-orchestrator-cli_${OCTL_VERSION}_linux_amd64.tar.gz"
|
||||||
|
tar xzf /tmp/octl.tar.gz -C /tmp
|
||||||
|
install -m 755 /tmp/octl /usr/local/bin/octl
|
||||||
|
octl --version
|
||||||
|
|
||||||
|
- name: Set environment
|
||||||
|
run: |
|
||||||
|
# One environment, of type `lab`. The type is what selects the Argo CD implementations:
|
||||||
|
# the workload becomes an Application and workload-ingress becomes the hub route.
|
||||||
|
echo "ENV_ID=lab" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Ensure the project and its runner binding exist
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
# Created on first deploy rather than by a pull request against config/projects.tf.
|
||||||
|
# None of this needs a repository change: project, runner rule and environment are
|
||||||
|
# all runtime objects.
|
||||||
|
#
|
||||||
|
# Neither create is idempotent, so both fall through to a read on the second run.
|
||||||
|
octl create project "$PROJECT_ID" \
|
||||||
|
--set display_name='demo-vivek-11 (lab)' || \
|
||||||
|
octl get project "$PROJECT_ID"
|
||||||
|
|
||||||
|
# The runner rule is what routes this project's deployments to the apps cluster.
|
||||||
|
# Creating it twice would leave two rules matching the same project, so it is
|
||||||
|
# created only when absent -- `create` would happily add a duplicate.
|
||||||
|
if octl get runner-rules -o json 2>/dev/null | grep -q "\"project_id\": *\"$PROJECT_ID\""; then
|
||||||
|
echo "Runner rule for '$PROJECT_ID' already exists."
|
||||||
|
else
|
||||||
|
octl create runner-rule \
|
||||||
|
--set project_id="$PROJECT_ID" \
|
||||||
|
--set runner_id="$PO_RUNNER_ID" \
|
||||||
|
--no-prompt
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Ensure the environment exists
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
octl create environment "$PROJECT_ID" "$ENV_ID" \
|
||||||
|
--set env_type_id=lab \
|
||||||
|
--set display_name="Lab" || \
|
||||||
|
octl get environment "$PROJECT_ID" "$ENV_ID"
|
||||||
|
|
||||||
|
- name: Deploy the Score workload
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
# `octl score deploy` is ADDITIVE — it adds or updates a workload in the manifest and
|
||||||
|
# never removes one. That is the opposite of `octl deploy`, where omission is
|
||||||
|
# deletion. Do not substitute one for the other.
|
||||||
|
# No --show-logs: octl 1.0.0 has no such flag and exits 1 with `unknown flag`
|
||||||
|
# BEFORE contacting the orchestrator, so the whole deploy dies on an argument
|
||||||
|
# typo. Its nearest relatives are --runner-logs-level (default `info`, already
|
||||||
|
# what we want) and --skip-logs (which suppresses storage). Neither streams the
|
||||||
|
# runner's logs into this job, so there is nothing to substitute -- the runner
|
||||||
|
# logs are read from the orchestrator, not from here.
|
||||||
|
# The tag must be the commit the BUILD built, and it must be the WHOLE sha.
|
||||||
|
#
|
||||||
|
# build-push.yml tags with `` -- all 40 characters -- so the
|
||||||
|
# 7-character `${GITHUB_SHA:0:7}` this used to pass named a tag that has never
|
||||||
|
# existed in the registry.
|
||||||
|
#
|
||||||
|
# And on a workflow_run, GITHUB_SHA is the DEFAULT branch's head, while the build
|
||||||
|
# that produced the image ran on `dev`. They coincide only while the branches are
|
||||||
|
# level. `workflow_run.head_sha` is the triggering run's own commit, which is by
|
||||||
|
# definition the one that was built; `github.sha` covers the workflow_dispatch case,
|
||||||
|
# where there is no triggering run.
|
||||||
|
IMAGE_TAG="${{ github.event.workflow_run.head_sha || github.sha }}"
|
||||||
|
echo "Deploying ${IMAGE}:${IMAGE_TAG}"
|
||||||
|
|
||||||
|
octl score deploy "$PROJECT_ID" "$ENV_ID" score-lab.yaml \
|
||||||
|
--default-image "${IMAGE}:${IMAGE_TAG}" \
|
||||||
|
--no-prompt
|
||||||
|
|
||||||
|
- name: Deployment summary
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
# Same commit the deploy step resolved, abbreviated for reading only -- the
|
||||||
|
# deployed tag is the full sha.
|
||||||
|
DEPLOYED_SHA="${{ github.event.workflow_run.head_sha || github.sha }}"
|
||||||
|
SHORT_SHA="${DEPLOYED_SHA:0:7}"
|
||||||
|
echo "## Deployment Result" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Project | \`$PROJECT_ID\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Environment | \`$ENV_ID\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "| Commit | \`$SHORT_SHA\` |" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "[View in Orchestrator Console](https://console.dev.orchestrator.crucible.kyndemo.live/orgs/$PO_ORG_ID/projects/$PROJECT_ID/environments/$ENV_ID)" >> $GITHUB_STEP_SUMMARY
|
||||||
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Spring PetClinic: build the jar with Maven, run it on a slim JRE.
|
||||||
|
|
||||||
|
# Plain Maven, not ./mvnw: the Maven wrapper jar is not committed.
|
||||||
|
FROM maven:3.9-eclipse-temurin-17 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
COPY pom.xml .
|
||||||
|
RUN mvn -B -q dependency:go-offline
|
||||||
|
COPY src ./src
|
||||||
|
# Tests run in integration-test.yml. Format and checkstyle checks gate on style, not on a working image.
|
||||||
|
RUN mvn -B -q package -DskipTests -Dspring-javaformat.skip=true -Dcheckstyle.skip=true
|
||||||
|
|
||||||
|
FROM eclipse-temurin:17-jre
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /src/target/*.jar app.jar
|
||||||
|
RUN useradd --system --uid 10001 app
|
||||||
|
USER 10001
|
||||||
|
EXPOSE 8080
|
||||||
|
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
|
||||||
32
deploy/README.md
Normal file
32
deploy/README.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# deploy/
|
||||||
|
|
||||||
|
How demo-vivek-11 reaches the lab. Everything starts from `score-lab.yaml`; nothing here is written
|
||||||
|
by hand.
|
||||||
|
|
||||||
|
```
|
||||||
|
browser ─► hub pe-gatewayapi (demo-vivek-11.apps.lab…) ─► Private Link ─► spoke pe-gatewayapi-int
|
||||||
|
(demo-vivek-11.int.apps.lab…, port 80) ─► Service demo-vivek-11 ─► pod :8080
|
||||||
|
```
|
||||||
|
|
||||||
|
| What | Where | Produced by |
|
||||||
|
|---|---|---|
|
||||||
|
| Deployment, Service, HTTPRoute, NetworkPolicy (`lab/`) | lab **spoke** | score-k8s with the platform's provisioners, delivered by Argo CD |
|
||||||
|
| Argo CD Application `team-demo/demo-vivek-11` | lab **hub** | the orchestrator, from the workload in `score-lab.yaml` |
|
||||||
|
| Public route (Backend + HTTPRoute) | lab **hub** | the orchestrator, from the `workload-ingress` resource |
|
||||||
|
|
||||||
|
## Workflows
|
||||||
|
|
||||||
|
1. **Build and Push to ACR (lab)** builds the image, renders `score-lab.yaml` into `lab/` and commits
|
||||||
|
it. The image tag is the commit that was built. Argo CD then rolls it out.
|
||||||
|
2. **Deploy to Orchestrator (lab)** creates or updates the Application and the public route. It is
|
||||||
|
needed the first time and whenever the hostname, team or repository in `score-lab.yaml` changes.
|
||||||
|
|
||||||
|
`lab/` is **generated**: never edit it. To change what is deployed, change `score-lab.yaml` and run
|
||||||
|
the build workflow. The provisioners version is pinned in that workflow.
|
||||||
|
|
||||||
|
## What `score-lab.yaml` must carry
|
||||||
|
|
||||||
|
- `metadata.annotations["crucible.kyndryl.com/team"]`: the owning team (`demo`). The Application is
|
||||||
|
created in `team-demo`, and may deploy only to spoke namespaces named `demo-*`.
|
||||||
|
- `metadata.annotations["crucible.kyndryl.com/repo-url"]`: this repository.
|
||||||
|
- Readiness and liveness probes, required by the platform's policy check.
|
||||||
90
deploy/lab/deployment-demo-vivek-11.yaml
Normal file
90
deploy/lab/deployment-demo-vivek-11.yaml
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
k8s.score.dev/workload-name: demo-vivek-11
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: demo-vivek-11
|
||||||
|
app.kubernetes.io/managed-by: score-k8s
|
||||||
|
app.kubernetes.io/name: demo-vivek-11
|
||||||
|
name: demo-vivek-11
|
||||||
|
namespace: demo-vivek-11
|
||||||
|
spec:
|
||||||
|
revisionHistoryLimit: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: demo-vivek-11
|
||||||
|
strategy: {}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
crucible.kyndryl.com/repo-url: https://gitea.kyndemo.live/validate/demo-vivek-11.git
|
||||||
|
crucible.kyndryl.com/team: demo
|
||||||
|
k8s.score.dev/workload-name: demo-vivek-11
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: demo-vivek-11
|
||||||
|
app.kubernetes.io/managed-by: score-k8s
|
||||||
|
app.kubernetes.io/name: demo-vivek-11
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
containers:
|
||||||
|
- env:
|
||||||
|
- name: OTEL_EXPORTER_OTLP_ENDPOINT
|
||||||
|
value: http://otel-collector.monitoring.svc.cluster.local:4318
|
||||||
|
- name: OTEL_EXPORTER_OTLP_PROTOCOL
|
||||||
|
value: http/protobuf
|
||||||
|
- name: OTEL_LOGS_EXPORTER
|
||||||
|
value: none
|
||||||
|
- name: OTEL_METRICS_EXPORTER
|
||||||
|
value: otlp
|
||||||
|
- name: OTEL_RESOURCE_ATTRIBUTES
|
||||||
|
value: service.name=demo-vivek-11
|
||||||
|
- name: OTEL_SERVICE_NAME
|
||||||
|
value: demo-vivek-11
|
||||||
|
- name: OTEL_TRACES_EXPORTER
|
||||||
|
value: otlp
|
||||||
|
image: cruciblecoredevacr.azurecr.io/demo-vivek-11:f4d3951e858b9030a9dc5b00bb268364eddcab1b
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8080
|
||||||
|
name: main
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8080
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 1Gi
|
||||||
|
requests:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 512Mi
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
privileged: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
runAsNonRoot: true
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
startupProbe:
|
||||||
|
failureThreshold: 36
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8080
|
||||||
|
periodSeconds: 5
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /tmp
|
||||||
|
name: crucible-tmp
|
||||||
|
enableServiceLinks: false
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
volumes:
|
||||||
|
- emptyDir:
|
||||||
|
sizeLimit: 256Mi
|
||||||
|
name: crucible-tmp
|
||||||
|
status: {}
|
||||||
27
deploy/lab/httproute-demo-vivek-11.yaml
Normal file
27
deploy/lab/httproute-demo-vivek-11.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
|
kind: HTTPRoute
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
crucible.kyndryl.com/public-hostname: demo-vivek-11.apps.lab.crucible.kyndemo.live
|
||||||
|
k8s.score.dev/resource-uid: workload-ingress.default#demo-vivek-11.ingress
|
||||||
|
k8s.score.dev/source-workload: demo-vivek-11
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/managed-by: score-k8s
|
||||||
|
app.kubernetes.io/name: demo-vivek-11
|
||||||
|
name: demo-vivek-11
|
||||||
|
namespace: demo-vivek-11
|
||||||
|
spec:
|
||||||
|
hostnames:
|
||||||
|
- demo-vivek-11.int.apps.lab.crucible.kyndemo.live
|
||||||
|
parentRefs:
|
||||||
|
- name: pe-gatewayapi-int
|
||||||
|
namespace: gatewayapi
|
||||||
|
sectionName: http
|
||||||
|
rules:
|
||||||
|
- backendRefs:
|
||||||
|
- name: demo-vivek-11
|
||||||
|
port: 80
|
||||||
|
matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: /
|
||||||
8
deploy/lab/kustomization.yaml
Normal file
8
deploy/lab/kustomization.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Generated by crucible-platform-score-provisioners. Do not edit: re-render instead.
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- deployment-demo-vivek-11.yaml
|
||||||
|
- httproute-demo-vivek-11.yaml
|
||||||
|
- networkpolicy-demo-vivek-11.yaml
|
||||||
|
- service-demo-vivek-11.yaml
|
||||||
20
deploy/lab/networkpolicy-demo-vivek-11.yaml
Normal file
20
deploy/lab/networkpolicy-demo-vivek-11.yaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/managed-by: score-k8s
|
||||||
|
app.kubernetes.io/name: demo-vivek-11
|
||||||
|
name: demo-vivek-11
|
||||||
|
namespace: demo-vivek-11
|
||||||
|
spec:
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector: {}
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: gatewayapi
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: demo-vivek-11
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
21
deploy/lab/service-demo-vivek-11.yaml
Normal file
21
deploy/lab/service-demo-vivek-11.yaml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
k8s.score.dev/workload-name: demo-vivek-11
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: demo-vivek-11
|
||||||
|
app.kubernetes.io/managed-by: score-k8s
|
||||||
|
app.kubernetes.io/name: demo-vivek-11
|
||||||
|
name: demo-vivek-11
|
||||||
|
namespace: demo-vivek-11
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: web
|
||||||
|
port: 80
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 8080
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/instance: demo-vivek-11
|
||||||
|
status:
|
||||||
|
loadBalancer: {}
|
||||||
56
score-lab.yaml
Normal file
56
score-lab.yaml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
apiVersion: score.dev/v1b1
|
||||||
|
metadata:
|
||||||
|
name: demo-vivek-11
|
||||||
|
labels:
|
||||||
|
app: demo-vivek-11
|
||||||
|
# Read by the orchestrator to create the Argo CD Application: which team owns it, and the
|
||||||
|
# repository whose deploy/lab folder holds the rendered manifests.
|
||||||
|
annotations:
|
||||||
|
crucible.kyndryl.com/team: demo
|
||||||
|
crucible.kyndryl.com/repo-url: https://gitea.kyndemo.live/validate/demo-vivek-11.git
|
||||||
|
|
||||||
|
containers:
|
||||||
|
main:
|
||||||
|
image: .
|
||||||
|
variables:
|
||||||
|
# The Watcher's OTel work lands in overlays/otel/, which only ArgoCD reads. On the
|
||||||
|
# orchestrator path nothing consumes that overlay, so without these variables the
|
||||||
|
# renovated app emits no telemetry at all and never appears in Grafana.
|
||||||
|
OTEL_SERVICE_NAME: "demo-vivek-11"
|
||||||
|
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.monitoring.svc.cluster.local:4318"
|
||||||
|
OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf"
|
||||||
|
OTEL_RESOURCE_ATTRIBUTES: "service.name=demo-vivek-11"
|
||||||
|
OTEL_METRICS_EXPORTER: "otlp"
|
||||||
|
OTEL_TRACES_EXPORTER: "otlp"
|
||||||
|
OTEL_LOGS_EXPORTER: "none"
|
||||||
|
# Required by the platform's policy check. Spring Boot's actuator answers {"status":"UP"} here.
|
||||||
|
# The platform adds a startupProbe from the liveness probe, so a slow JVM start is not killed.
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8080
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8080
|
||||||
|
|
||||||
|
service:
|
||||||
|
ports:
|
||||||
|
web:
|
||||||
|
port: 80
|
||||||
|
targetPort: 8080
|
||||||
|
|
||||||
|
resources:
|
||||||
|
env:
|
||||||
|
type: environment
|
||||||
|
ingress:
|
||||||
|
type: workload-ingress
|
||||||
|
params:
|
||||||
|
name: demo-vivek-11
|
||||||
|
hostname: demo-vivek-11.apps.lab.crucible.kyndemo.live
|
||||||
|
service_name: demo-vivek-11
|
||||||
|
service_port: 80
|
||||||
|
# No database until one exists on the lab: CloudNativePG is not installed there. When it is
|
||||||
|
# restored, add back DATABASE_URL using ${resources.db.hostname} and ${resources.db.database}.
|
||||||
|
# db:
|
||||||
|
# type: postgres
|
||||||
Reference in New Issue
Block a user