@@ -580,41 +580,41 @@ The webhook should perform these conversions independently.
580
580
# ## Write a conversion webhook server
581
581
582
582
Please refer to the implementation of the [custom resource conversion webhook
583
- server](https://github.com/kubernetes/kubernetes/tree/v1.15.0 /test/images/crd-conversion-webhook/main.go)
583
+ server](https://github.com/kubernetes/kubernetes/tree/v1.25.3 /test/images/agnhost /crd-conversion-webhook/main.go)
584
584
that is validated in a Kubernetes e2e test. The webhook handles the
585
585
` ConversionReview` requests sent by the API servers, and sends back conversion
586
586
results wrapped in `ConversionResponse`. Note that the request
587
587
contains a list of custom resources that need to be converted independently without
588
588
changing the order of objects.
589
589
The example server is organized in a way to be reused for other conversions.
590
590
Most of the common code are located in the
591
- [framework file](https://github.com/kubernetes/kubernetes/tree/v1.15.0 /test/images/crd-conversion-webhook/converter/framework.go)
591
+ [framework file](https://github.com/kubernetes/kubernetes/tree/v1.25.3 /test/images/agnhost /crd-conversion-webhook/converter/framework.go)
592
592
that leaves only
593
- [one function](https://github.com/kubernetes/kubernetes/blob/v1.15.0 /test/images/crd-conversion-webhook/converter/example_converter.go#L29-L80)
593
+ [one function](https://github.com/kubernetes/kubernetes/blob/v1.25.3 /test/images/crd-conversion-webhook/converter/example_converter.go#L29-L80)
594
594
to be implemented for different conversions.
595
595
-->
596
596
# ## 编写一个转换 Webhook 服务器 {#write-a-conversion-webhook-server}
597
597
598
- 请参考[定制资源转换 Webhook 服务器](https://github.com/kubernetes/kubernetes/tree/v1.15.0 /test/images/crd-conversion-webhook/main.go)的实现;
598
+ 请参考[定制资源转换 Webhook 服务器](https://github.com/kubernetes/kubernetes/tree/v1.25.3 /test/images/agnhost /crd-conversion-webhook/main.go)的实现;
599
599
该实现在 Kubernetes e2e 测试中得到验证。
600
600
Webhook 处理由 API 服务器发送的 `ConversionReview` 请求,并在
601
601
` ConversionResponse` 中封装发回转换结果。
602
602
请注意,请求包含需要独立转换的定制资源列表,这些对象在被转换之后不能改变其在列表中的顺序。
603
603
该示例服务器的组织方式使其可以复用于其他转换。大多数常见代码都位于
604
- [framework 文件](https://github.com/kubernetes/kubernetes/tree/v1.15.0 /test/images/crd-conversion-webhook/converter/framework.go)中,
605
- 只留下[一个函数](https://github.com/kubernetes/kubernetes/blob /v1.13.0 /test/images/crd-conversion-webhook/converter/example_converter.go#L29-L80)用于实现不同的转换。
604
+ [framework 文件](https://github.com/kubernetes/kubernetes/tree/v1.25.3 /test/images/agnhost /crd-conversion-webhook/converter/framework.go)中,
605
+ 只留下[一个函数](https://github.com/kubernetes/kubernetes/tree /v1.25.3 /test/images/agnhost /crd-conversion-webhook/converter/example_converter.go#L29-L80)用于实现不同的转换。
606
606
607
607
{{< note >}}
608
608
<!--
609
609
The example conversion webhook server leaves the `ClientAuth` field
610
- [empty](https://github.com/kubernetes/kubernetes/tree/v1.13.0 /test/images/crd-conversion-webhook/config.go#L47-L48),
610
+ [empty](https://github.com/kubernetes/kubernetes/tree/v1.25.3 /test/images/agnhost /crd-conversion-webhook/config.go#L47-L48),
611
611
which defaults to `NoClientCert`. This means that the webhook server does not
612
612
authenticate the identity of the clients, supposedly API servers. If you need
613
613
mutual TLS or other ways to authenticate the clients, see
614
614
how to [authenticate API servers](/docs/reference/access-authn-authz/extensible-admission-controllers/#authenticate-apiservers).
615
615
-->
616
616
转换 Webhook 服务器示例中将 `ClientAuth`
617
- 字段设置为[空](https://github.com/kubernetes/kubernetes/tree/v1.13.0 /test/images/crd-conversion-webhook/config.go#L47-L48),
617
+ 字段设置为[空](https://github.com/kubernetes/kubernetes/tree/v1.25.3 /test/images/agnhost /crd-conversion-webhook/config.go#L47-L48),
618
618
默认为 `NoClientCert`。
619
619
这意味着 webhook 服务器没有验证客户端(也就是 API 服务器)的身份。
620
620
如果你需要双向 TLS 或者其他方式来验证客户端,
0 commit comments