API kubernetes 变异 webhook 服务器端点

API endpoints for kubernetes mutating webhook server

here, this is a reference implementation of a webhook server as used in kubernetes e2e test. In the main function, a number of endpoints have been defined to handle different requests for mutation. However, there is no clear documentation所述,关于何时调用哪个端点。

那么,我们如何知道何时调用哪个端点?

我看到您正在尝试了解变异 webhook 的执行顺序。

我找到了 this piece of code in kubernetes repo。基于此,您可以看到这些是按 webhook 的名称排序的,具有确定的顺序。

变异招生插件(包括 webhooks)的单一排序并不适用于所有情况,因此请查看 Admission webhook 提案中的 mutating plugin ordering 部分以了解其处理方式。

另请注意,没有 "pod only endpoints" 或 "endpoints that get called for pods"。假设您有自己的 webhook 服务器并想要改变 pods,而您的服务器只有一个端点:/。如果你想用它改变 pods,你需要在 rules 下指定它。因此,只要有要创建的 pod,在您的 webhook 配置中设置 rules[].resources: ["pods"]rules[].operations: ["CREATE"] 就会 运行 您的变异 webhook。

告诉我它有帮助。