ark-controller-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ark Controller Development

Ark Controller 开发指南

Guidance for developing the Ark Kubernetes operator in
ark/
.
本指南针对
ark/
目录下的Ark Kubernetes Operator开发提供指导。

When to use this skill

适用场景

  • Modifying Go type definitions (
    api/v1alpha1/*_types.go
    )
  • Fixing CRD/Helm chart sync errors
  • Adding new CRD fields or resources
  • 修改Go类型定义(
    api/v1alpha1/*_types.go
  • 修复CRD/Helm Chart同步错误
  • 添加新的CRD字段或资源

CRD Generation Flow

CRD生成流程

api/v1alpha1/*_types.go     # Go types with markers
    make manifests          # Generates CRDs and syncs to Helm chart
config/crd/bases/*.yaml     # Source CRDs (auto-generated)
dist/chart/templates/crd/   # Helm chart CRDs (auto-synced)
make manifests
automatically syncs source CRDs to the Helm chart while preserving templated headers.
api/v1alpha1/*_types.go     # 带有标记的Go类型
    make manifests          # 生成CRD并同步到Helm Chart
config/crd/bases/*.yaml     # 源CRD(自动生成)
dist/chart/templates/crd/   # Helm Chart中的CRD(自动同步)
make manifests
会自动将源CRD同步到Helm Chart,同时保留模板化的头部信息。

Fixing "CRDs out of sync" Errors

修复「CRD不同步」错误

When
make build
fails with CRD validation errors:
bash
cd ark
make manifests
make build
make build
因CRD验证失败时:
bash
cd ark
make manifests
make build

Key Directories

关键目录

DirectoryPurpose
api/v1alpha1/
Go type definitions
config/crd/bases/
Auto-generated source CRDs
dist/chart/templates/crd/
Helm chart CRDs (auto-synced)
internal/controller/
Reconciliation logic
internal/webhook/
Admission webhooks
internal/genai/
AI/ML execution logic
目录用途
api/v1alpha1/
Go类型定义
config/crd/bases/
自动生成的源CRD
dist/chart/templates/crd/
Helm Chart中的CRD(自动同步)
internal/controller/
协调逻辑
internal/webhook/
准入Webhook
internal/genai/
AI/ML执行逻辑

Common Tasks

常见任务

After Modifying Types or Comments

修改类型或注释后

Go type comments become CRD field descriptions:
bash
cd ark
make manifests
make build
Go类型注释会成为CRD字段描述:
bash
cd ark
make manifests
make build

After Any Go Code Change

任何Go代码变更后

bash
make lint-fix    # Format and fix linting
make build       # Build and validate
bash
make lint-fix    # 格式化并修复代码规范问题
make build       # 构建并验证