{"owner":"openkruise","repo":"kruise","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md"],"skills":{"AGENTS.md":"# AGENTS.md\n\nGuidance for AI agents working on the OpenKruise project.\n\n## Project Overview\n\nOpenKruise is a CNCF incubating project that extends Kubernetes with advanced workload management. It runs as a set of custom controllers and CRDs on top of Kubernetes, providing five functional domains:\n\n- **Advanced Workloads**: CloneSet, AdvancedStatefulSet, BroadcastJob, AdvancedCronJob, DaemonSet, EphemeralJob\n- **Sidecar Container Management**: SidecarSet, Container Launch Priority, SidecarTerminator\n- **Multi-domain Management**: WorkloadSpread, UnitedDeployment\n- **Enhanced Operations**: ContainerRecreateRequest, ImagePullJob, ImageListPullJob, ResourceDistribution, PodProbeMarker, NodeImage\n- **Application Protection**: DeletionProtection, PodUnavailableBudget, PersistentPodState\n\n| Key | Value                                                                        |\n|-----|------------------------------------------------------------------------------|\n| Module | `github.com/openkruise/kruise`                                               |\n| Language | Go 1.23+                                                                     |\n| K8s Libraries | v0.32.10                                                                     |\n| controller-runtime | v0.20.2                                                                      |\n| controller-tools | v0.17.3                                                                      |\n| API Groups | `apps.kruise.io` (workloads and operations), `policy.kruise.io` (protection) |\n| K8s Compatibility | v1.18+ (v1.28+ recommended)                                                  |\n| License | Apache 2.0                                                                   |\n\n## Project Structure\n\n```\n.\n├── main.go                  # kruise-manager entry point\n├── apis/                    # API type definitions (CRD specs)\n│   ├── apps/\n│   │   ├── pub/             # Shared types (lifecycle, launch_priority, etc.)\n│   │   ├── v1alpha1/        # v1alpha1 API types\n│   │   └── v1beta1/         # v1beta1 API types (StatefulSet)\n│   └── policy/v1alpha1/     # Policy API types (DeletionProtection)\n├── pkg/\n│   ├── controller/          # Controller implementations per workload type\n│   ├── webhook/             # Admission webhook handlers (validating/mutating)\n│   ├── daemon/              # Kruise-daemon (node agent, gRPC + CRI)\n│   ├── control/             # Shared control logic (pubcontrol, sidecarcontrol)\n│   ├── util/                # Utilities (expectations, feature gates, cache, etc.)\n│   ├── client/              # Generated clientset, informer, lister [DO NOT EDIT]\n│   └── features/            # Feature gate definitions\n├── cmd/\n│   ├── daemon/              # Kruise-daemon entry point\n│   └── helm_hook/           # Helm hook binary\n├── config/                  # Kustomize overlays (CRD, RBAC, webhook, manager)\n├── test/\n│   ├── e2e/                 # End-to-end tests (ginkgo/gomega)\n│   └── fuzz/                # Fuzz tests\n├── scripts/                 # Build and code generation scripts\n├── hack/                    # Dev scripts (fmt-imports, boilerplate)\n└── docs/                    # Documentation, proposals, contributing guides\n```\n\n## Commands\n\n### Build & Generate\n\n| Command | Description |\n|---------|-------------|\n| `make build` | Build `bin/manager` (runs generate + fmt + vet + manifests first) |\n| `make generate` | Regenerate DeepCopy, clientset, informer, lister, OpenAPI |\n| `make manifests` | Regenerate CRD YAML and RBAC manifests |\n| `make generate_helm_crds` | Regenerate CRDs for Helm charts into `bin/` |\n| `make docker-build` | Build Docker image `openkruise/kruise-manager:test` |\n| `make docker-multiarch` | Build multi-arch image (amd64/arm64/ppc64le) |\n\n### Test\n\n| Command | Description |\n|---------|-------------|\n| `make test` | Unit tests with race detector + coverage (envtest K8s 1.32.0) |\n| `make atest` | Same as `test` but skips generate/fmt/vet/manifests |\n| `make kruise-e2e-test` | Full e2e: kind cluster + build + install + test + cleanup |\n| `make coverage-report` | Generate `cover.html` from `cover.out` |\n\n### Lint & Format\n\n| Command | Description |\n|---------|-------------|\n| `make lint` | golangci-lint (v1.51.2, config: `.golangci.yml`) |\n| `make vet` | `go vet` |\n| `make fmt` | `go fmt` |\n| `make fmt-imports` | goimports with local prefix grouping |\n| `typos --config typos.toml` | Spell check |\n\n## Code Style and Conventions\n\n### Error Handling\n- **Forbidden**: `github.com/pkg/errors` (enforced by depguard linter)\n- **Use instead**: `fmt.Errorf(\"context: %w\", err)` for wrapping\n\n### Import Ordering\nUse `goimports` with local prefix `github.com/openkruise/kruise`. Groups in order:\n1. Standard library (`fmt`, `os`, `context`, ...)\n2. Third-party (`github.com/...`)\n3. Kubernetes (`k8s.io/...`, `sigs.k8s.io/...`)\n4. OpenKruise (`github.com/openkruise/kruise/...`)\n\nBlank imports must have a comment explaining the side effect.\n\n### Boilerplate\nAll `.go` files must include the Apache 2.0 license header from `hack/boilerplate.go.txt`.\n\n### Spelling\nUS English locale (enforced by misspell linter).\n\n### Generated Code (DO NOT EDIT)\n- `pkg/client/` — generated clientset, informer, lister\n- `apis/*/zz_generated.deepcopy.go` — generated DeepCopy methods\n- `apis/*/openapi_generated.go` — generated OpenAPI specs\n- `config/crd/bases/` — generated CRD YAML files\n\nRegenerate with `make generate && make manifests`.\n\n## Architecture Patterns\n\n### Controller\n- Each workload has its own package under `pkg/controller/<workload>/` with an `Add(mgr manager.Manager) error` entry point, registered in `pkg/controller/controllers.go`\n- **Reconcile loops must be idempotent**: reprocessing the same event must produce the same result. Do not assume single execution\n- Use expectation tracking (`pkg/util/expectations/`) to coordinate resource creation/deletion and avoid race conditions\n- Use `Status().Update()` / `Status().Patch()` for status updates, not full resource updates\n- Do not perform heavy operations (locking, blocking I/O) in event handlers; move them into the reconcile loop\n- Check `deletionTimestamp` and handle finalizer cleanup before applying business logic\n- Use `observedGeneration` in status to track whether the controller has processed the latest spec\n\n### Webhook\n- Each workload has handlers under `pkg/webhook/<workload>/`, registered via `pkg/webhook/add_<workload>.go`\n- Webhooks should only do simple mutation and validation — move heavy operations into the controller reconcile loop\n- Mutating webhooks: handle CREATE and UPDATE separately\n- Validating webhooks: return clear, informative error messages on rejection\n- Never panic in webhook handlers; recover and return `Allowed: false`\n\n### Daemon (Kruise-Daemon)\n- Runs as a node agent (`pkg/daemon/`), handling image pulling, container recreation, and pod probes via gRPC\n- Communicates with the container runtime through CRI interface only — do not talk directly to Kubelet, Docker, or Containerd\n- Should only access node-local Kubernetes resources or resources in the system namespace\n- Entry point: `cmd/daemon/main.go`\n\n### Feature Gates\n- New features must be gated via `pkg/features/kruise_features.go` using `utilfeature.DefaultMutableFeatureGate`\n- Feature gates must have unit tests behind the gate\n\n## Code Generation Workflow\n\nWhen modifying API types under `apis/`:\n\n```\n1. Edit types in apis/apps/v1alpha1/ or apis/apps/v1beta1/\n2. make generate        # DeepCopy, clientset, informer, lister, OpenAPI\n3. make manifests       # CRD YAML, RBAC\n```\n\nWhen adding a new API type or controller:\n\n```\n1. Define types in apis/apps/v1alpha1/<type>_types.go\n2. Register scheme in apis/addtoscheme_apps_v1alpha1.go (or v1beta1)\n3. Register controller in pkg/controller/controllers.go\n4. Register webhook in pkg/webhook/add_<type>.go\n5. make generate && make manifests\n```\n\n## Behavioral Rules\n\n- Import order need matching goimports local prefix convention\n- Don't perform blocking or locking operations in controller event handlers instead of the reconcile loop\n- Don't Access cluster-scoped resources from daemon code\n- Read related files before modifying code\n- Don't edit `client/`, `proto/`, `config/crd/` — run `make generate` or `make manifests` instead\n- After modifying `api/`, run `make generate manifests`\n- Don't delete comments unless outdated\n- New `.go` files need Apache 2.0 license header from `hack/boilerplate.go.txt`\n- Use `Expectations` (`pkg/utils/expectations/`) for slow informer cache issues\n- New APIs/architectural changes need proposal in `docs/proposals/`\n- Ask user when unsure about business logic\n- Always edit the files on your own, never use automation tools or scripts\n- All comments must be in English\n- Always commit with sign-off (e.g. `git commit -s`)\n"},"files":{"AGENTS.md":"# AGENTS.md\n\nGuidance for AI agents working on the OpenKruise project.\n\n## Project Overview\n\nOpenKruise is a CNCF incubating project that extends Kubernetes with advanced workload management. It runs as a set of custom controllers and CRDs on top of Kubernetes, providing five functional domains:\n\n- **Advanced Workloads**: CloneSet, AdvancedStatefulSet, BroadcastJob, AdvancedCronJob, DaemonSet, EphemeralJob\n- **Sidecar Container Management**: SidecarSet, Container Launch Priority, SidecarTerminator\n- **Multi-domain Management**: WorkloadSpread, UnitedDeployment\n- **Enhanced Operations**: ContainerRecreateRequest, ImagePullJob, ImageListPullJob, ResourceDistribution, PodProbeMarker, NodeImage\n- **Application Protection**: DeletionProtection, PodUnavailableBudget, PersistentPodState\n\n| Key | Value                                                                        |\n|-----|------------------------------------------------------------------------------|\n| Module | `github.com/openkruise/kruise`                                               |\n| Language | Go 1.23+                                                                     |\n| K8s Libraries | v0.32.10                                                                     |\n| controller-runtime | v0.20.2                                                                      |\n| controller-tools | v0.17.3                                                                      |\n| API Groups | `apps.kruise.io` (workloads and operations), `policy.kruise.io` (protection) |\n| K8s Compatibility | v1.18+ (v1.28+ recommended)                                                  |\n| License | Apache 2.0                                                                   |\n\n## Project Structure\n\n```\n.\n├── main.go                  # kruise-manager entry point\n├── apis/                    # API type definitions (CRD specs)\n│   ├── apps/\n│   │   ├── pub/             # Shared types (lifecycle, launch_priority, etc.)\n│   │   ├── v1alpha1/        # v1alpha1 API types\n│   │   └── v1beta1/         # v1beta1 API types (StatefulSet)\n│   └── policy/v1alpha1/     # Policy API types (DeletionProtection)\n├── pkg/\n│   ├── controller/          # Controller implementations per workload type\n│   ├── webhook/             # Admission webhook handlers (validating/mutating)\n│   ├── daemon/              # Kruise-daemon (node agent, gRPC + CRI)\n│   ├── control/             # Shared control logic (pubcontrol, sidecarcontrol)\n│   ├── util/                # Utilities (expectations, feature gates, cache, etc.)\n│   ├── client/              # Generated clientset, informer, lister [DO NOT EDIT]\n│   └── features/            # Feature gate definitions\n├── cmd/\n│   ├── daemon/              # Kruise-daemon entry point\n│   └── helm_hook/           # Helm hook binary\n├── config/                  # Kustomize overlays (CRD, RBAC, webhook, manager)\n├── test/\n│   ├── e2e/                 # End-to-end tests (ginkgo/gomega)\n│   └── fuzz/                # Fuzz tests\n├── scripts/                 # Build and code generation scripts\n├── hack/                    # Dev scripts (fmt-imports, boilerplate)\n└── docs/                    # Documentation, proposals, contributing guides\n```\n\n## Commands\n\n### Build & Generate\n\n| Command | Description |\n|---------|-------------|\n| `make build` | Build `bin/manager` (runs generate + fmt + vet + manifests first) |\n| `make generate` | Regenerate DeepCopy, clientset, informer, lister, OpenAPI |\n| `make manifests` | Regenerate CRD YAML and RBAC manifests |\n| `make generate_helm_crds` | Regenerate CRDs for Helm charts into `bin/` |\n| `make docker-build` | Build Docker image `openkruise/kruise-manager:test` |\n| `make docker-multiarch` | Build multi-arch image (amd64/arm64/ppc64le) |\n\n### Test\n\n| Command | Description |\n|---------|-------------|\n| `make test` | Unit tests with race detector + coverage (envtest K8s 1.32.0) |\n| `make atest` | Same as `test` but skips generate/fmt/vet/manifests |\n| `make kruise-e2e-test` | Full e2e: kind cluster + build + install + test + cleanup |\n| `make coverage-report` | Generate `cover.html` from `cover.out` |\n\n### Lint & Format\n\n| Command | Description |\n|---------|-------------|\n| `make lint` | golangci-lint (v1.51.2, config: `.golangci.yml`) |\n| `make vet` | `go vet` |\n| `make fmt` | `go fmt` |\n| `make fmt-imports` | goimports with local prefix grouping |\n| `typos --config typos.toml` | Spell check |\n\n## Code Style and Conventions\n\n### Error Handling\n- **Forbidden**: `github.com/pkg/errors` (enforced by depguard linter)\n- **Use instead**: `fmt.Errorf(\"context: %w\", err)` for wrapping\n\n### Import Ordering\nUse `goimports` with local prefix `github.com/openkruise/kruise`. Groups in order:\n1. Standard library (`fmt`, `os`, `context`, ...)\n2. Third-party (`github.com/...`)\n3. Kubernetes (`k8s.io/...`, `sigs.k8s.io/...`)\n4. OpenKruise (`github.com/openkruise/kruise/...`)\n\nBlank imports must have a comment explaining the side effect.\n\n### Boilerplate\nAll `.go` files must include the Apache 2.0 license header from `hack/boilerplate.go.txt`.\n\n### Spelling\nUS English locale (enforced by misspell linter).\n\n### Generated Code (DO NOT EDIT)\n- `pkg/client/` — generated clientset, informer, lister\n- `apis/*/zz_generated.deepcopy.go` — generated DeepCopy methods\n- `apis/*/openapi_generated.go` — generated OpenAPI specs\n- `config/crd/bases/` — generated CRD YAML files\n\nRegenerate with `make generate && make manifests`.\n\n## Architecture Patterns\n\n### Controller\n- Each workload has its own package under `pkg/controller/<workload>/` with an `Add(mgr manager.Manager) error` entry point, registered in `pkg/controller/controllers.go`\n- **Reconcile loops must be idempotent**: reprocessing the same event must produce the same result. Do not assume single execution\n- Use expectation tracking (`pkg/util/expectations/`) to coordinate resource creation/deletion and avoid race conditions\n- Use `Status().Update()` / `Status().Patch()` for status updates, not full resource updates\n- Do not perform heavy operations (locking, blocking I/O) in event handlers; move them into the reconcile loop\n- Check `deletionTimestamp` and handle finalizer cleanup before applying business logic\n- Use `observedGeneration` in status to track whether the controller has processed the latest spec\n\n### Webhook\n- Each workload has handlers under `pkg/webhook/<workload>/`, registered via `pkg/webhook/add_<workload>.go`\n- Webhooks should only do simple mutation and validation — move heavy operations into the controller reconcile loop\n- Mutating webhooks: handle CREATE and UPDATE separately\n- Validating webhooks: return clear, informative error messages on rejection\n- Never panic in webhook handlers; recover and return `Allowed: false`\n\n### Daemon (Kruise-Daemon)\n- Runs as a node agent (`pkg/daemon/`), handling image pulling, container recreation, and pod probes via gRPC\n- Communicates with the container runtime through CRI interface only — do not talk directly to Kubelet, Docker, or Containerd\n- Should only access node-local Kubernetes resources or resources in the system namespace\n- Entry point: `cmd/daemon/main.go`\n\n### Feature Gates\n- New features must be gated via `pkg/features/kruise_features.go` using `utilfeature.DefaultMutableFeatureGate`\n- Feature gates must have unit tests behind the gate\n\n## Code Generation Workflow\n\nWhen modifying API types under `apis/`:\n\n```\n1. Edit types in apis/apps/v1alpha1/ or apis/apps/v1beta1/\n2. make generate        # DeepCopy, clientset, informer, lister, OpenAPI\n3. make manifests       # CRD YAML, RBAC\n```\n\nWhen adding a new API type or controller:\n\n```\n1. Define types in apis/apps/v1alpha1/<type>_types.go\n2. Register scheme in apis/addtoscheme_apps_v1alpha1.go (or v1beta1)\n3. Register controller in pkg/controller/controllers.go\n4. Register webhook in pkg/webhook/add_<type>.go\n5. make generate && make manifests\n```\n\n## Behavioral Rules\n\n- Import order need matching goimports local prefix convention\n- Don't perform blocking or locking operations in controller event handlers instead of the reconcile loop\n- Don't Access cluster-scoped resources from daemon code\n- Read related files before modifying code\n- Don't edit `client/`, `proto/`, `config/crd/` — run `make generate` or `make manifests` instead\n- After modifying `api/`, run `make generate manifests`\n- Don't delete comments unless outdated\n- New `.go` files need Apache 2.0 license header from `hack/boilerplate.go.txt`\n- Use `Expectations` (`pkg/utils/expectations/`) for slow informer cache issues\n- New APIs/architectural changes need proposal in `docs/proposals/`\n- Ask user when unsure about business logic\n- Always edit the files on your own, never use automation tools or scripts\n- All comments must be in English\n- Always commit with sign-off (e.g. `git commit -s`)\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","title":"AGENTS.md","content":"# AGENTS.md\n\nGuidance for AI agents working on the OpenKruise project.\n\n## Project Overview\n\nOpenKruise is a CNCF incubating project that extends Kubernetes with advanced workload management. It runs as a set of custom controllers and CRDs on top of Kubernetes, providing five functional domains:\n\n- **Advanced Workloads**: CloneSet, AdvancedStatefulSet, BroadcastJob, AdvancedCronJob, DaemonSet, EphemeralJob\n- **Sidecar Container Management**: SidecarSet, Container Launch Priority, SidecarTerminator\n- **Multi-domain Management**: WorkloadSpread, UnitedDeployment\n- **Enhanced Operations**: ContainerRecreateRequest, ImagePullJob, ImageListPullJob, ResourceDistribution, PodProbeMarker, NodeImage\n- **Application Protection**: DeletionProtection, PodUnavailableBudget, PersistentPodState\n\n| Key | Value                                                                        |\n|-----|------------------------------------------------------------------------------|\n| Module | `github.com/openkruise/kruise`                                               |\n| Language | Go 1.23+                                                                     |\n| K8s Libraries | v0.32.10                                                                     |\n| controller-runtime | v0.20.2                                                                      |\n| controller-tools | v0.17.3                                                                      |\n| API Groups | `apps.kruise.io` (workloads and operations), `policy.kruise.io` (protection) |\n| K8s Compatibility | v1.18+ (v1.28+ recommended)                                                  |\n| License | Apache 2.0                                                                   |\n\n## Project Structure\n\n```\n.\n├── main.go                  # kruise-manager entry point\n├── apis/                    # API type definitions (CRD specs)\n│   ├── apps/\n│   │   ├── pub/             # Shared types (lifecycle, launch_priority, etc.)\n│   │   ├── v1alpha1/        # v1alpha1 API types\n│   │   └── v1beta1/         # v1beta1 API types (StatefulSet)\n│   └── policy/v1alpha1/     # Policy API types (DeletionProtection)\n├── pkg/\n│   ├── controller/          # Controller implementations per workload type\n│   ├── webhook/             # Admission webhook handlers (validating/mutating)\n│   ├── daemon/              # Kruise-daemon (node agent, gRPC + CRI)\n│   ├── control/             # Shared control logic (pubcontrol, sidecarcontrol)\n│   ├── util/                # Utilities (expectations, feature gates, cache, etc.)\n│   ├── client/              # Generated clientset, informer, lister [DO NOT EDIT]\n│   └── features/            # Feature gate definitions\n├── cmd/\n│   ├── daemon/              # Kruise-daemon entry point\n│   └── helm_hook/           # Helm hook binary\n├── config/                  # Kustomize overlays (CRD, RBAC, webhook, manager)\n├── test/\n│   ├── e2e/                 # End-to-end tests (ginkgo/gomega)\n│   └── fuzz/                # Fuzz tests\n├── scripts/                 # Build and code generation scripts\n├── hack/                    # Dev scripts (fmt-imports, boilerplate)\n└── docs/                    # Documentation, proposals, contributing guides\n```\n\n## Commands\n\n### Build & Generate\n\n| Command | Description |\n|---------|-------------|\n| `make build` | Build `bin/manager` (runs generate + fmt + vet + manifests first) |\n| `make generate` | Regenerate DeepCopy, clientset, informer, lister, OpenAPI |\n| `make manifests` | Regenerate CRD YAML and RBAC manifests |\n| `make generate_helm_crds` | Regenerate CRDs for Helm charts into `bin/` |\n| `make docker-build` | Build Docker image `openkruise/kruise-manager:test` |\n| `make docker-multiarch` | Build multi-arch image (amd64/arm64/ppc64le) |\n\n### Test\n\n| Command | Description |\n|---------|-------------|\n| `make test` | Unit tests with race detector + coverage (envtest K8s 1.32.0) |\n| `make atest` | Same as `test` but skips generate/fmt/vet/manifests |\n| `make kruise-e2e-test` | Full e2e: kind cluster + build + install + test + cleanup |\n| `make coverage-report` | Generate `cover.html` from `cover.out` |\n\n### Lint & Format\n\n| Command | Description |\n|---------|-------------|\n| `make lint` | golangci-lint (v1.51.2, config: `.golangci.yml`) |\n| `make vet` | `go vet` |\n| `make fmt` | `go fmt` |\n| `make fmt-imports` | goimports with local prefix grouping |\n| `typos --config typos.toml` | Spell check |\n\n## Code Style and Conventions\n\n### Error Handling\n- **Forbidden**: `github.com/pkg/errors` (enforced by depguard linter)\n- **Use instead**: `fmt.Errorf(\"context: %w\", err)` for wrapping\n\n### Import Ordering\nUse `goimports` with local prefix `github.com/openkruise/kruise`. Groups in order:\n1. Standard library (`fmt`, `os`, `context`, ...)\n2. Third-party (`github.com/...`)\n3. Kubernetes (`k8s.io/...`, `sigs.k8s.io/...`)\n4. OpenKruise (`github.com/openkruise/kruise/...`)\n\nBlank imports must have a comment explaining the side effect.\n\n### Boilerplate\nAll `.go` files must include the Apache 2.0 license header from `hack/boilerplate.go.txt`.\n\n### Spelling\nUS English locale (enforced by misspell linter).\n\n### Generated Code (DO NOT EDIT)\n- `pkg/client/` — generated clientset, informer, lister\n- `apis/*/zz_generated.deepcopy.go` — generated DeepCopy methods\n- `apis/*/openapi_generated.go` — generated OpenAPI specs\n- `config/crd/bases/` — generated CRD YAML files\n\nRegenerate with `make generate && make manifests`.\n\n## Architecture Patterns\n\n### Controller\n- Each workload has its own package under `pkg/controller/<workload>/` with an `Add(mgr manager.Manager) error` entry point, registered in `pkg/controller/controllers.go`\n- **Reconcile loops must be idempotent**: reprocessing the same event must produce the same result. Do not assume single execution\n- Use expectation tracking (`pkg/util/expectations/`) to coordinate resource creation/deletion and avoid race conditions\n- Use `Status().Update()` / `Status().Patch()` for status updates, not full resource updates\n- Do not perform heavy operations (locking, blocking I/O) in event handlers; move them into the reconcile loop\n- Check `deletionTimestamp` and handle finalizer cleanup before applying business logic\n- Use `observedGeneration` in status to track whether the controller has processed the latest spec\n\n### Webhook\n- Each workload has handlers under `pkg/webhook/<workload>/`, registered via `pkg/webhook/add_<workload>.go`\n- Webhooks should only do simple mutation and validation — move heavy operations into the controller reconcile loop\n- Mutating webhooks: handle CREATE and UPDATE separately\n- Validating webhooks: return clear, informative error messages on rejection\n- Never panic in webhook handlers; recover and return `Allowed: false`\n\n### Daemon (Kruise-Daemon)\n- Runs as a node agent (`pkg/daemon/`), handling image pulling, container recreation, and pod probes via gRPC\n- Communicates with the container runtime through CRI interface only — do not talk directly to Kubelet, Docker, or Containerd\n- Should only access node-local Kubernetes resources or resources in the system namespace\n- Entry point: `cmd/daemon/main.go`\n\n### Feature Gates\n- New features must be gated via `pkg/features/kruise_features.go` using `utilfeature.DefaultMutableFeatureGate`\n- Feature gates must have unit tests behind the gate\n\n## Code Generation Workflow\n\nWhen modifying API types under `apis/`:\n\n```\n1. Edit types in apis/apps/v1alpha1/ or apis/apps/v1beta1/\n2. make generate        # DeepCopy, clientset, informer, lister, OpenAPI\n3. make manifests       # CRD YAML, RBAC\n```\n\nWhen adding a new API type or controller:\n\n```\n1. Define types in apis/apps/v1alpha1/<type>_types.go\n2. Register scheme in apis/addtoscheme_apps_v1alpha1.go (or v1beta1)\n3. Register controller in pkg/controller/controllers.go\n4. Register webhook in pkg/webhook/add_<type>.go\n5. make generate && make manifests\n```\n\n## Behavioral Rules\n\n- Import order need matching goimports local prefix convention\n- Don't perform blocking or locking operations in controller event handlers instead of the reconcile loop\n- Don't Access cluster-scoped resources from daemon code\n- Read related files before modifying code\n- Don't edit `client/`, `proto/`, `config/crd/` — run `make generate` or `make manifests` instead\n- After modifying `api/`, run `make generate manifests`\n- Don't delete comments unless outdated\n- New `.go` files need Apache 2.0 license header from `hack/boilerplate.go.txt`\n- Use `Expectations` (`pkg/utils/expectations/`) for slow informer cache issues\n- New APIs/architectural changes need proposal in `docs/proposals/`\n- Ask user when unsure about business logic\n- Always edit the files on your own, never use automation tools or scripts\n- All comments must be in English\n- Always commit with sign-off (e.g. `git commit -s`)\n","category":"root","tokens":2205}]}