如何区分新部署和非新部署 – Kubernetes

huangapple go评论83阅读模式
英文:

How can I distinguish between new deployments and not - Kubernetes

问题

我是你的中文翻译助手,以下是翻译好的内容:

我是K8S的新手,所以也许有一个简单的解决方案来解决我的问题。根据这个教程,我正在创建一个变异Webhook,其目标是通过变异Webhook向Pod规范中添加信息。

Webhook应该只对新的Pod部署进行修补,而不是副本集、扩容或缩容。

如何使用corev1 pkg或其他方式来区分这些情况(新的部署和非新的部署)?

谢谢!

英文:

I'm new at K8S, so perhaps there is a simple solution to my problem.
Using this tutorial, I'm creating a mutation webhook whose goal is to add information to pod specifications (using mutation webhooks).
The webhook should patch only new pod deployments and not replica sets, scale-ups, or scale-outs.

How can I distinguish between those cases (new deployments and not) with corev1 pkg or any other way?
Thanks!

答案1

得分: 2

您可以查看发送到准入控制 Webhook 的 AdmissionReview 对象的 request.kindrequest.subresourcerequest.operation 字段的内容,以区分 CREATE/UPDATE Deployment 请求和缩放请求或 CREATE/UPDATE ReplicaSet 请求。您可以在这里找到更多信息。

英文:

You can check the content of the request.kind, request.subresource and request.operatrion field of the AdmissionReview object sent to the admission control webhook to distinguish a CREATE/UPDATE Deployment request from a scale request or a CREATE/UPDATE ReplicaSet request.

huangapple
  • 本文由 发表于 2021年6月11日 08:34:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/67929955.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定