Skip to content

fix: K8s client 버전 업그레이드 및 스케줄러 마비 수정 (closes #48)#49

Merged
younchanhyeok merged 1 commit into
devfrom
fix/#48-k8s-client-scheduler-crash
May 8, 2026
Merged

fix: K8s client 버전 업그레이드 및 스케줄러 마비 수정 (closes #48)#49
younchanhyeok merged 1 commit into
devfrom
fix/#48-k8s-client-scheduler-crash

Conversation

@younchanhyeok
Copy link
Copy Markdown
Contributor

관련 이슈

closes #48

변경 사항

  • build.gradle: client-java:21.0.124.0.0
  • KubernetesService: catch (ApiException)catch (Exception) (3곳)
  • MetricsCollectionScheduler: outer try/catch 추가
  • AnomalyDetectionService: outer try/catch 추가

작업 내용 상세

근본 원인

K8s 1.31+에서 V1PodStatusobservedGeneration 필드가 추가됐는데, client-java:21.0.1(K8s 1.30 기반)이 이를 인식하지 못해 JSON 역직렬화 시 IllegalArgumentException 발생. 이 예외가 catch (ApiException)을 통과해 스케줄러 메서드 전체를 죽임.

수정 내용

  1. 라이브러리 업그레이드 (근본 해결): client-java:24.0.0으로 올려 K8s 1.34까지 지원
  2. catch 확대 (방어 코드): 향후 호환성 이슈에 대비해 ApiExceptionException
  3. outer try/catch (안전망): 스케줄러 전체가 죽어도 다음 주기에 재시도 가능

체크리스트

  • ./gradlew build 성공 확인
  • 민감 정보 (API 키, 비밀번호 등) 코드에 포함되지 않음
  • AI 서버 연동 변경 시 fallback 로직 포함 여부 확인

- build.gradle: client-java 21.0.1 → 24.0.0 (K8s 1.34 지원, observedGeneration 호환)
- KubernetesService: catch ApiException → Exception으로 확대 (방어 코드)
- MetricsCollectionScheduler: getAllPods() 호출을 outer try/catch로 보호
- AnomalyDetectionService: getAllPods() 호출을 outer try/catch로 보호

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@younchanhyeok younchanhyeok merged commit 1ff13e8 into dev May 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant