Skip to content

Commit 9380215

Browse files
author
Soroosh Sarabadani
committed
Merge remote-tracking branch 'origin/master' into annotation-processor-test
# Conflicts: # spring-boot-starter/src/test/java/io/javaoperatorsdk/operator/springboot/starter/TestController.java
2 parents 8aa10d1 + 19c7e60 commit 9380215

File tree

12 files changed

+32
-29
lines changed

12 files changed

+32
-29
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Build Kubernetes Operators in Java without hassle. Inspired by [operator-sdk](ht
2020
* Smart event scheduling (only handle latest event for the same resource)
2121

2222
Check out this [blog post](https://blog.container-solutions.com/a-deep-dive-into-the-java-operator-sdk)
23-
about the non-trivial yet common problems needs to be solved for every operator.
23+
about the non-trivial yet common problems needed to be solved for every operator.
2424

2525
#### Why build your own Operator?
2626
* Infrastructure automation using the power and flexibility of Java. See [blog post](https://blog.container-solutions.com/cloud-native-java-infrastructure-automation-with-kubernetes-operators).
@@ -31,7 +31,7 @@ about the non-trivial yet common problems needs to be solved for every operator.
3131
#### Roadmap
3232
* Testing of the framework and all samples while running on a real cluster.
3333
* Generate a project skeleton
34-
* Generate Java classes from CRD definion (and/or the other way around)
34+
* Generate Java classes from CRD defintion (and/or the other way around)
3535
* Integrate with Quarkus (including native image build)
3636
* Integrate with OLM (Operator Lifecycle Manager)
3737

docs/DOCS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ TODO: explain running operator locally against a cluster
5656

5757
### Run Single Instance
5858

59-
There should be always just one instance of an operator running at a time (think process). If there there would be
59+
There should be always just one instance of an operator running at a time (think process). If there would be
6060
two ore more, in general it could lead to concurrency issues. Note that we are also doing optimistic locking when we update a resource.
61-
In this way the operator is not highly available. However for operators this not necessary an issue,
61+
In this way the operator is not highly available. However for operators this is not necessarily an issue,
6262
if the operator just gets restarted after it went down.
6363

6464
### At Least Once
6565

6666
To implement controller logic, we have to override two methods: `createOrUpdateResource` and `deleteResource`.
67-
These methods are called if a resource is create/changed or marked for deletion. In most cases these methods will be
68-
called just once, but in some rare cases can happen that are called more then once. In practice this means that the
67+
These methods are called if a resource is created/changed or marked for deletion. In most cases these methods will be
68+
called just once, but in some rare cases, it can happen that they are called more then once. In practice this means that the
6969
implementation needs to be **idempotent**.
7070

7171
### Smart Scheduling
@@ -77,11 +77,11 @@ a customizable retry mechanism to deal with temporal errors.
7777

7878
When an operator is started we got events for every resource (of a type we listen to) already on the cluster. Even if the resource is not changed
7979
(We use `kubectl get ... --watch` in the background). This can be a huge amount of resources depending on your use case.
80-
So it could be a good case just have a status field on the resource which is checked, if there anything needs to be done.
80+
So it could be a good case to just have a status field on the resource which is checked, if there is anything needed to be done.
8181

8282
### Deleting a Resource
8383

8484
During deletion process we use [Kubernetes finalizers](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#finalizers
8585
"Kubernetes docs") finalizers. This is required, since it can happen that the operator is not running while the delete
8686
of resource is executed (think `oc delete`). In this case we would not catch the delete event. So we automatically add a
87-
finalizer first time we update the resource if its not there.
87+
finalizer first time we update the resource if it's not there.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
package io.javaoperatorsdk.operator.spingboot.starter;
1+
package io.javaoperatorsdk.operator.springboot.starter;
2+
3+
import java.util.List;
24

3-
import io.javaoperatorsdk.operator.Operator;
4-
import io.javaoperatorsdk.operator.api.ResourceController;
5-
import io.javaoperatorsdk.operator.processing.retry.GenericRetry;
6-
import io.javaoperatorsdk.operator.processing.retry.Retry;
75
import io.fabric8.kubernetes.client.ConfigBuilder;
86
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
97
import io.fabric8.kubernetes.client.KubernetesClient;
108
import io.fabric8.openshift.client.DefaultOpenShiftClient;
9+
import io.javaoperatorsdk.operator.Operator;
10+
import io.javaoperatorsdk.operator.api.ResourceController;
11+
import io.javaoperatorsdk.operator.processing.retry.GenericRetry;
12+
import io.javaoperatorsdk.operator.processing.retry.Retry;
1113
import org.apache.commons.lang3.StringUtils;
1214
import org.slf4j.Logger;
1315
import org.slf4j.LoggerFactory;
@@ -16,8 +18,6 @@
1618
import org.springframework.context.annotation.Bean;
1719
import org.springframework.context.annotation.Configuration;
1820

19-
import java.util.List;
20-
2121
@Configuration
2222
@EnableConfigurationProperties({OperatorProperties.class, RetryProperties.class})
2323
public class OperatorAutoConfiguration {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.javaoperatorsdk.operator.spingboot.starter;
1+
package io.javaoperatorsdk.operator.springboot.starter;
22

33
import org.springframework.boot.context.properties.ConfigurationProperties;
44

spring-boot-starter/src/main/java/io/javaoperatorsdk/operator/spingboot/starter/RetryProperties.java renamed to spring-boot-starter/src/main/java/io/javaoperatorsdk/operator/springboot/starter/RetryProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.javaoperatorsdk.operator.spingboot.starter;
1+
package io.javaoperatorsdk.operator.springboot.starter;
22

33
import org.springframework.boot.context.properties.ConfigurationProperties;
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2-
io.javaoperatorsdk.operator.spingboot.starter.OperatorAutoConfiguration
2+
io.javaoperatorsdk.operator.springboot.starter.OperatorAutoConfiguration
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
package io.javaoperatorsdk.operator.spingboot.starter;
1+
package io.javaoperatorsdk.operator.springboot.starter;
22

3+
import java.util.List;
4+
5+
import io.fabric8.kubernetes.client.KubernetesClient;
36
import io.javaoperatorsdk.operator.Operator;
47
import io.javaoperatorsdk.operator.api.ResourceController;
5-
import io.fabric8.kubernetes.client.KubernetesClient;
68
import org.junit.jupiter.api.Test;
79
import org.junit.jupiter.api.extension.ExtendWith;
810
import org.springframework.beans.factory.annotation.Autowired;
911
import org.springframework.boot.test.context.SpringBootTest;
1012
import org.springframework.boot.test.mock.mockito.MockBean;
1113
import org.springframework.test.context.junit.jupiter.SpringExtension;
1214

13-
import java.util.List;
14-
15-
import static org.junit.jupiter.api.Assertions.*;
15+
import static org.junit.jupiter.api.Assertions.assertEquals;
16+
import static org.junit.jupiter.api.Assertions.assertNotNull;
17+
import static org.junit.jupiter.api.Assertions.assertTrue;
1618

1719
@ExtendWith(SpringExtension.class)
1820
@SpringBootTest

spring-boot-starter/src/test/java/io/javaoperatorsdk/operator/spingboot/starter/TestApplication.java renamed to spring-boot-starter/src/test/java/io/javaoperatorsdk/operator/springboot/starter/TestApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.javaoperatorsdk.operator.spingboot.starter;
1+
package io.javaoperatorsdk.operator.springboot.starter;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;

spring-boot-starter/src/test/java/io/javaoperatorsdk/operator/spingboot/starter/TestController.java renamed to spring-boot-starter/src/test/java/io/javaoperatorsdk/operator/springboot/starter/TestController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
package io.javaoperatorsdk.operator.spingboot.starter;
1+
package io.javaoperatorsdk.operator.springboot.starter;
22

3+
import io.fabric8.kubernetes.client.CustomResource;
34
import io.javaoperatorsdk.operator.api.Context;
45
import io.javaoperatorsdk.operator.api.Controller;
56
import io.javaoperatorsdk.operator.api.ResourceController;
67
import io.javaoperatorsdk.operator.api.UpdateControl;
7-
import io.fabric8.kubernetes.client.CustomResource;
8+
import io.javaoperatorsdk.operator.springboot.starter.model.TestResource;
89
import org.springframework.stereotype.Component;
910

1011
@Component
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.javaoperatorsdk.operator.spingboot.starter.model;
1+
package io.javaoperatorsdk.operator.springboot.starter.model;
22

33
import io.fabric8.kubernetes.client.CustomResource;
44

0 commit comments

Comments
 (0)