Skip to content

feat: 新增 Pod_ContainerCreating 云盘 PVC 创建失败故障场景#299

Open
woyaonidish wants to merge 1 commit intomasterfrom
feature/Pod_ContainerCreating_PVC_Error
Open

feat: 新增 Pod_ContainerCreating 云盘 PVC 创建失败故障场景#299
woyaonidish wants to merge 1 commit intomasterfrom
feature/Pod_ContainerCreating_PVC_Error

Conversation

@woyaonidish
Copy link
Copy Markdown
Contributor

Describe what this PR does / why we need it

在 chaosblade-operator 中新增 Pod_ContainerCreating 故障场景,模拟云盘 PVC 创建失败(如 StorageClass 不存在)导致的 Pod 卡在 ContainerCreating 状态。

Does this pull request fix one issue?

Fixes #81818669

Describe how you did it

参考现有 containercreating.go 实现模式,新增 containercreatingdisk.go:

  • 创建错误 StorageClass 的 PVC,触发 Pod ContainerCreating
  • 支持 namespace、pvc-name、storage-class、size 四个参数
  • 遵循项目现有的 Executor 接口和 Phase 生命周期
  • 新增 13 个单元测试覆盖参数校验和元数据

Describe how to verify it

go test -race ./exec/pod/ -run ContainerCreatingDisk

Special notes for reviews

  • 资源前缀为 ccd(container-creating-disk)
  • 与 containercreating.go 结构一致,核心差异为 PVC 使用云盘 StorageClass 而非 NFS PV

Add new chaos action "containercreating-disk" to simulate Pod
ContainerCreating state caused by cloud disk PVC creation failure
due to StorageClass misconfiguration.

- New file: exec/pod/containercreatingdisk.go (437 lines)
  - PreCreate: validate namespace, storage-class parameters
  - Create: deploy error StorageClass PVC + deployment
  - Destroy: cleanup PVC and deployment
  - PreDestroy: resource cleanup preparation
  - Resource prefix: ccd
  - Parameters: namespace, storage-class, pvc-name, deploy-name
- New file: exec/pod/containercreatingdisk_test.go (233 lines)
  - 13 test cases covering ActionSpec metadata, Executor name,
    PreCreate validation (empty namespace, comma in namespace,
    empty storage-class, normal flow), PreDestroy normal flow
- Modified: exec/pod/pod.go — register containercreating-disk action

All 85 tests pass (100%), race detection clean.
goimports and gofumpt formatting verified.

Fixes #81818669

Signed-off-by: woyaonidish <jiangzelin.jzl@alibaba-inc.com>
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