Compare commits
13 Commits
0.01
...
65e40d116b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65e40d116b | ||
|
|
8842371f80 | ||
|
|
9769769c2c | ||
|
|
4ba6682000 | ||
|
|
ed8abc9b56 | ||
|
|
bed8e93b5d | ||
|
|
695b08819a | ||
|
|
4d0b89943d | ||
|
|
4a8a64f161 | ||
|
|
01e8bb4406 | ||
|
|
cfaa2db88b | ||
|
|
17a96da078 | ||
|
|
ced9aa4aeb |
5
.agent/rules.md
Normal file
5
.agent/rules.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Antigravity Agent Configuration
|
||||||
|
# This file provides global rules for the Antigravity agent when working on this repository.
|
||||||
|
|
||||||
|
- **Git Commits**: When making git commits, always append the following co-author trailer to the end of the commit message to indicate AI assistance:
|
||||||
|
`Co-authored-by: Antigravity <antigravity@deepmind.com>`
|
||||||
111
.gitea/workflows/kubernetes-deploy.yaml
Normal file
111
.gitea/workflows/kubernetes-deploy.yaml
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
name: Deploy to K8s
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Debug - print Gitea Actions environment
|
||||||
|
run: |
|
||||||
|
echo "=== All environment variables ==="
|
||||||
|
env | sort
|
||||||
|
echo ""
|
||||||
|
echo "=== GITHUB_* / GITEA_* / ACTIONS_* vars ==="
|
||||||
|
env | grep -E '^(GITHUB|GITEA|ACTIONS)_' | sort
|
||||||
|
|
||||||
|
- name: Install kubectl
|
||||||
|
run: |
|
||||||
|
curl -sfLO "https://dl.k8s.io/release/$(curl -sfL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||||
|
install kubectl /usr/local/bin/
|
||||||
|
|
||||||
|
- name: Get Kanidm token from Vault
|
||||||
|
id: vault
|
||||||
|
run: |
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
VAULT_AUTH_RESPONSE=$(curl -f --request POST \
|
||||||
|
--data '{"role_id":"${{ secrets.VAULT_ROLE_ID }}","secret_id":"${{ secrets.VAULT_SECRET_ID }}"}' \
|
||||||
|
https://vault.hrajfrisbee.cz/v1/auth/approle/login)
|
||||||
|
|
||||||
|
echo "Vault auth response: $VAULT_AUTH_RESPONSE" >&2
|
||||||
|
VAULT_TOKEN=$(echo "$VAULT_AUTH_RESPONSE" | jq -r '.auth.client_token')
|
||||||
|
|
||||||
|
# Read the kanidm API token
|
||||||
|
SECRET_RESPONSE=$(curl -f \
|
||||||
|
-H "X-Vault-Token: ${VAULT_TOKEN}" \
|
||||||
|
https://vault.hrajfrisbee.cz/v1/secret/data/gitea/gitea-ci)
|
||||||
|
|
||||||
|
echo "Secret response: $SECRET_RESPONSE" >&2
|
||||||
|
API_TOKEN=$(echo "$SECRET_RESPONSE" | jq -r '.data.data.token')
|
||||||
|
|
||||||
|
echo "::add-mask::${API_TOKEN}"
|
||||||
|
echo "api_token=${API_TOKEN}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Exchange for K8s OIDC token via Kanidm
|
||||||
|
id: k8s
|
||||||
|
run: |
|
||||||
|
API_TOKEN="${{ steps.vault.outputs.api_token }}"
|
||||||
|
echo "api_token length: ${#API_TOKEN}" >&2
|
||||||
|
echo "api_token prefix (first 8 chars): ${API_TOKEN:0:8}..." >&2
|
||||||
|
|
||||||
|
HTTP_BODY=$(mktemp)
|
||||||
|
HTTP_STATUS=$(curl -sS -X POST "https://idm.home.hrajfrisbee.cz/oauth2/token" \
|
||||||
|
-d "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
|
||||||
|
-d "client_id=k8s" \
|
||||||
|
-d "subject_token=${API_TOKEN}" \
|
||||||
|
-d "subject_token_type=urn:ietf:params:oauth:token-type:access_token" \
|
||||||
|
-d "audience=k8s" \
|
||||||
|
-d "scope=openid groups" \
|
||||||
|
-o "$HTTP_BODY" -w "%{http_code}")
|
||||||
|
|
||||||
|
echo "HTTP status: $HTTP_STATUS" >&2
|
||||||
|
echo "Response body:" >&2
|
||||||
|
cat "$HTTP_BODY" >&2
|
||||||
|
|
||||||
|
RESPONSE=$(cat "$HTTP_BODY")
|
||||||
|
ID_TOKEN=$(echo "$RESPONSE" | jq -r '.id_token // empty')
|
||||||
|
|
||||||
|
if [ -z "$ID_TOKEN" ]; then
|
||||||
|
echo "::error::Kanidm token exchange failed (HTTP $HTTP_STATUS)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "::add-mask::${ID_TOKEN}"
|
||||||
|
echo "id_token=${ID_TOKEN}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
# Sanity check
|
||||||
|
# Warning - this is the part that is failing
|
||||||
|
# echo "$ID_TOKEN" | cut -d. -f2 | base64 -d 2>/dev/null | jq '{sub, groups, exp}'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Debug - print environment before kubectl
|
||||||
|
run: env | sort
|
||||||
|
|
||||||
|
- name: Configure kubectl & deploy
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.K8S_CA_CERT }}" > /tmp/ca.crt
|
||||||
|
|
||||||
|
kubectl config set-cluster mycluster \
|
||||||
|
--server=https://192.168.0.31:6443 \
|
||||||
|
--insecure-skip-tls-verify=true
|
||||||
|
# --certificate-authority=/tmp/ca.crt \
|
||||||
|
|
||||||
|
kubectl config set-credentials gitea-ci \
|
||||||
|
--token="${{ steps.k8s.outputs.id_token }}"
|
||||||
|
|
||||||
|
kubectl config set-context gitea-ci \
|
||||||
|
--cluster=mycluster --user=gitea-ci
|
||||||
|
|
||||||
|
kubectl config use-context gitea-ci
|
||||||
|
|
||||||
|
kubectl auth whoami
|
||||||
|
kubectl get ns
|
||||||
|
|
||||||
|
# your deploy here
|
||||||
|
# kubectl apply -f k8s/
|
||||||
@@ -25,3 +25,7 @@ Once a tech stack is chosen and implementation begins, update this file with:
|
|||||||
- Build, test, and lint commands
|
- Build, test, and lint commands
|
||||||
- Architecture overview
|
- Architecture overview
|
||||||
- Development setup instructions
|
- Development setup instructions
|
||||||
|
|
||||||
|
## Git Commits
|
||||||
|
|
||||||
|
When making git commits, always append yourself as co-author trailer to the end of the commit message to indicate AI assistance
|
||||||
6
Makefile
6
Makefile
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: help fees match web image
|
.PHONY: help fees match web image run
|
||||||
|
|
||||||
export PYTHONPATH := scripts:$(PYTHONPATH)
|
export PYTHONPATH := scripts:$(PYTHONPATH)
|
||||||
VENV := .venv
|
VENV := .venv
|
||||||
@@ -14,6 +14,7 @@ help:
|
|||||||
@echo " make match - Match Fio bank payments against expected attendance fees"
|
@echo " make match - Match Fio bank payments against expected attendance fees"
|
||||||
@echo " make web - Start a dynamic web dashboard locally"
|
@echo " make web - Start a dynamic web dashboard locally"
|
||||||
@echo " make image - Build an OCI container image"
|
@echo " make image - Build an OCI container image"
|
||||||
|
@echo " make run - Run the built Docker image locally"
|
||||||
|
|
||||||
fees: $(PYTHON)
|
fees: $(PYTHON)
|
||||||
$(PYTHON) scripts/calculate_fees.py
|
$(PYTHON) scripts/calculate_fees.py
|
||||||
@@ -26,3 +27,6 @@ web: $(PYTHON)
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
docker build -t fuj-management:latest -f build/Dockerfile .
|
docker build -t fuj-management:latest -f build/Dockerfile .
|
||||||
|
|
||||||
|
run:
|
||||||
|
docker run -it --rm -p 5001:5001 fuj-management:latest
|
||||||
|
|||||||
Reference in New Issue
Block a user