Files
templates/k8s/deployment.yaml.j2
2026-02-23 09:20:36 +09:00

100 lines
2.6 KiB
Django/Jinja

apiVersion: apps/v1
kind: Deployment
metadata:
name: node-{{ node_id }}-main
namespace: {{ namespace }}
labels:
app: node-{{ node_id }}-main
app.kubernetes.io/name: "node-{{ node_id }}-main"
watcher.project: "{{ project_id }}"
watcher.nodeId: "{{ node_id }}"
watcher.role: "{{ node_type }}"
watcher.branch: "main"
spec:
replicas: 1
selector:
matchLabels:
app: node-{{ node_id }}-main
app.kubernetes.io/name: "node-{{ node_id }}-main"
template:
metadata:
labels:
app: node-{{ node_id }}-main
app.kubernetes.io/name: "node-{{ node_id }}-main"
watcher.project: "{{ project_id }}"
watcher.nodeId: "{{ node_id }}"
watcher.role: "{{ node_type }}"
watcher.branch: "main"
annotations:
watcher.enabled: "true"
spec:
{% if image_pull_secret %}
imagePullSecrets:
- name: {{ image_pull_secret }}
{% endif %}
{% if node_affinity_expressions %}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
{% for expr in node_affinity_expressions %}
- key: {{ expr["key"] }}
operator: {{ expr["operator"] }}
values:
{% for v in expr["values"] %}
- {{ v }}
{% endfor %}
{% endfor %}
{% endif %}
{% if tolerations %}
tolerations:
{% for t in tolerations %}
- key: {{ t["key"] }}
operator: {{ t["operator"] }}
{% if t.get("value") %}
value: {{ t["value"] }}
{% endif %}
{% if t.get("effect") %}
effect: {{ t["effect"] }}
{% endif %}
{% endfor %}
{% endif %}
containers:
- name: app
image: {{ regi }}{% if regi_repo %}/{{ regi_repo | trim('/') }}{% endif %}/node-{{ node_id }}-main
imagePullPolicy: Always
ports:
- name: http
containerPort: {{ app_port | default(80) }}
env:
- name: TZ
value: "Asia/Seoul"
# 기본 probe (필요 없으면 제거/수정)
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 3
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 6
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 6
resources:
requests:
cpu: "50m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"