From 6948b48498ef56927a5918a3b5509198ec634f2d Mon Sep 17 00:00:00 2001 From: jhbkjh Date: Thu, 30 Oct 2025 09:47:45 +0900 Subject: [PATCH 1/4] =?UTF-8?q?participation-service=20pod=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Service selector를 app=participation-service만으로 간소화하여 영구적 해결 - Pod restart 시에도 자동 연결되도록 수정 - Swagger UI 외부 접근 정상화 확인 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- participation-service-backup.yaml | 38 +++++++++++++++++++++++++++++++ participation-service-fixed.yaml | 27 ++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 participation-service-backup.yaml create mode 100644 participation-service-fixed.yaml diff --git a/participation-service-backup.yaml b/participation-service-backup.yaml new file mode 100644 index 0000000..661af2f --- /dev/null +++ b/participation-service-backup.yaml @@ -0,0 +1,38 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"participation-service","app.kubernetes.io/managed-by":"kustomize","app.kubernetes.io/part-of":"kt-event-marketing","environment":"dev"},"name":"participation-service","namespace":"kt-event-marketing"},"spec":{"ports":[{"name":"http","port":80,"protocol":"TCP","targetPort":8084}],"selector":{"app":"participation-service","app.kubernetes.io/managed-by":"kustomize","app.kubernetes.io/part-of":"kt-event-marketing","environment":"dev"},"type":"ClusterIP"}} + creationTimestamp: "2025-10-28T08:59:06Z" + labels: + app: participation-service + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/part-of: kt-event-marketing + environment: dev + name: participation-service + namespace: kt-event-marketing + resourceVersion: "125107611" + uid: da5b7f82-37d3-41bd-ad87-e2864c8bcd18 +spec: + clusterIP: 10.0.130.146 + clusterIPs: + - 10.0.130.146 + internalTrafficPolicy: Cluster + ipFamilies: + - IPv4 + ipFamilyPolicy: SingleStack + ports: + - name: http + port: 80 + protocol: TCP + targetPort: 8084 + selector: + app: participation-service + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/part-of: kt-event-marketing + environment: dev + sessionAffinity: None + type: ClusterIP +status: + loadBalancer: {} diff --git a/participation-service-fixed.yaml b/participation-service-fixed.yaml new file mode 100644 index 0000000..7dfac99 --- /dev/null +++ b/participation-service-fixed.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: participation-service + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/part-of: kt-event-marketing + environment: dev + name: participation-service + namespace: kt-event-marketing +spec: + clusterIP: 10.0.130.146 + clusterIPs: + - 10.0.130.146 + internalTrafficPolicy: Cluster + ipFamilies: + - IPv4 + ipFamilyPolicy: SingleStack + ports: + - name: http + port: 80 + protocol: TCP + targetPort: 8084 + selector: + app: participation-service + sessionAffinity: None + type: ClusterIP \ No newline at end of file From 5cac8ccc12cac566a66fa3ad82757d5fc2889825 Mon Sep 17 00:00:00 2001 From: jhbkjh Date: Thu, 30 Oct 2025 10:21:08 +0900 Subject: [PATCH 2/4] =?UTF-8?q?participation-service=20WebConfig=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CORS 설정 적용 - 모든 origin 패턴 허용 - 모든 HTTP 메서드 허용 - Credentials 허용 --- .../infrastructure/config/SecurityConfig.java | 2 +- .../infrastructure/config/WebConfig.java | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 participation-service/src/main/java/com/kt/event/participation/infrastructure/config/WebConfig.java diff --git a/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java b/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java index def3f44..ff51aed 100644 --- a/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java +++ b/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java @@ -24,7 +24,7 @@ import java.util.Arrays; @EnableWebSecurity public class SecurityConfig { - @Value("${cors.allowed-origins:http://localhost:*,https://kt-event-marketing-api.20.214.196.128.nip.io/api/v1}") + @Value("${cors.allowed-origins:*") private String allowedOrigins; @Bean diff --git a/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/WebConfig.java b/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/WebConfig.java new file mode 100644 index 0000000..9d1c47e --- /dev/null +++ b/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/WebConfig.java @@ -0,0 +1,32 @@ +package com.kt.event.participation.infrastructure.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * Web Configuration + * CORS 설정 및 기타 웹 관련 설정 + * + * @author System Architect + * @since 2025-10-30 + */ +@Configuration +public class WebConfig implements WebMvcConfigurer { + + /** + * CORS 설정 + * - 모든 origin 허용 (개발 환경) + * - 모든 HTTP 메서드 허용 + * - Credentials 허용 + */ + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOriginPatterns("*") + .allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS") + .allowedHeaders("*") + .allowCredentials(true) + .maxAge(3600); + } +} \ No newline at end of file From 7ed2465d579152d19312e9751c277bed479633b3 Mon Sep 17 00:00:00 2001 From: jhbkjh Date: Thu, 30 Oct 2025 10:37:36 +0900 Subject: [PATCH 3/4] =?UTF-8?q?participation-service=20CORS=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SecurityConfig.java @Value 어노테이션 문법 오류 수정 - application.yml CORS allowed-origins에 localhost:3000 추가 - Frontend UI (localhost:3000)에서 API 호출 시 CORS 에러 해결 --- .../participation/infrastructure/config/SecurityConfig.java | 2 +- participation-service/src/main/resources/application.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java b/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java index ff51aed..f11e549 100644 --- a/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java +++ b/participation-service/src/main/java/com/kt/event/participation/infrastructure/config/SecurityConfig.java @@ -24,7 +24,7 @@ import java.util.Arrays; @EnableWebSecurity public class SecurityConfig { - @Value("${cors.allowed-origins:*") + @Value("${cors.allowed-origins:*}") private String allowedOrigins; @Bean diff --git a/participation-service/src/main/resources/application.yml b/participation-service/src/main/resources/application.yml index 2f35890..7ad3c96 100644 --- a/participation-service/src/main/resources/application.yml +++ b/participation-service/src/main/resources/application.yml @@ -56,7 +56,7 @@ jwt: # CORS 설정 cors: - allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io} + allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io} allowed-methods: ${CORS_ALLOWED_METHODS:GET,POST,PUT,DELETE,OPTIONS,PATCH} allowed-headers: ${CORS_ALLOWED_HEADERS:*} allow-credentials: ${CORS_ALLOW_CREDENTIALS:true} From a3381cc54067e09a0e8d3e4589b9bb1bd95bfde2 Mon Sep 17 00:00:00 2001 From: jhbkjh Date: Thu, 30 Oct 2025 12:22:19 +0900 Subject: [PATCH 4/4] =?UTF-8?q?cors=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- participation-service/src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/participation-service/src/main/resources/application.yml b/participation-service/src/main/resources/application.yml index 7ad3c96..44011c7 100644 --- a/participation-service/src/main/resources/application.yml +++ b/participation-service/src/main/resources/application.yml @@ -56,7 +56,7 @@ jwt: # CORS 설정 cors: - allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io} + allowed-origins: ${CORS_ALLOWED_ORIGINS:*} allowed-methods: ${CORS_ALLOWED_METHODS:GET,POST,PUT,DELETE,OPTIONS,PATCH} allowed-headers: ${CORS_ALLOWED_HEADERS:*} allow-credentials: ${CORS_ALLOW_CREDENTIALS:true}