feat(b0): B-0 을 주입부터 원상복구까지 끝까지 밟는다 — setup 35편 완주

남아 있던 한 편이다. keycloak-pattern 에 이 실험과 무관한 변경이 39개(미추적
3개 더) 있어 따로 떼어낸 작업 트리에서 파일 넷을 고치고 이미지를 구워 두
노드에 넣었다. 원래 작업 트리는 한 글자도 안 바뀌었다.

자동구성이 고른 것
- 빈 321개 — 이 편이 예측한 숫자와 같다
- authorizedClientService -> InMemoryOAuth2AuthorizedClientService
- SessionRepository 빈이 하나도 없다. Spring Session 이 아예 안 걸렸고
  세션을 톰캣이 자기 메모리의 HttpSession 에 직접 들고 있다
- 타입에 Redis 나 Jdbc 가 든 빈 0개

로그인이 replica 개수에서 갈린다
- 원 가이드는 브라우저로 한 번 해 보라고 적는데 그러면 한 번의 결과만 남는다.
  쿠키 병을 쓰는 curl 로 같은 흐름을 여섯 번씩 돌려 양쪽을 같은 수로 견줬다
- replica 2 — 여섯 번 다 /login?error
- replica 1 — 여섯 번 다 200. 이쪽이 대조군이라, 거기서도 실패했으면 가설이
  아니라 시험 방법을 의심해야 한다
- 토큰 경계는 원래 실행과 한 글자도 다르지 않았다

원상복구를 같은 명령으로 확인했다
- 빈 321 → 437, InMemory → Jdbc, Redis/Jdbc 빈 0 → 58, Redis 세션 키 6
- replica 2 에서 로그인이 다시 되는 것이 복구 판정이다

그리고 ⑤ 의 `git diff --stat` 점검은 작업 트리가 깨끗할 때만 성립한다는 것을
적었다. git worktree 로 떼어내면 그 점검이 다시 살아난다.

관문: check_body PASS · check_prose error 0 · check_evidence 문제 없음 ·
verify-tech-log-tree error 0 · verify-project-layout error 0 · 코드펜스 전수 0건

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-17 20:16:45 +09:00
co-authored by Claude Opus 5
parent bbd87dc9ab
commit 7661f08d58
13 changed files with 215 additions and 13 deletions
@@ -265,3 +265,13 @@ d4-01-before-force-renewal.txt / d4-02-force-renewal.txt / d4-03-after-force-ren
03 = 친 뒤의 같은 세 가지 + 세 이름의 HTTPS 응답.
serial 06F3E0EF…1373 → 065547991777…3DF1, notAfter Dec 3 → Dec 16,
worker 2629 4712 → 4745 4754. 갱신이 서빙까지 닿았다는 근거.
b0-04-image-push.txt … b0-12-revert-checklist.txt
B-0 을 2026-09-17 에 주입부터 원상복구까지 끝까지 밟은 기록.
04 = 두 노드에 이미지 import · 05 = 배포와 롤아웃
06·07 = 파드 안에서 받은 빈 목록과 자동구성이 고른 구현
(빈 321개 · InMemoryOAuth2AuthorizedClientService · SessionRepository 없음)
08 = replica 2 에서 로그인 6회 — 전부 /login?error
09 = replica 1 로 줄여 같은 시험 6회 — 전부 200 (대조군)
10 = 로그인 뒤 /bff/token-boundary
11·12 = 이미지와 매니페스트를 되돌리고 replica 2 에서 로그인이 다시 되는 것까지 확인
(빈 437개 · JdbcOAuth2AuthorizedClientService · Redis 세션 키 6)
@@ -0,0 +1,3 @@
=== 4. 두 노드의 이미지 목록 ===
docker.io/library/keycloak-pattern-bff:lab application/vnd.oci.image.index.v1+json sha256:ef0bd8559b22fe81bc98ebf6462cfef7f42706586528b15a31e86f10b45acbe4 96.5 MiB linux/amd64 io.cri-containerd.image=managed
docker.io/library/keycloak-pattern-bff:lab application/vnd.oci.image.index.v1+json sha256:ef0bd8559b22fe81bc98ebf6462cfef7f42706586528b15a31e86f10b45acbe4 96.5 MiB linux/amd64 io.cri-containerd.image=managed
@@ -0,0 +1,10 @@
Waiting for deployment "bff" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "bff" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "bff" rollout to finish: 2 old replicas are pending termination...
Waiting for deployment "bff" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "bff" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "bff" rollout to finish: 1 old replicas are pending termination...
deployment "bff" successfully rolled out
bff-5d97897676-zvfhp 0/1 Error 0 4h48m 10.42.1.51 kc-lab-2 <none> <none>
bff-6d59c54797-2wnzn 1/1 Running 0 44s 10.42.0.40 kc-lab-1 <none> <none>
bff-6d59c54797-72cch 1/1 Running 0 21s 10.42.1.94 kc-lab-2 <none> <none>
@@ -0,0 +1,5 @@
=== 관찰 1 — 파드 안에서 빈 목록을 받는다 ===
BFF=bff-6d59c54797-2wnzn
117450 /tmp/beans-b0.json
--- 저장소 계열 빈 ---
OAuth2AuthorizedClientManager
@@ -0,0 +1,26 @@
=== 관찰 2 — 빈을 세고 저장소 관련 이름을 뽑는다 ===
--- 빈 개수 ---
321
--- 세션 저장소로 무엇을 골랐나 ---
--- authorized client service 는 무엇인가 ---
"aliases":[],"scope":"singleton","type":"org.springframework.security.oauth2.client.web.AuthenticatedPrincipalOAuth2AuthorizedClientRepository","resource":"class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientWebSecurityAutoConfiguration.class]","dependencies":["org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientWebSecurityAutoConfiguration","authorizedClientService"]},"enableGlobalAuthenticationAutowiredConfigurer":
"aliases":[],"scope":"singleton","type":"org.springframework.web.util.UrlPathHelper","resource":"class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]","dependencies":["org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration"]},"org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientConfigurations$OAuth2AuthorizedClientServiceConfiguration":
"aliases":[],"scope":"singleton","type":"org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientConfigurations$OAuth2AuthorizedClientServiceConfiguration","dependencies":[]},"org.springframework.boot.actuate.autoconfigure.metrics.startup.StartupTimeMetricsListenerAutoConfiguration":
"aliases":[],"scope":"singleton","type":"com.example.keycloakpattern.bff.BffController","resource":"URL [jar:nested:/app/app.jar/!BOOT-INF/classes/!/com/example/keycloakpattern/bff/BffController.class]","dependencies":["authorizedClientService","OAuth2AuthorizedClientManager","restClientBuilder"]},"org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat":
"aliases":[],"scope":"singleton","type":"org.springframework.boot.task.ThreadPoolTaskSchedulerBuilder","resource":"class path resource [org/springframework/boot/autoconfigure/task/TaskSchedulingConfigurations$ThreadPoolTaskSchedulerBuilderConfiguration.class]","dependencies":["org.springframework.boot.autoconfigure.task.TaskSchedulingConfigurations$ThreadPoolTaskSchedulerBuilderConfiguration","spring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingProperties"]},"authorizedClientService":
--- Redis / Jdbc 흔적이 남았나 ---
0
0
=== authorizedClientService 의 실제 구현 ===
File "<stdin>", line 7
if n in beans: print(f"{n}: {beans[n][\"type\"]}")
^
SyntaxError: unexpected character after line continuation character
빈 개수: 321
authorizedClientService -> org.springframework.security.oauth2.client.InMemoryOAuth2AuthorizedClientService
OAuth2AuthorizedClientManager -> org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizedClientManager
authorizedClientRepository -> org.springframework.security.oauth2.client.web.AuthenticatedPrincipalOAuth2AuthorizedClientRepository
--- SessionRepository 계열 ---
없다 — Spring Session 이 안 걸렸다
--- 타입에 Redis 나 Jdbc 가 든 빈 ---
없다
@@ -0,0 +1,6 @@
1 https://app1.hyeonworks.com/login?error 200
2 https://app1.hyeonworks.com/login?error 200
3 https://app1.hyeonworks.com/login?error 200
4 https://app1.hyeonworks.com/login?error 200
5 https://app1.hyeonworks.com/login?error 200
6 https://app1.hyeonworks.com/login?error 200
@@ -0,0 +1,13 @@
=== 4. replica 를 1 로 줄인다 ===
deployment.apps/bff scaled
deployment "bff" successfully rolled out
bff-6d59c54797-2wnzn 1/1 Running 0 107s
bff-6d59c54797-72cch 1/1 Terminating 0 84s
=== 같은 시험을 replica 1 에서 ===
1 https://app1.hyeonworks.com/ 200
2 https://app1.hyeonworks.com/ 200
3 https://app1.hyeonworks.com/ 200
4 https://app1.hyeonworks.com/ 200
5 https://app1.hyeonworks.com/ 200
6 https://app1.hyeonworks.com/ 200
@@ -0,0 +1,3 @@
로그인 뒤 주소: https://app1.hyeonworks.com/
--- /bff/token-boundary ---
{"pattern":"AP3-backend-for-frontend","principal":"labuser","accessTokenStoredOnServer":true,"refreshTokenStoredOnServer":true,"browserTokenCount":0,"csrfProtectionEnabled":true}
@@ -0,0 +1,23 @@
=== 복구 1. replica 를 되돌린다 ===
deployment.apps/bff scaled
=== 복구 2. 소스(이미지)를 되돌린다 ===
Importing elapsed: 6.3 s total: 0.0 B (0.0 B/s)
Importing elapsed: 5.5 s total: 0.0 B (0.0 B/s)
secret/bff-secrets configured
persistentvolumeclaim/redis-data unchanged
deployment.apps/redis unchanged
service/redis unchanged
deployment.apps/bff configured
service/bff unchanged
ingress.networking.k8s.io/bff unchanged
deployment.apps/bff restarted
Waiting for deployment "bff" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "bff" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "bff" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "bff" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "bff" rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment "bff" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "bff" rollout to finish: 1 old replicas are pending termination...
Waiting for deployment "bff" rollout to finish: 1 old replicas are pending termination...
deployment "bff" successfully rolled out
@@ -0,0 +1,18 @@
=== 원상복구 확인표 ===
--- 파드 ---
bff-6588776c5-fmv5g 1/1 Running 0 49s 10.42.1.96 kc-lab-2 <none> <none>
bff-6588776c5-j9ldm 1/1 Running 0 28s 10.42.0.41 kc-lab-1 <none> <none>
--- Redis 세션 키가 다시 생기나 (B-1 구성으로 돌아왔다는 뜻) ---
--- replica 2 에서 로그인이 다시 되는가 (복구 판정) ---
1 https://app1.hyeonworks.com/ 200
2 https://app1.hyeonworks.com/ 200
3 https://app1.hyeonworks.com/ 200
4 https://app1.hyeonworks.com/ 200
5 https://app1.hyeonworks.com/ 200
6 https://app1.hyeonworks.com/ 200
--- 로그인 여섯 번 뒤의 Redis 세션 키 ---
6
--- 빈 목록이 B-1·B-2 로 돌아왔나 ---
빈 개수: 437
authorizedClientService -> org.springframework.security.oauth2.client.JdbcOAuth2AuthorizedClientService
Redis/Jdbc 타입 빈: 58