provisioning-code/k8s/orchestrator-deployment.yaml

150 lines
4.2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: orchestrator
component: provisioning-platform
name: orchestrator
spec:
replicas: 3
revisionHistoryLimit: 5
selector:
matchLabels:
app: orchestrator
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
annotations:
prometheus.io/path: /metrics
prometheus.io/port: '9090'
prometheus.io/scrape: 'true'
labels:
app: orchestrator
component: provisioning-platform
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- orchestrator
topologyKey: kubernetes.io/hostname
weight: 100
containers:
- env:
- name: ORCHESTRATOR_MODE
value: kubernetes
- name: ORCHESTRATOR_SERVER_HOST
value: 0.0.0.0
- name: ORCHESTRATOR_SERVER_PORT
value: '9090'
- name: ORCHESTRATOR_STORAGE_BACKEND
valueFrom:
configMapKeyRef:
key: storage_backend
name: orchestrator-config
- name: ORCHESTRATOR_STORAGE_PATH
value: /var/lib/provisioning/orchestrator/data
- name: ORCHESTRATOR_QUEUE_MAX_CONCURRENT_TASKS
valueFrom:
configMapKeyRef:
key: max_concurrent_tasks
name: orchestrator-config
- name: ORCHESTRATOR_BATCH_PARALLEL_LIMIT
valueFrom:
configMapKeyRef:
key: batch_parallel_limit
name: orchestrator-config
- name: ORCHESTRATOR_LOG_LEVEL
valueFrom:
configMapKeyRef:
key: log_level
name: orchestrator-config
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: provisioning-orchestrator:latest
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
httpGet:
path: /health
port: 9090
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
name: orchestrator
ports:
- containerPort: 9090
name: http
protocol: TCP
- containerPort: 9091
name: metrics
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /health
port: 9090
initialDelaySeconds: 20
periodSeconds: 5
timeoutSeconds: 3
resources:
limits:
cpu: '2'
memory: 2Gi
requests:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsNonRoot: true
runAsUser: 1000
volumeMounts:
- mountPath: /var/lib/provisioning/orchestrator/data
name: orchestrator-data
- mountPath: /var/log/provisioning/orchestrator
name: orchestrator-logs
initContainers:
- command:
- sh
- -c
- until wget -q http://storage-service:8000/health || true; do echo waiting; sleep 2; done
image: busybox:1.35
imagePullPolicy: IfNotPresent
name: wait-for-storage
restartPolicy: Always
serviceAccountName: orchestrator
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 300
volumes:
- name: orchestrator-data
persistentVolumeClaim:
claimName: orchestrator-data
- name: orchestrator-logs
persistentVolumeClaim:
claimName: orchestrator-logs