|
2 | 2 | 
|
3 | 3 |
|
4 | 4 | SDK for building Kubernetes Operators in Java. Inspired by [operator-sdk](https://github.com/operator-framework/operator-sdk).
|
5 |
| -In this first iteration we aim to provide a framework which handles the reconciliation loop by dispatching events to |
6 |
| -a Controller written by the user of the framework. |
7 |
| - |
8 |
| -The Controller only contains the logic to create, update and delete the actual resources related to the CRD. |
| 5 | +User (you) only writes the logic in a Controller that creates/updates or deletes resources related to a custom resource. |
| 6 | +All the issues around are handled by the framework for you. |
| 7 | +Check out this [blog post](https://blog.container-solutions.com/a-deep-dive-into-the-java-operator-sdk) |
| 8 | +about the non-trivial yet common problems needs to be solved for every operator. |
9 | 9 |
|
10 | 10 | ## Join us on Discord!
|
11 | 11 |
|
@@ -61,16 +61,16 @@ The Controller implements the business logic and describes all the classes neede
|
61 | 61 | public class WebServerController implements ResourceController<WebServer> {
|
62 | 62 |
|
63 | 63 | @Override
|
64 |
| - public boolean deleteResource(CustomService resource) { |
| 64 | + public boolean deleteResource(CustomService resource, Context<WebServer> context) { |
65 | 65 | // ... your logic ...
|
66 | 66 | return true;
|
67 | 67 | }
|
68 | 68 |
|
69 | 69 | // Return the changed resource, so it gets updated. See javadoc for details.
|
70 | 70 | @Override
|
71 |
| - public Optional<CustomService> createOrUpdateResource(CustomService resource) { |
| 71 | + public UpdateControl<CustomService> createOrUpdateResource(CustomService resource, Context<WebServer> context) { |
72 | 72 | // ... your logic ...
|
73 |
| - return resource; |
| 73 | + return UpdateControl.updateStatusSubResource(resource); |
74 | 74 | }
|
75 | 75 | }
|
76 | 76 | ```
|
@@ -139,7 +139,7 @@ public class Application {
|
139 | 139 | }
|
140 | 140 | ```
|
141 | 141 |
|
142 |
| -And add Spring's `@Service` annotation to your controller classes so they will be automatically registered as resource controllers. |
| 142 | +add Spring's `@Service` annotation to your controller classes so they will be automatically registered as resource controllers. |
143 | 143 |
|
144 | 144 | The Operator's Spring Boot integration leverages [Spring's configuration mechanisms](https://docs.spring.io/spring-boot/docs/1.0.1.RELEASE/reference/html/boot-features-external-config.html) to configure
|
145 | 145 | - [The Kubernetes client](spring-boot-starter/src/main/java/com/github/containersolutions/operator/spingboot/starter/OperatorProperties.java)
|
|
0 commit comments