syntaxis/deploy/kubernetes/20-api-deployment.yaml
Jesús Pérez faf0d2c6b9
Some checks failed
Build - Verify Code & Build Binaries / Check Code Format (push) Has been cancelled
Build - Verify Code & Build Binaries / Lint with Clippy (push) Has been cancelled
Build - Verify Code & Build Binaries / Test Suite (push) Has been cancelled
Build - Verify Code & Build Binaries / Cargo Check (push) Has been cancelled
Build - Verify Code & Build Binaries / Security Audit (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Debug) - macos-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Debug) - ubuntu-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Debug) - windows-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Release) - macos-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Release) - ubuntu-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Release) - windows-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / All Checks Passed (push) Has been cancelled
CI/CD with Staging Preset / Validate Installation with Staging Preset (macos-latest) (push) Has been cancelled
CI/CD with Staging Preset / Validate Installation with Staging Preset (ubuntu-latest) (push) Has been cancelled
CI/CD with Staging Preset / Build and Test with Staging Preset (push) Has been cancelled
CI/CD with Staging Preset / Integration Test with Docker Compose (push) Has been cancelled
CI/CD with Staging Preset / Validate Documentation (push) Has been cancelled
CI/CD with Staging Preset / Test Summary (push) Has been cancelled
Provisioning Tests / Provisioning Tests (macos-latest) (push) Has been cancelled
Provisioning Tests / Provisioning Tests (ubuntu-20.04) (push) Has been cancelled
Provisioning Tests / Provisioning Tests (ubuntu-latest) (push) Has been cancelled
Provisioning Tests / Lint Provisioning Scripts (push) Has been cancelled
Provisioning Tests / Test Report (push) Has been cancelled
chore: reorganization following layout_conventions.md
2025-12-26 18:46:38 +00:00

155 lines
3.2 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: lifecycle-api
namespace: lifecycle
labels:
app: lifecycle-api
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: lifecycle-api
template:
metadata:
labels:
app: lifecycle-api
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "3000"
prometheus.io/path: "/metrics"
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- lifecycle-api
topologyKey: kubernetes.io/hostname
containers:
- name: api
image: project-lifecycle:latest
imagePullPolicy: Always
args:
- "api"
ports:
- name: http
containerPort: 3000
- name: metrics
containerPort: 9090
env:
- name: DATABASE_URL
value: "sqlite:///mnt/data/projects.db"
- name: NATS_URL
value: "nats://nats:4222"
- name: RUST_LOG
value: "info,lifecycle_api=debug"
- name: API_HOST
value: "0.0.0.0"
- name: API_PORT
value: "3000"
volumeMounts:
- name: data
mountPath: /mnt/data
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: http
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
volumes:
- name: data
persistentVolumeClaim:
claimName: api-data-pvc
---
apiVersion: v1
kind: Service
metadata:
name: lifecycle-api
namespace: lifecycle
labels:
app: lifecycle-api
spec:
selector:
app: lifecycle-api
ports:
- name: http
port: 3000
targetPort: 3000
- name: metrics
port: 9090
targetPort: 9090
type: ClusterIP
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: api-data-pvc
namespace: lifecycle
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 20Gi
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: lifecycle-api-hpa
namespace: lifecycle
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: lifecycle-api
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80