Skip to content
Open
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
22 changes: 0 additions & 22 deletions infra/k8s/base/configmap.yaml

This file was deleted.

11 changes: 7 additions & 4 deletions infra/k8s/base/kafka/kafka-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ spec:
image: provectuslabs/kafka-ui:latest
ports:
- containerPort: 8080
resources:
requests:
memory: "384Mi"
cpu: "100m"
env:
- name: KAFKA_CLUSTERS_0_NAME
value: spot-cluster
Expand All @@ -39,6 +35,13 @@ spec:
value: WARN
- name: LOGGING_LEVEL_COM_PROVECTUS
value: WARN
resources:
requests:
cpu: "100m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
---
apiVersion: v1
kind: Service
Expand Down
9 changes: 9 additions & 0 deletions infra/k8s/base/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: monitoring-secrets
namespace: monitoring
type: Opaque
stringData:
GF_SECURITY_ADMIN_USER: "spot"
GF_SECURITY_ADMIN_PASSWORD: "spot-grafana"
8 changes: 8 additions & 0 deletions infra/k8s/base/temporal/temporal-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ spec:
value: "temporal:7233"
- name: TEMPORAL_CORS_ALLOW_ORIGINS
value: "*"
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
---
# Service
apiVersion: v1
kind: Service
metadata:
Expand Down
4 changes: 2 additions & 2 deletions infra/k8s/base/temporal/temporal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ spec:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
memory: "1Gi"
cpu: "750m"
---
apiVersion: v1
kind: Service
Expand Down
20 changes: 1 addition & 19 deletions infra/k8s/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ kind: Kustomization
resources:
# Base
- base/namespace.yaml
- base/configmap.yaml
- base/secrets.yaml
# - base/postgres.yaml
# - base/redis.yaml

Expand Down Expand Up @@ -40,14 +40,6 @@ resources:
- base/monitoring/servicemonitors/spot-store-servicemonitor.yaml
- base/monitoring/servicemonitors/spot-payment-servicemonitor.yaml

# Spot Apps
- apps/spot-ingress.yaml
- apps/spot-gateway.yaml
- apps/spot-user.yaml
- apps/spot-store.yaml
- apps/spot-order.yaml
- apps/spot-payment.yaml

# config 디렉토리의 yml 파일들을 ConfigMap으로 생성
configMapGenerator:
- name: spot-app-config
Expand All @@ -63,15 +55,6 @@ configMapGenerator:
options:
disableNameSuffixHash: true

- name: kafka-connect-init-config
namespace: spot
files:
- ../../connectors/order-outbox.json
- ../../connectors/payment-outbox.json
- ../../connectors/register-connectors.sh
options:
disableNameSuffixHash: true

- name: grafana-dashboards-spot
namespace: monitoring
files:
Expand Down Expand Up @@ -105,6 +88,5 @@ secretGenerator:
options:
disableNameSuffixHash: true


generatorOptions:
disableNameSuffixHash: true
23 changes: 23 additions & 0 deletions infra/spot-apps/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions infra/spot-apps/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: spot-apps
description: Spot 프로젝트 app 설정
type: application
version: 0.1.0
appVersion: "1.0.0"
81 changes: 81 additions & 0 deletions infra/spot-apps/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{{- range $key, $val := .Values.apps }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $val.name }}
labels:
app: {{ $val.name }}
spec:
replicas: {{ $.Values.global.replicas | default 1}}
selector:
matchLabels:
app: {{ $val.name }}
template:
metadata:
labels:
app: {{ $val.name }}
spec:
containers:
- name: {{ $val.name }}
image: {{ $.Values.global.repository }}/{{ $val.name }}:latest
imagePullPolicy: {{ $.Values.global.imagePullPolicy }}
ports:
- containerPort: {{ $val.targetPort | default $val.port }}
env:
- name: SPRING_PROFILES_ACTIVE
value: {{ $.Values.env.activeProfile }}
- name: LOGGING_CONFIG
value: {{ $.Values.env.loggingConfig }}
envFrom:
- secretRef:
name: {{ $.Values.config.secretName }}

# 리소스 설정
resources:
requests:
cpu: {{ $.Values.global.requests.cpu }}
memory: {{ $.Values.global.requests.memory}}
limits:
cpu: {{ $.Values.global.limits.cpu }}
memory: {{ $.Values.global.limits.memory }}

# 헬스 체크
readinessProbe:
httpGet:
path: {{ $.Values.global.path }}
port: {{ $val.targetPort | default $val.port }}
initialDelaySeconds: {{ $.Values.global.readiness.initial }}
periodSeconds: {{ $.Values.global.readiness.period }}
{{- if $val.timeoutSeconds }}
timeoutSeconds: {{ $val.timeoutSeconds }}
{{- end }}
{{- if $val.failureThreshold }}
failureThreshold: {{ $val.failureThreshold }}
{{- end }}
{{- if $val.successThreshold }}
successThreshold: {{ $val.successThreshold }}
{{- end }}

# 헬스 체크 (Liveness)
livenessProbe:
httpGet:
path: {{ $.Values.global.path }}
port: {{ $val.targetPort | default $val.port }}
initialDelaySeconds: {{ $.Values.global.liveness.initial }}
periodSeconds: {{ $.Values.global.liveness.period }}
{{- if $val.timeoutSeconds }}
timeoutSeconds: {{ $val.timeoutSeconds }}
{{- end }}

# 볼륨 마운트
volumeMounts:
- name: app-config
mountPath: /config
readOnly: true

volumes:
- name: app-config
configMap:
name: {{ $.Values.config.configMapName }}
{{- end }}
24 changes: 24 additions & 0 deletions infra/spot-apps/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.global.name }}-ingress
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
rules:
# 도메인(Spot, Kafka, Temporal)
{{- range .Values.ingress.subs }}
- host: {{ .name }}.{{ $.Values.domain }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .serviceName }}
port:
number: 80
{{- end}}
16 changes: 16 additions & 0 deletions infra/spot-apps/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- range $key, $val := .Values.apps }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ $val.name }}
labels:
app: {{ $val.name }}
spec:
type: ClusterIP
selector:
app: {{ $val.name }}
ports:
- port: {{ $val.port }}
targetPort: {{ $val.targetPort | default $val.port }}
{{- end }}
87 changes: 87 additions & 0 deletions infra/spot-apps/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# [1] Ingress 공통 설정 (기본값: AWS ALB)
ingress:
enabled: true
className: "alb"

annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/healthcheck-path: /actuator/health
alb.ingress.kubernetes.io/success-codes: "200" # 헬스 체크 성공 코드

subs:
- name: www
serviceName: spot-gateway
- name: kafka
serviceName: kafka-ui-svc
- name: temporal
serviceName: temporal-ui-svc

# 도메인 (AWS)
domain: spotorder.org

# [2] Deployment 공통 설정 (Global)
global:
name: spot
repository: 322546275072.dkr.ecr.ap-northeast-2.amazonaws.com
imagePullPolicy: Always
replicas: 1

# 리소스 제한
requests:
cpu: "250m"
memory: "512Mi"
limits:
cpu: "800m"
memory: "1Gi"

# 헬스 체크
path: /actuator/health

readiness:
initial: 90
period: 10
liveness:
initial: 120
period: 30

# [3] app 목록
apps:
gateway:
name: spot-gateway
port: 80
targetPort: 8080
timeoutSeconds: 5
failureThreshold: 5
successThreshold: 1

user:
name: spot-user
port: 8081

store:
name: spot-store
port: 8083

order:
name: spot-order
port: 8082

payment:
name: spot-payment
port: 8084

# [4] env
env:
activeProfile: "k8s"
loggingConfig: "classpath:logback-spring.xml"
postgres:
- db: POSTGRES_DB
value: "myapp_db"
- user: POSTGRES_USER
value: "admin"

# [5] config
config:
secretName: spot-secrets
configMapName: spot-app-config
11 changes: 11 additions & 0 deletions infra/spot-apps/values/local-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --- Ingress ---
ingress:
className: "nginx"
annotations: { kubernetes.io/ingress.class: nginx }

# domain
domain: localhost

# [2] 로컬 환경 Deployment 설정 (Global)
global:
repository: spot-registry.localhost:5111
Loading