Kubebuilder V3 documentation解释说它讨论了“如何将多个事件批处理到单个协调调用中”。但是,我在本文档中找不到任何有关事件管理的信息。
您能否提供有关如何使用 Kubebuilder-v3/operator-sdk
发送事件的信息/代码示例?
最佳答案
This part官方文档应该可以回答您的问题:
This business logic of the Controller is implemented in the
Reconcile
function. This function takes the Namespace and Name of a ContainerSet, allowing multiple Events to be batched together into a single Reconcile call. The function shown here creates or updates a Deployment using the replicas and image specified in ContainerSet.Spec. Note that it sets an OwnerReference for the Deployment to enable garbage collection on the Deployment once the ContainerSet is deleted.
- Read the ContainerSet using the NamespacedName
- If there is an error or it has been deleted, return
- Create the new desired DeploymentSpec from the ContainerSetSpec
- Read the Deployment and compare the Deployment.Spec to the ContainerSet.Spec
- If the observed Deployment.Spec does not match the desired spec - Deployment was not found: create a new Deployment - Deployment was found and changes are needed: update the Deployment
在那里您还可以找到代码示例。
关于kubernetes - 如何使用 Kubebuilder-v3/operator-sdk 发送事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70529847/