Loading...
Loading...
Compare original and translation side by side
helm-chart-buildersenior-devopscloud-securityhelm-chart-buildersenior-devopscloud-securityobserve(actual) → desired = read(spec) → diff(actual, desired) → act → update(status)
↓
requeue / doneobserve(actual) → desired = read(spec) → diff(actual, desired) → act → update(status)
↓
requeue / doneSKILL=engineering/kubernetes-operator/skills/kubernetes-operatorSKILL=engineering/kubernetes-operator/skills/kubernetes-operatorundefinedundefined--help--helpcrd_validator.pycrd_validator.pypython scripts/crd_validator.py --crd config/crd/myapp.yaml
python scripts/crd_validator.py --crd config/crd/ --format jsonspec.versions[*].subresources.statusspec.scopeNamespacedClusterspec.versions[*].schema.openAPIV3Schemax-kubernetes-preserve-unknown-fields: trueserved: truestorage: truemetav1.ConditionsAgeStatusPhasepython scripts/crd_validator.py --crd config/crd/myapp.yaml
python scripts/crd_validator.py --crd config/crd/ --format jsonspec.versions[*].subresources.statusspec.scopeNamespacedClusterspec.versions[*].schema.openAPIV3Schemax-kubernetes-preserve-unknown-fields: trueserved: truestorage: truemetav1.ConditionsAgeStatusPhasereconcile_lint.pyreconcile_lint.pypython scripts/reconcile_lint.py --controller controllers/myapp_controller.go(ctrl.Result, error)return ctrl.Result{Requeue: true}, errclient.Update()time.SleepRequeueAfterdeferIsConditionTrueSetConditionpython scripts/reconcile_lint.py --controller controllers/myapp_controller.go(ctrl.Result, error)return ctrl.Result{Requeue: true}, errclient.Update()time.SleepRequeueAfterdeferIsConditionTrueSetConditionoperator_capability_audit.pyoperator_capability_audit.pypython scripts/operator_capability_audit.py --operator-dir .python scripts/operator_capability_audit.py --operator-dir .references/tooling_landscape.md| Framework | Language | Best for | Maintenance |
|---|---|---|---|
| controller-runtime | Go | Production-grade, low-level control | Active (sig-api-machinery) |
| kubebuilder | Go | Standard scaffolding, opinionated | Active (Kubernetes SIGs) |
| operator-sdk | Go / Helm / Ansible | OpenShift / mixed-paradigm teams | Active (Red Hat) |
| metacontroller | Any (webhook-based) | Polyglot teams, avoiding Go | Less active |
| KOPF | Python | Python shops, async-first | Active (community) |
| java-operator-sdk | Java | JVM shops | Active (Red Hat / Java SIG) |
references/tooling_landscape.md| 框架 | 语言 | 适用场景 | 维护状态 |
|---|---|---|---|
| controller-runtime | Go | 生产级、底层控制 | 活跃(sig-api-machinery) |
| kubebuilder | Go | 标准脚手架、约定式 | 活跃(Kubernetes SIGs) |
| operator-sdk | Go / Helm / Ansible | OpenShift / 混合范式团队 | 活跃(Red Hat) |
| metacontroller | 任意语言(基于Webhook) | 多语言团队、避免使用Go | 活跃度较低 |
| KOPF | Python | Python技术栈、异步优先 | 活跃(社区) |
| java-operator-sdk | Java | JVM技术栈 | 活跃(Red Hat / Java SIG) |
references/crd_design.mdReadyReconcilingDegradedv1alpha1v1beta1v1additionalPrinterColumnskubectl getAgePhaseReadyreferences/crd_design.mdReadyReconcilingDegradedv1alpha1v1beta1v1kubectl getadditionalPrinterColumnsAgePhaseReadyreferences/reconcile_loop.mdctrl.Result{RequeueAfter: ...}time.Sleepreferences/reconcile_loop.mdctrl.Result{RequeueAfter: ...}time.Sleep1. Pick a Group/Version/Kind: e.g., apps.example.com/v1alpha1, kind=MyApp
2. kubebuilder init --domain example.com --repo github.com/org/myapp-operator
3. kubebuilder create api --group apps --version v1alpha1 --kind MyApp
4. Run crd_validator.py on config/crd/bases/apps.example.com_myapps.yaml
→ Fix every WARN before writing controller code
5. Implement the reconcile function (Karpathy principle 2: simplest correct version first)
6. Run reconcile_lint.py on controllers/myapp_controller.go
7. Run operator_capability_audit.py --operator-dir . — confirm L1
8. Test in a kind cluster: kubectl apply -f config/samples/
9. Add status conditions; aim for L2 in the same PR1. 选择Group/Version/Kind:例如apps.example.com/v1alpha1,kind=MyApp
2. kubebuilder init --domain example.com --repo github.com/org/myapp-operator
3. kubebuilder create api --group apps --version v1alpha1 --kind MyApp
4. 对config/crd/bases/apps.example.com_myapps.yaml运行crd_validator.py
→ 在编写控制器代码前修复所有WARN项
5. 实现调和函数(Karpathy原则2:先实现最简单的正确版本)
6. 对controllers/myapp_controller.go运行reconcile_lint.py
7. 运行operator_capability_audit.py --operator-dir . — 确认达到L1级
8. 在kind集群中测试:kubectl apply -f config/samples/
9. 添加状态条件;在同一个PR中目标达到L2级1. Run operator_capability_audit.py --operator-dir <path>
2. Run crd_validator.py --crd config/crd/
3. Run reconcile_lint.py --controller controllers/
4. Triage findings:
- FAIL → block release; fix before next deploy
- WARN → file an issue; fix in next 30 days
5. Document current capability level in README; commit
6. Plan one capability level advancement per quarter1. 运行operator_capability_audit.py --operator-dir <路径>
2. 对config/crd/运行crd_validator.py
3. 对controllers/运行reconcile_lint.py
4. 分类处理发现的问题:
- FAIL → 阻止发布;下次部署前修复
- WARN → 创建Issue;30天内修复
5. 在README中记录当前能力等级;提交代码
6. 规划每季度提升一个能力等级1. Identify primary language constraint (team skill)
2. Identify deployment target (vanilla k8s vs OpenShift)
3. Identify operator complexity (single CRD vs multi-CRD vs cluster-wide)
4. Cross-reference with references/tooling_landscape.md
5. Build a 1-week proof-of-concept before committing1. 确定主要语言约束(团队技能)
2. 确定部署目标(原生k8s vs OpenShift)
3. 确定Operator复杂度(单CRD vs 多CRD vs 集群级)
4. 参考references/tooling_landscape.md进行交叉对比
5. 提交前先进行1周的概念验证references/operator_pattern.mdreferences/crd_design.mdreferences/reconcile_loop.mdreferences/tooling_landscape.mdreferences/operator_pattern.mdreferences/crd_design.mdreferences/reconcile_loop.mdreferences/tooling_landscape.md/operator-audit/operator-auditassets/crd_template.yamlassets/reconcile_skeleton.goassets/crd_template.yamlassets/reconcile_skeleton.gotime.Sleep(30 * time.Second)RequeueAfterr.Client.Update(ctx, obj)r.Status().Update(ctx, obj)x-kubernetes-preserve-unknown-fields: truetime.Sleep(30 * time.Second)RequeueAfterr.Client.Update(ctx, obj)r.Status().Update(ctx, obj)x-kubernetes-preserve-unknown-fields: truecrd_validator.pyreconcile_lint.pycrd_validator.pyreconcile_lint.py