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编程
自定义资源进阶
269
的每个对象都会先从
API
端点的版本转换为内部版本(参考“
8.4.3
内部类型
和转换”和图
8-5
),然后再转换成用于持久化的外部版本并返回相应对象。
这个转换机制是通过转换函数来实现的,它们有些是手写的,有些是自动生
成的(参考“
8.4.5
转换”)。
多版本
API
是一个强大的功能,它可以在保持对旧版本客户端兼容的前提下,
API
进行改进。多版本在
Kubernetes API
Alpha
版本演化到
Beta
版本并
最终正式发布(
GA
版本)的过程中,起了非常重要的作用。在这个过程中,
API
的结构可以不断进行不兼容的改动或扩展。
在第
8
章中我们看到,很久以来多版本功能都只在聚合
API
服务器中存在。
但所有需要投入生产环境使用的
API
都应该需要多版本,因为在生产环境中
是不能接受破坏对
API
客户端的兼容性的。
幸运的是,最新
Kubernetes
中也为
CRD
提供了的多版本支持:在
Kubernetes
1.14
中发布了
Alpha
版本,并在
1.15
中进入
Beta
。注意,版本转换功能要求
OpenAPI v3
的验证
Schema
是结构化的(参考“
4.3.1
自定义资源合法性验证”)。
类似
Kubebuilder
这样的工具,默认就会生成结构化的
Schema
。我们会在“
9.3.1
结构化
Schema
”中详细讨论相关的细节。
下面我们来看看在不远的将来,多版本将如何在很多正式的应用中发挥其核
心作用的。
9.1.1
改进披萨餐厅
为了学习
CR
转换的过程,我们将重新实现第
8
章中的披萨餐厅的例子,这
一次将只使用
CRD ...
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