Skip to content

fix(copaw): fall back to static mc alias in local k8s mode - #1097

Open
RerankerGuo wants to merge 1 commit into
agentscope-ai:mainfrom
RerankerGuo:fix/issue-957-k8s-copaw-worker-alias
Open

fix(copaw): fall back to static mc alias in local k8s mode#1097
RerankerGuo wants to merge 1 commit into
agentscope-ai:mainfrom
RerankerGuo:fix/issue-957-k8s-copaw-worker-alias

Conversation

@RerankerGuo

Copy link
Copy Markdown
Contributor

Summary

This PR fixes #957 by adding a fallback path in _ensure_alias() for local K8s deployments with self-hosted MinIO.

Problem

In v1.1.2, commit fc1b934 added k8s mode detection that unconditionally skipped mc alias setup when AGENTTEAMS_RUNTIME=k8s. This assumed mc-wrapper.sh would always provide STS credentials via MC_HOST_* environment variables. However, this assumption only holds for Aliyun cloud deployments (RRSA/STS).

In local K8s deployments with self-hosted MinIO:

  1. HICLAW_RUNTIME=k8s → k8s mode = True → alias setup skipped
  2. mc-wrapper.sh does not set MC_HOST_hiclaw (no STS provider)
  3. mc mirror hiclaw/... fails with alias not found
  4. copaw-worker startup fails

Fix

When AGENTTEAMS_RUNTIME=k8s, check if MC_HOST_{alias} is already set:

  • If set (cloud STS mode): skip alias setup as before
  • If not set (local K8s): fall through to the static mc alias set path

Changes

  • copaw/src/copaw_worker/sync.py: Modified _ensure_alias() to conditionally skip in k8s mode
  • copaw/tests/test_sync.py: Added 3 unit tests covering:
    1. k8s + MC_HOST set → skip static (cloud STS)
    2. k8s + MC_HOST not set → fall through to static (local MinIO)
    3. non-k8s → use static (unchanged behavior)

Testing

  • pytest tests/test_sync.py::test_ensure_alias_k8s_with_mc_host_set_skips_static PASSED
  • pytest tests/test_sync.py::test_ensure_alias_k8s_without_mc_host_falls_through_static PASSED
  • pytest tests/test_sync.py::test_ensure_alias_non_k8s_uses_static PASSED

Closes agentscope-ai#957
- When AGENTTEAMS_RUNTIME=k8s, check if MC_HOST_{alias} is already
  set by the cloud STS path before skipping the alias setup
- If MC_HOST is not set (local K8s with self-hosted MinIO), fall
  through to the static mc alias set path
- Prevents copaw-worker startup failure in local K8s deployments
  where mc-wrapper does not provide STS credentials
- Add 3 unit tests covering all k8s/non-k8s MC_HOST scenarios

Test: pytest tests/test_sync.py (3 new tests pass)
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@RerankerGuo
RerankerGuo force-pushed the fix/issue-957-k8s-copaw-worker-alias branch from 38fdd52 to dd683e5 Compare July 30, 2026 00:53
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.

在k8s环境下hiclaw-controller:v1.1.1部署hiclaw-copaw-worker:v1.1.2启动失败

1 participant