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
43 changes: 43 additions & 0 deletions .github/actions/e2e-ready/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,49 @@ runs:
/home/runner/.kube/config > backend/kubeconfig.yaml
chmod 644 backend/kubeconfig.yaml

- name: Install Kueue
shell: bash
run: |
KUEUE_VERSION="${KUEUE_VERSION:-v0.16.1}"
KUEUE_MANIFEST_SHA256="${KUEUE_MANIFEST_SHA256:-3201a66ff731be440ecfcf3c0fa5979d001b834f68389208fe7ee18017fbcfe8}"
KUEUE_MANIFEST="/tmp/kueue-manifests.yaml"
curl -fsSL -o "$KUEUE_MANIFEST" "https://github.com/kubernetes-sigs/kueue/releases/download/${KUEUE_VERSION}/manifests.yaml"
echo "${KUEUE_MANIFEST_SHA256} ${KUEUE_MANIFEST}" | sha256sum -c -
kubectl apply --server-side -f "$KUEUE_MANIFEST"
rm -f "$KUEUE_MANIFEST"
kubectl wait --for=condition=Available --timeout=120s \
deployment/kueue-controller-manager -n kueue-system
kubectl apply --server-side -f - <<'EOF'
apiVersion: kueue.x-k8s.io/v1beta1
kind: ResourceFlavor
metadata:
name: default-flavor
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: ClusterQueue
metadata:
name: executor-queue
spec:
namespaceSelector: {}
resourceGroups:
- coveredResources: ["cpu", "memory"]
flavors:
- name: default-flavor
resources:
- name: cpu
nominalQuota: "32"
- name: memory
nominalQuota: "4Gi"
---
apiVersion: kueue.x-k8s.io/v1beta1
kind: LocalQueue
metadata:
name: executor-queue
namespace: integr8scode
spec:
clusterQueue: executor-queue
EOF

- name: Use test environment config
shell: bash
run: |
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ jobs:
MAILJET_FROM_ADDRESS: ${{ secrets.MAILJET_FROM_ADDRESS }}
MAILJET_HOST: ${{ secrets.MAILJET_HOST }}
GRAFANA_ALERT_RECIPIENTS: ${{ secrets.GRAFANA_ALERT_RECIPIENTS }}
REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }}
MONGO_ROOT_USER: ${{ secrets.MONGO_ROOT_USER }}
MONGO_ROOT_PASSWORD: ${{ secrets.MONGO_ROOT_PASSWORD }}
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
envs: GHCR_TOKEN,GHCR_USER,IMAGE_TAG,GRAFANA_ADMIN_USER,GRAFANA_ADMIN_PASSWORD,MAILJET_API_KEY,MAILJET_SECRET_KEY,MAILJET_FROM_ADDRESS,MAILJET_HOST,GRAFANA_ALERT_RECIPIENTS
envs: GHCR_TOKEN,GHCR_USER,IMAGE_TAG,GRAFANA_ADMIN_USER,GRAFANA_ADMIN_PASSWORD,MAILJET_API_KEY,MAILJET_SECRET_KEY,MAILJET_FROM_ADDRESS,MAILJET_HOST,GRAFANA_ALERT_RECIPIENTS,REDIS_PASSWORD,MONGO_ROOT_USER,MONGO_ROOT_PASSWORD
command_timeout: 10m
script: |
set -e
Expand All @@ -153,6 +156,9 @@ jobs:
export MAILJET_FROM_ADDRESS="$MAILJET_FROM_ADDRESS"
export GF_SMTP_HOST="$MAILJET_HOST"
export GRAFANA_ALERT_RECIPIENTS="$GRAFANA_ALERT_RECIPIENTS"
export REDIS_PASSWORD="$REDIS_PASSWORD"
export MONGO_ROOT_USER="$MONGO_ROOT_USER"
export MONGO_ROOT_PASSWORD="$MONGO_ROOT_PASSWORD"
docker compose pull
docker compose up -d --remove-orphans --no-build --wait --wait-timeout 180

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/stack-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ env:
KAFKA_IMAGE: confluentinc/cp-kafka:7.8.2
K3S_VERSION: v1.32.11+k3s1
K3S_INSTALL_SHA256: d75e014f2d2ab5d30a318efa5c326f3b0b7596f194afcff90fa7a7a91166d5f7
KUEUE_VERSION: v0.16.1
KUEUE_MANIFEST_SHA256: 3201a66ff731be440ecfcf3c0fa5979d001b834f68389208fe7ee18017fbcfe8

jobs:
# Fast unit tests (no infrastructure needed)
Expand Down
15 changes: 7 additions & 8 deletions backend/app/core/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import jwt
from fastapi import Request
from fastapi.security import OAuth2PasswordBearer
from passlib.context import CryptContext
from pwdlib import PasswordHash
from pwdlib.hashers.bcrypt import BcryptHasher

from app.core.metrics import SecurityMetrics
from app.domain.user import CSRFValidationError, InvalidCredentialsError
Expand All @@ -20,17 +21,15 @@ def __init__(self, settings: Settings, security_metrics: SecurityMetrics) -> Non
self.settings = settings
self._security_metrics = security_metrics
# --8<-- [start:password_hashing]
self.pwd_context = CryptContext(
schemes=["bcrypt"],
deprecated="auto",
bcrypt__rounds=self.settings.BCRYPT_ROUNDS,
)
self._password_hash = PasswordHash((
BcryptHasher(rounds=self.settings.BCRYPT_ROUNDS),
))

def verify_password(self, plain_password: str, hashed_password: str) -> bool:
return self.pwd_context.verify(plain_password, hashed_password) # type: ignore
return self._password_hash.verify(plain_password, hashed_password)

def get_password_hash(self, password: str) -> str:
return self.pwd_context.hash(password) # type: ignore
return self._password_hash.hash(password)
# --8<-- [end:password_hashing]

# --8<-- [start:create_access_token]
Expand Down
3 changes: 3 additions & 0 deletions backend/app/services/k8s_worker/pod_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def _build_pod_spec(
containers=[container],
restart_policy="Never",
active_deadline_seconds=timeout,
runtime_class_name=self._settings.K8S_POD_RUNTIME_CLASS_NAME,
host_users=False, # User namespace isolation — remaps container UIDs to unprivileged host UIDs
volumes=[
k8s_client.V1Volume(
name="script-volume",
Expand Down Expand Up @@ -155,6 +157,7 @@ def _build_pod_metadata(
) -> k8s_client.V1ObjectMeta:
"""Build pod metadata with saga tracking"""
labels = {"app": "integr8s", "component": "executor", "execution-id": execution_id, "language": language}
labels["kueue.x-k8s.io/queue-name"] = "executor-queue"

labels["user-id"] = user_id[:63] # K8s label value limit

Expand Down
Loading
Loading