This commit is contained in:
changmin hyeon
2026-02-10 11:33:59 +09:00
commit 0d808202f6
17 changed files with 575 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${RELEASE_NAME}
labels:
app.kubernetes.io/name: ${RELEASE_NAME}
app.kubernetes.io/managed-by: "jenkins"
watcher.project: "{{ project_id }}"
watcher.nodeId: "{{ node_id }}"
watcher.role: "{{ node_type }}"
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: ${RELEASE_NAME}
template:
metadata:
labels:
app.kubernetes.io/name: ${RELEASE_NAME}
app.kubernetes.io/managed-by: "jenkins"
watcher.project: "{{ project_id }}"
watcher.nodeId: "{{ node_id }}"
watcher.role: "{{ node_type }}"
watcher.branch: ${BRANCH_NAME}
annotations:
watcher.enabled: "true"
spec:
{% if image_pull_secret %}
imagePullSecrets:
- name: {{ image_pull_secret }}
{% endif %}
containers:
- name: app
image: ${FULL_IMAGE}
imagePullPolicy: IfNotPresent
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"

94
k8s/deployment.yaml.j2 Normal file
View File

@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: node-{{ node_id }}-main
namespace: {{ namespace }}
labels:
app: node-{{ node_id }}-main
watcher.project: "{{ project_id }}"
watcher.nodeId: "{{ node_id }}"
watcher.role: "{{ node_type }}"
spec:
replicas: 1
selector:
matchLabels:
app: node-{{ node_id }}-main
template:
metadata:
labels:
app: node-{{ node_id }}-main
watcher.project: "{{ project_id }}"
watcher.nodeId: "{{ node_id }}"
watcher.role: "{{ node_type }}"
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"

14
k8s/service.yaml copy.j2 Normal file
View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: ${RELEASE_NAME}
labels:
app.kubernetes.io/name: ${RELEASE_NAME}
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: ${RELEASE_NAME}
ports:
- name: http
port: {{ service_port | default(80) }}
targetPort: http

15
k8s/service.yaml.j2 Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: node-{{ node_id }}-main
namespace: {{ namespace }}
labels:
app: node-{{ node_id }}-main
spec:
type: ClusterIP
selector:
app: node-{{ node_id }}-main
ports:
- name: http
port: {{ service_port | default(80) }}
targetPort: http