Skip to content
Merged
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
12 changes: 8 additions & 4 deletions scripts/deploy-rolling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,20 @@ set_drain() {
--network-load-balancer-id "$NLB_ID" \
--backend-set-name snackgame-http \
--backend-name "$HTTP_BACKEND" \
--is-drain "$is_drain" \
--wait-for-state SUCCEEDED
--is-drain "$is_drain"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

oci nlb backend update 명령에서 --wait-for-state SUCCEEDED--force 옵션을 제거하면 두 가지 주요 위험이 발생합니다.

  1. 경합 조건 (Race Condition): 첫 번째 명령(http)이 완료되기 전에 두 번째 명령(https)이 실행되면, 동일한 NLB 리소스에 대한 동시 업데이트 시도로 인해 409 Conflict 오류가 발생할 수 있습니다. OCI API는 일반적으로 동일 리소스에 대한 병렬 수정을 허용하지 않습니다.
  2. 자동화 중단: --force 옵션이 없으면 CLI가 특정 상황에서 사용자 확인을 요청할 수 있어, 비대화형(non-interactive) 환경에서 스크립트가 중단될 수 있습니다.

가급적이면 해당 옵션들을 유지하여 안정성을 확보하는 것이 좋습니다.

Suggested change
--is-drain "$is_drain"
--is-drain "$is_drain" \
--wait-for-state SUCCEEDED \
--force


oci nlb backend update \
--auth instance_principal \
--network-load-balancer-id "$NLB_ID" \
--backend-set-name snackgame-https \
--backend-name "$HTTPS_BACKEND" \
--is-drain "$is_drain" \
--wait-for-state SUCCEEDED
--is-drain "$is_drain"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

위의 http 백엔드 설정과 마찬가지로, https 백엔드 업데이트 시에도 --wait-for-state SUCCEEDED--force 옵션을 유지하는 것이 안전합니다. 특히 --wait-for-state는 이어지는 if 문이나 다음 배포 단계로 넘어가기 전에 설정이 확실히 반영되었음을 보장합니다.

Suggested change
--is-drain "$is_drain"
--is-drain "$is_drain" \
--wait-for-state SUCCEEDED \
--force



if [ "$is_drain" = "true" ]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

현재 로직은 is_draintrue일 때만 10초를 대기합니다. 하지만 서비스를 다시 활성화(is_drain=false)할 때도 --wait-for-state 옵션이 제거되었기 때문에, NLB가 백엔드 설정을 완전히 반영하기 전에 스크립트가 종료될 수 있습니다.

롤링 배포 환경에서 이전 서버가 아직 NLB에 복구되지 않은 상태에서 다음 서버의 배포(및 드레인)가 시작되면 전체 서비스 가용성에 영향을 줄 수 있습니다. is_drain 값과 관계없이 상태 변경이 완료될 때까지 기다리거나, false인 경우에도 적절한 대기 시간을 갖는 것을 권장합니다.

echo "[NLB] 드레인 적용 대기 중 (10초)..."
sleep 10
fi
}


Expand Down
Loading