Skip to content

Commit dd16364

Browse files
authored
docs: simple docs for conversion hooks (#38)
1 parent 3a2019c commit dd16364

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# admission-controller-framework
22

33
Framework and tooling to support
4-
implementing [admission controllers](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) for
5-
Kubernetes in Java. Supports both **quarkus** and **spring boot**. Both Sync and Async programing model.
4+
implementing [admission controllers](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/)
5+
and [conversion hooks](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#webhook-conversion)
6+
for Kubernetes in Java. Supports both **quarkus** and **spring boot**. Both Sync and Async programing model.
67

78
## Sample Usage
89

10+
### Admission Controllers
11+
912
Defining a mutation or validation controller is simple as:
1013

1114
https://github.com/java-operator-sdk/admission-controller-framework/blob/0946595d941b789caef6a69b34c2e5be8c6b59cf/samples/quarkus/src/main/java/io/javaoperatorsdk/admissioncontroller/sample/quarkus/AdmissionControllerConfig.java#L31-L68
@@ -15,3 +18,19 @@ What can be then simple used in an endpoint:
1518
https://github.com/java-operator-sdk/admission-controller-framework/blob/0946595d941b789caef6a69b34c2e5be8c6b59cf/samples/quarkus/src/main/java/io/javaoperatorsdk/admissioncontroller/sample/quarkus/AdmissionEndpoint.java#L57-L89
1619

1720
See samples also for details.
21+
22+
### Conversion Hooks
23+
24+
Conversion hooks follows the same patter described
25+
in [Kuberbuilder](https://book.kubebuilder.io/multiversion-tutorial/conversion-concepts.html), thus first converts the
26+
custom resource from actual version to a hub, and as next step from the hub to the target resource version.
27+
28+
To create the controller
29+
register [mappers](https://github.com/java-operator-sdk/admission-controller-framework/blob/main/core/src/main/java/io/javaoperatorsdk/webhook/conversion/Mapper.java)
30+
:
31+
32+
https://github.com/java-operator-sdk/admission-controller-framework/blob/2a2bce54b49ea3398bef95a9102ee8645e11cf87/samples/quarkus/src/main/java/io/javaoperatorsdk/webhook/admission/sample/quarkus/conversion/ConversionControllerConfig.java#L15-L29
33+
34+
and use the controllers in the endpoint:
35+
36+
https://github.com/java-operator-sdk/admission-controller-framework/blob/2a2bce54b49ea3398bef95a9102ee8645e11cf87/samples/spring-boot/src/main/java/io/javaoperatorsdk/webhook/sample/springboot/conversion/ConversionEndpoint.java#L29-L40

0 commit comments

Comments
 (0)