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编程
242
8
所以,在下一节中,我们会介绍用于实现复杂检查逻辑的“准入”功能。
8.4.11
准入
每一个请求在经过反序列化、默认值处理、转换成内部类型后,都会经过准
入插件链处理,回忆一下图
8-2
。确切地说,请求会经历两次准入处理:
变更插件。
验证插件。
同一个准入插件可以既是变更插件也是验证插件,所以在准入处理机制中,
一个插件可能会被调用两次:
一次是在变更阶段,所有的变更插件会依次被调用。
另一次是在验证阶段,所有的验证插件都会被调用(可能是并发地调用)。
更确切地的说,一个插件可以用两个函数同时实现变更和验证准入接口。
Kubernetes
区分变更和验证这两种插件类型之前,每个插件都只会被调用
一次。所以几乎不可能区分每个插件做了哪些变更操作,也很难确认准入插
件的调用顺序,可能给用户带来不一致的行为。
现在的拆分成两个步骤的架构至少保证了验证过程是在所有插件处理完后再
进行的,保证了结果的一致性。
除此之外,处理链(也就是说,两个准入处理阶段中插件的调用顺序)是确定的。
同一个插件在两个阶段中要么同时启用,要么同时禁用。
准入插件(至少是本章所介绍的用
Golang
来实现的那些)需要操作内部类型。
与此相对的,
Webhook
准入插件(参考“
9.2
准入
Webhook
”)是基于外部
类型来实现的,并且包含调用
Webhook
和返回过程中的转换处理(如果是变
Webhook
)。
自定义
API
服务器
243
谈完了理论,我们来学习代码。
8.4.11.1
实现
要实现一个准入插件需要实现下列接口: ...
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