Skip to Content
Kubernetes编程
book

Kubernetes编程

by Michael Hausenblas, Stefan Schimanski
June 2021
Intermediate to advanced
335 pages
5h 50m
Chinese
China Electric Power Press Ltd.
Content preview from Kubernetes编程
296
9
这就注册了本章开头的
pizza-crd Webhook
,用于为我们两个版本的
pizza
资源实现变更准入。它还注册了
restaurant.programming-kubernetes.info
这个
API
组,以及
HTTP
动词
CREATE
UPDATE
(同时还包含了
Patch
)。
Webhook
配置中还有其他的方法来限制其匹配的资源,比如,使用命名空
间选择器(来排除一些控制平面的命名空间来避免引导时发生问题),还可
以使用包含通配符或子资源的更高级的资源模式。
最后要讨论的是失败处理模式,它可以被配置为
Fail
Ignore
,这个模式用
于指定当无法访问
Webhook
或访问
Webhook
出错时的处理方式。
如果错误地部署了准入
Webhooks
有可能破坏整个集群。匹配核心类型的准
Webhook
有可能使整个集群无法使用。如果要对非
CRD
资源使用准入
Webhook
,需要额外小心。
因此要特别注意,把控制平面和
Webhook
资源自身排除在
Webhook
处理的
范围之外是一个很好的习惯。
9.2.4
实现准入
Webhook
在本章一开始我们所完成的转换
Webhook
的基础上添加准入能力并不困难。
我们看到,在
pizza-crd-webhook
程序的主函数中注册了
/admit/v1beta1/pizza
/validate/v1beta1/pizza
两个路径:
mux.Handle("/admit/v1beta1/pizza", http.HandlerFunc(admission.ServePizzaAdmit)) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

解密金融数据

解密金融数据

Justin Pauley
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu
软件开发实践:项目驱动式的Java开发指南

软件开发实践:项目驱动式的Java开发指南

Raoul-Gabriel Urma, Richard Warburton

Publisher Resources

ISBN: 9787519854799