Jenkins 기반 CI/CD 파이프라인 구성

- Kustomize 기반 환경별(dev/staging/prod) 매니페스트 관리
- Jenkins 파이프라인 스크립트 작성 (Podman, Gradle, kubectl 컨테이너)
- SonarQube 코드 품질 분석 및 Quality Gate 연동
- 수동 배포 및 리소스 검증 스크립트 추가
- k8s 매니페스트 구조 재정리 (configmaps, secrets, deployments, services 분리)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ondal
2025-12-01 10:23:32 +09:00
parent 21b9c77109
commit f12fed5de9
113 changed files with 2955 additions and 3567 deletions
@@ -1,10 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-api-gateway
name: api-gateway-config
labels:
app: api-gateway
app.kubernetes.io/part-of: phonebill
data:
SERVER_PORT: "8080"
BILL_SERVICE_URL: "http://bill-service"
PRODUCT_SERVICE_URL: "http://product-service"
USER_SERVICE_URL: "http://user-service"
KOS_MOCK_URL: "http://kos-mock"
USER_SERVICE_URL: "http://user-service:8081"
BILL_SERVICE_URL: "http://bill-service:8082"
PRODUCT_SERVICE_URL: "http://product-service:8083"
KOS_MOCK_URL: "http://kos-mock:8084"
@@ -2,6 +2,10 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: api-gateway
labels:
app: api-gateway
app.kubernetes.io/part-of: phonebill
spec:
replicas: 1
selector:
@@ -12,46 +16,40 @@ spec:
labels:
app: api-gateway
spec:
imagePullSecrets:
- name: phonebill
containers:
- name: api-gateway
image: acrdigitalgarage01.azurecr.io/phonebill/api-gateway:latest
image: docker.io/hiondal/api-gateway:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
name: http
envFrom:
- configMapRef:
name: cm-common
name: phonebill-common-config
- configMapRef:
name: cm-api-gateway
name: api-gateway-config
- secretRef:
name: secret-common
name: phonebill-common-secret
resources:
requests:
cpu: 256m
memory: 256Mi
cpu: "256m"
memory: "256Mi"
limits:
cpu: 1024m
memory: 1024Mi
startupProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3
cpu: "1024m"
memory: "1024Mi"
livenessProbe:
httpGet:
path: /health
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 5
failureThreshold: 3
@@ -2,10 +2,16 @@ apiVersion: v1
kind: Service
metadata:
name: api-gateway
labels:
app: api-gateway
app.kubernetes.io/part-of: phonebill
spec:
type: ClusterIP
selector:
app: api-gateway
ports:
- port: 80
- name: http
port: 8080
targetPort: 8080
type: ClusterIP
protocol: TCP
@@ -1,21 +1,16 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-bill-service
name: bill-service-config
labels:
app: bill-service
app.kubernetes.io/part-of: phonebill
data:
SERVER_PORT: "8082"
DB_KIND: "postgresql"
DB_HOST: "inquiry-postgresql"
DB_PORT: "5432"
DB_CONNECTION_TIMEOUT: "30000"
DB_IDLE_TIMEOUT: "600000"
DB_LEAK_DETECTION: "60000"
DB_MAX_LIFETIME: "1800000"
DB_MAX_POOL: "20"
DB_MIN_IDLE: "5"
KOS_BASE_URL: "http://kos-mock"
DB_NAME: "inquirydb"
REDIS_DATABASE: "1"
REDIS_MAX_ACTIVE: "8"
REDIS_MAX_IDLE: "8"
REDIS_MAX_WAIT: "-1"
REDIS_MIN_IDLE: "0"
REDIS_TIMEOUT: "2000"
KOS_BASE_URL: "http://kos-mock:8084"
DDL_AUTO: "update"
@@ -2,6 +2,10 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: bill-service
labels:
app: bill-service
app.kubernetes.io/part-of: phonebill
spec:
replicas: 1
selector:
@@ -12,48 +16,42 @@ spec:
labels:
app: bill-service
spec:
imagePullSecrets:
- name: phonebill
containers:
- name: bill-service
image: acrdigitalgarage01.azurecr.io/phonebill/bill-service:latest
image: docker.io/hiondal/bill-service:latest
imagePullPolicy: Always
ports:
- containerPort: 8082
name: http
envFrom:
- configMapRef:
name: cm-common
name: phonebill-common-config
- configMapRef:
name: cm-bill-service
name: bill-service-config
- secretRef:
name: secret-common
name: phonebill-common-secret
- secretRef:
name: secret-bill-service
name: bill-service-db-secret
resources:
requests:
cpu: 256m
memory: 256Mi
cpu: "256m"
memory: "256Mi"
limits:
cpu: 1024m
memory: 1024Mi
startupProbe:
httpGet:
path: /actuator/health
port: 8082
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8082
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3
cpu: "1024m"
memory: "1024Mi"
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8082
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8082
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 5
failureThreshold: 3
@@ -1,10 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: secret-bill-service
name: bill-service-db-secret
labels:
app: bill-service
app.kubernetes.io/part-of: phonebill
type: Opaque
stringData:
DB_HOST: "bill-inquiry-postgres-dev-postgresql"
DB_NAME: "bill_inquiry_db"
DB_USERNAME: "bill_inquiry_user"
DB_PASSWORD: "BillUser2025@"
DB_USERNAME: "unicorn"
DB_PASSWORD: "P@ssw0rd$"
@@ -2,10 +2,16 @@ apiVersion: v1
kind: Service
metadata:
name: bill-service
labels:
app: bill-service
app.kubernetes.io/part-of: phonebill
spec:
type: ClusterIP
selector:
app: bill-service
ports:
- port: 80
- name: http
port: 8082
targetPort: 8082
type: ClusterIP
protocol: TCP
@@ -1,11 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-common
name: phonebill-common-config
labels:
app.kubernetes.io/part-of: phonebill
data:
CORS_ALLOWED_ORIGINS: "http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://phonebill-dg0500.20.214.196.128.nip.io"
JWT_ACCESS_TOKEN_VALIDITY: "18000000"
JWT_REFRESH_TOKEN_VALIDITY: "86400000"
SPRING_PROFILES_ACTIVE: "prod"
REDIS_HOST: "cache-redis-master"
REDIS_PORT: "6379"
SPRING_PROFILES_ACTIVE: "dev"
DDL_AUTO: "update"
CORS_ALLOWED_ORIGINS: "http://localhost:3000,http://phonebill.72.155.72.236.nip.io"
SHOW_SQL: "false"
DDL_AUTO: "none"
@@ -1,49 +1,25 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: phonebill
name: phonebill-ingress
labels:
app.kubernetes.io/part-of: phonebill
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/proxy-body-size: "50m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "60"
nginx.ingress.kubernetes.io/proxy-send-timeout: "60"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"
spec:
ingressClassName: nginx
rules:
- host: phonebill-dg0500-api.20.214.196.128.nip.io
- host: phonebill-api.72.155.72.236.nip.io
http:
paths:
- path: /api/v1/auth
- path: /
pathType: Prefix
backend:
service:
name: user-service
name: api-gateway
port:
number: 80
- path: /api/v1/users
pathType: Prefix
backend:
service:
name: user-service
port:
number: 80
- path: /api/v1/bills
pathType: Prefix
backend:
service:
name: bill-service
port:
number: 80
- path: /api/v1/products
pathType: Prefix
backend:
service:
name: product-service
port:
number: 80
- path: /api/v1/kos
pathType: Prefix
backend:
service:
name: kos-mock
port:
number: 80
number: 8080
@@ -1,9 +1,13 @@
apiVersion: v1
kind: Secret
metadata:
name: secret-common
name: phonebill-common-secret
labels:
app.kubernetes.io/part-of: phonebill
type: Opaque
stringData:
JWT_SECRET: "nwe5Yo9qaJ6FBD/Thl2/j6/SFAfNwUorAY1ZcWO2KI7uA4bmVLOCPxE9hYuUpRCOkgV2UF2DdHXtqHi3+BU/ecbz2zpHyf/720h48UbA3XOMYOX1sdM+dQ=="
REDIS_HOST: "redis-cache-dev-master"
REDIS_PASSWORD: "Redis2025Dev@"
# JWT Secret (최소 256비트 이상, HS256 알고리즘용)
JWT_SECRET: "EK1ZV7vROOXREXbYe/BCISdQq0Yklk9JtoA2v88ux1DBDc0bDGiRRxHeDSb7GHkDP9IUYHMVsBi4/1rS4OhfRg=="
# Redis 비밀번호 (비밀번호 없는 경우 빈 값)
REDIS_PASSWORD: "P@ssw0rd$"
@@ -1,16 +0,0 @@
apiVersion: v1
kind: Secret
metadata:
name: phonebill
type: kubernetes.io/dockerconfigjson
stringData:
.dockerconfigjson: |
{
"auths": {
"acrdigitalgarage01.azurecr.io": {
"username": "acrdigitalgarage01",
"password": "+OY+rmOagorjWvQe/tTk6oqvnZI8SmNbY/Y2o5EDcY+ACRDCDbYk",
"auth": "YWNyZGlnaXRhbGdhcmFnZTAxOitPWStybU9hZ29yald2UWUvdFRrNm9xdm5aSThTbU5iWS9ZMm81RURjWStBQ1JEQ0RiWWs="
}
}
}
@@ -1,6 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-kos-mock
name: kos-mock-config
labels:
app: kos-mock
app.kubernetes.io/part-of: phonebill
data:
SERVER_PORT: "8084"
SERVER_PORT: "8084"
@@ -2,6 +2,10 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: kos-mock
labels:
app: kos-mock
app.kubernetes.io/part-of: phonebill
spec:
replicas: 1
selector:
@@ -12,46 +16,40 @@ spec:
labels:
app: kos-mock
spec:
imagePullSecrets:
- name: phonebill
containers:
- name: kos-mock
image: acrdigitalgarage01.azurecr.io/phonebill/kos-mock:latest
image: docker.io/hiondal/kos-mock:latest
imagePullPolicy: Always
ports:
- containerPort: 8084
name: http
envFrom:
- configMapRef:
name: cm-common
name: phonebill-common-config
- configMapRef:
name: cm-kos-mock
name: kos-mock-config
- secretRef:
name: secret-common
name: phonebill-common-secret
resources:
requests:
cpu: 256m
memory: 256Mi
cpu: "256m"
memory: "256Mi"
limits:
cpu: 1024m
memory: 1024Mi
startupProbe:
httpGet:
path: /actuator/health
port: 8084
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8084
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3
cpu: "1024m"
memory: "1024Mi"
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8084
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8084
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 5
failureThreshold: 3
@@ -2,10 +2,16 @@ apiVersion: v1
kind: Service
metadata:
name: kos-mock
labels:
app: kos-mock
app.kubernetes.io/part-of: phonebill
spec:
type: ClusterIP
selector:
app: kos-mock
ports:
- port: 80
- name: http
port: 8084
targetPort: 8084
type: ClusterIP
protocol: TCP
@@ -8,7 +8,6 @@ resources:
# Common resources
- common/cm-common.yaml
- common/secret-common.yaml
- common/secret-imagepull.yaml
- common/ingress.yaml
# api-gateway
@@ -44,13 +43,13 @@ commonLabels:
version: v1
images:
- name: acrdigitalgarage01.azurecr.io/phonebill/api-gateway
- name: docker.io/hiondal/api-gateway
newTag: latest
- name: acrdigitalgarage01.azurecr.io/phonebill/user-service
- name: docker.io/hiondal/user-service
newTag: latest
- name: acrdigitalgarage01.azurecr.io/phonebill/bill-service
- name: docker.io/hiondal/bill-service
newTag: latest
- name: acrdigitalgarage01.azurecr.io/phonebill/product-service
- name: docker.io/hiondal/product-service
newTag: latest
- name: docker.io/hiondal/kos-mock
newTag: latest
- name: acrdigitalgarage01.azurecr.io/phonebill/kos-mock
newTag: latest
@@ -1,10 +1,16 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-product-service
name: product-service-config
labels:
app: product-service
app.kubernetes.io/part-of: phonebill
data:
SERVER_PORT: "8083"
DB_KIND: "postgresql"
DB_HOST: "change-postgresql"
DB_PORT: "5432"
KOS_BASE_URL: "http://kos-mock"
REDIS_DATABASE: "2"
DB_NAME: "changedb"
REDIS_DATABASE: "2"
KOS_BASE_URL: "http://kos-mock:8084"
DDL_AUTO: "update"
@@ -2,6 +2,10 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: product-service
labels:
app: product-service
app.kubernetes.io/part-of: phonebill
spec:
replicas: 1
selector:
@@ -12,48 +16,42 @@ spec:
labels:
app: product-service
spec:
imagePullSecrets:
- name: phonebill
containers:
- name: product-service
image: acrdigitalgarage01.azurecr.io/phonebill/product-service:latest
image: docker.io/hiondal/product-service:latest
imagePullPolicy: Always
ports:
- containerPort: 8083
name: http
envFrom:
- configMapRef:
name: cm-common
name: phonebill-common-config
- configMapRef:
name: cm-product-service
name: product-service-config
- secretRef:
name: secret-common
name: phonebill-common-secret
- secretRef:
name: secret-product-service
name: product-service-db-secret
resources:
requests:
cpu: 256m
memory: 256Mi
cpu: "256m"
memory: "256Mi"
limits:
cpu: 1024m
memory: 1024Mi
startupProbe:
httpGet:
path: /actuator/health
port: 8083
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8083
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3
cpu: "1024m"
memory: "1024Mi"
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8083
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8083
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 5
failureThreshold: 3
@@ -1,10 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: secret-product-service
name: product-service-db-secret
labels:
app: product-service
app.kubernetes.io/part-of: phonebill
type: Opaque
stringData:
DB_HOST: "product-change-postgres-dev-postgresql"
DB_NAME: "product_change_db"
DB_USERNAME: "product_change_user"
DB_PASSWORD: "ProductUser2025@"
DB_USERNAME: "unicorn"
DB_PASSWORD: "P@ssw0rd$"
@@ -2,10 +2,16 @@ apiVersion: v1
kind: Service
metadata:
name: product-service
labels:
app: product-service
app.kubernetes.io/part-of: phonebill
spec:
type: ClusterIP
selector:
app: product-service
ports:
- port: 80
- name: http
port: 8083
targetPort: 8083
type: ClusterIP
protocol: TCP
@@ -1,11 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: cm-user-service
name: user-service-config
labels:
app: user-service
app.kubernetes.io/part-of: phonebill
data:
SERVER_PORT: "8081"
DB_KIND: "postgresql"
DB_HOST: "auth-postgresql"
DB_PORT: "5432"
DDL_AUTO: "update"
DB_NAME: "authdb"
REDIS_DATABASE: "0"
SHOW_SQL: "true"
DDL_AUTO: "update"
@@ -2,6 +2,10 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: user-service
labels:
app: user-service
app.kubernetes.io/part-of: phonebill
spec:
replicas: 1
selector:
@@ -12,48 +16,42 @@ spec:
labels:
app: user-service
spec:
imagePullSecrets:
- name: phonebill
containers:
- name: user-service
image: acrdigitalgarage01.azurecr.io/phonebill/user-service:latest
image: docker.io/hiondal/user-service:latest
imagePullPolicy: Always
ports:
- containerPort: 8081
name: http
envFrom:
- configMapRef:
name: cm-common
name: phonebill-common-config
- configMapRef:
name: cm-user-service
name: user-service-config
- secretRef:
name: secret-common
name: phonebill-common-secret
- secretRef:
name: secret-user-service
name: user-service-db-secret
resources:
requests:
cpu: 256m
memory: 256Mi
cpu: "256m"
memory: "256Mi"
limits:
cpu: 1024m
memory: 1024Mi
startupProbe:
httpGet:
path: /actuator/health
port: 8081
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 6
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8081
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3
cpu: "1024m"
memory: "1024Mi"
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8081
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8081
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 5
failureThreshold: 3
@@ -1,10 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: secret-user-service
name: user-service-db-secret
labels:
app: user-service
app.kubernetes.io/part-of: phonebill
type: Opaque
stringData:
DB_HOST: "auth-postgres-dev-postgresql"
DB_NAME: "phonebill_auth"
DB_USERNAME: "auth_user"
DB_PASSWORD: "AuthUser2025@"
DB_USERNAME: "unicorn"
DB_PASSWORD: "P@ssw0rd$"
@@ -2,10 +2,16 @@ apiVersion: v1
kind: Service
metadata:
name: user-service
labels:
app: user-service
app.kubernetes.io/part-of: phonebill
spec:
type: ClusterIP
selector:
app: user-service
ports:
- port: 80
- name: http
port: 8081
targetPort: 8081
type: ClusterIP
protocol: TCP