Skip to content

Commit 9c1c559

Browse files
committed
refactor: rename runtime-configuration to operator-framework
This is the module that should now be imported by non-Quarkus apps
1 parent 495ff39 commit 9c1c559

37 files changed

+56
-77
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/ResourceController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface ResourceController<R extends CustomResource> {
1515
*
1616
* @param resource
1717
* @return true - so the finalizer is automatically removed after the call. false if you don't
18-
* want to remove the finalizer. Note that this is ALMOST NEVER the case.
18+
* want to remove the finalizer. Note that this is ALMOST NEVER the case.
1919
*/
2020
DeleteControl deleteResource(R resource, Context<R> context);
2121

@@ -25,10 +25,10 @@ public interface ResourceController<R extends CustomResource> {
2525
* parameter (not the custom resource that might be in the events)
2626
*
2727
* @return The resource is updated in api server if the return value is present within Optional.
28-
* This the common use cases. However in cases, for example the operator is restarted, and we
29-
* don't want to have an update call to k8s api to be made unnecessarily, by returning an empty
30-
* Optional this update can be skipped. <b>However we will always call an update if there is no
31-
* finalizer on object and its not marked for deletion.</b>
28+
* This the common use cases. However in cases, for example the operator is restarted, and we
29+
* don't want to have an update call to k8s api to be made unnecessarily, by returning an
30+
* empty Optional this update can be skipped. <b>However we will always call an update if
31+
* there is no finalizer on object and its not marked for deletion.</b>
3232
*/
3333
UpdateControl<R> createOrUpdateResource(R resource, Context<R> context);
3434

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/DefaultEventHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ private RetryExecution getOrInitRetryExecution(ExecutionScope executionScope) {
194194
* <p>Note that this is an improvement, not a bug fix. This situation can happen naturally, we
195195
* just make the execution more efficient, and avoid questions about conflicts.
196196
*
197-
* <p>Note that without the conditional locking in the cache, there is a very minor chance that
198-
* we
197+
* <p>Note that without the conditional locking in the cache, there is a very minor chance that we
199198
* would override an additional change coming from a different client.
200199
*/
201200
private void cacheUpdatedResourceIfChanged(

runtime-configuration/pom.xml renamed to operator-framework/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<parent>
66
<artifactId>java-operator-sdk</artifactId>
77
<groupId>io.javaoperatorsdk</groupId>
88
<version>1.5.1-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

12-
<artifactId>runtime-configuration</artifactId>
13-
<name>Operator SDK - Runtime configuration support</name>
12+
<artifactId>operator-framework</artifactId>
13+
<name>Operator SDK - Framework - Plain Java</name>
1414

1515
<properties>
1616
<maven.compiler.source>11</maven.compiler.source>
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ public AccumulativeMappingWriter loadExistingMappings() {
4747
return this;
4848
}
4949

50-
/** Add a new mapping */
50+
/**
51+
* Add a new mapping
52+
*/
5153
public AccumulativeMappingWriter add(String key, String value) {
5254
this.mappings.put(key, value);
5355
return this;
5456
}
5557

5658
/**
57-
* Generates or overrise the resource file with the given path
58-
* ({@linkAccumulativeMappingWriter#resourcePath})
59+
* Generates or overrise the resource file with the given path ({@linkAccumulativeMappingWriter#resourcePath})
5960
*/
6061
public void flush() {
6162
PrintWriter printWriter = null;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
public class AnnotationConfiguration<R extends CustomResource>
1212
implements ControllerConfiguration<R> {
13+
1314
private final ResourceController<R> controller;
1415
private final Controller annotation;
1516

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.slf4j.LoggerFactory;
1616

1717
class ClassMappingProvider {
18+
1819
private static final Logger log = LoggerFactory.getLogger(ClassMappingProvider.class);
1920

2021
static <T, V> Map<T, V> provide(final String resourcePath, T key, V value) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.concurrent.ConcurrentHashMap;
99

1010
public class DefaultConfigurationService implements ConfigurationService {
11+
1112
private static final ConfigurationService instance = new DefaultConfigurationService();
1213
private final Map<String, ControllerConfiguration> configurations = new ConcurrentHashMap<>();
1314

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ static <R extends CustomResource> Class<R> getCustomResourceClass(
3838
}
3939

4040
public static <T extends CustomResource>
41-
Class<? extends CustomResourceDoneable<T>> getCustomResourceDoneableClass(
42-
ResourceController<T> controller) {
41+
Class<? extends CustomResourceDoneable<T>> getCustomResourceDoneableClass(
42+
ResourceController<T> controller) {
4343
final Class<T> customResourceClass = getCustomResourceClass(controller);
4444
final Class<? extends CustomResourceDoneable<T>> doneableClass =
4545
(Class<? extends CustomResourceDoneable<T>>)
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
import javax.lang.model.type.TypeVariable;
1616
import javax.lang.model.util.Types;
1717

18-
/** This class can resolve a type parameter in the given index to the actual type defined. */
18+
/**
19+
* This class can resolve a type parameter in the given index to the actual type defined.
20+
*/
1921
class TypeParameterResolver {
2022

2123
private final DeclaredType interestedClass;
@@ -28,12 +30,12 @@ public TypeParameterResolver(DeclaredType interestedClass, int interestedTypeArg
2830
}
2931

3032
/**
31-
* @param typeUtils Type utilities, During the annotation processing processingEnv.getTypeUtils()
32-
* can be passed.
33+
* @param typeUtils Type utilities, During the annotation processing processingEnv.getTypeUtils()
34+
* can be passed.
3335
* @param declaredType Class or Interface which extends or implements the interestedClass, and the
34-
* interest is getting the actual declared type is used.
36+
* interest is getting the actual declared type is used.
3537
* @return the type of the parameter if it can be resolved from the the given declareType,
36-
* otherwise it returns null
38+
* otherwise it returns null
3739
*/
3840
public TypeMirror resolve(Types typeUtils, DeclaredType declaredType) {
3941
final var chain = findChain(typeUtils, declaredType);
@@ -137,18 +139,18 @@ private List<DeclaredType> findChainOfInterfaces(Types typeUtils, DeclaredType p
137139
var matchingInterfaces =
138140
((TypeElement) parentInterface.asElement())
139141
.getInterfaces().stream()
140-
.filter(i -> typeUtils.isAssignable(i, interestedClass))
141-
.map(i -> (DeclaredType) i)
142-
.collect(Collectors.toList());
142+
.filter(i -> typeUtils.isAssignable(i, interestedClass))
143+
.map(i -> (DeclaredType) i)
144+
.collect(Collectors.toList());
143145
while (matchingInterfaces.size() > 0) {
144146
result.addAll(matchingInterfaces);
145147
final var lastFoundInterface = matchingInterfaces.get(matchingInterfaces.size() - 1);
146148
matchingInterfaces =
147149
((TypeElement) lastFoundInterface.asElement())
148150
.getInterfaces().stream()
149-
.filter(i -> typeUtils.isAssignable(i, interestedClass))
150-
.map(i -> (DeclaredType) i)
151-
.collect(Collectors.toList());
151+
.filter(i -> typeUtils.isAssignable(i, interestedClass))
152+
.map(i -> (DeclaredType) i)
153+
.collect(Collectors.toList());
152154
}
153155
return result;
154156
}

runtime-configuration/src/test/java/io/javaoperatorsdk/operator/EventSourceIT.java renamed to operator-framework/src/test/java/io/javaoperatorsdk/operator/EventSourceIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
1717
public class EventSourceIT {
18+
1819
private static final Logger log = LoggerFactory.getLogger(EventSourceIT.class);
1920

2021
public static final int EXPECTED_TIMER_EVENT_COUNT = 3;

runtime-configuration/src/test/java/io/javaoperatorsdk/operator/IntegrationTestSupport.java renamed to operator-framework/src/test/java/io/javaoperatorsdk/operator/IntegrationTestSupport.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public class IntegrationTestSupport {
3232
private static final Logger log = LoggerFactory.getLogger(IntegrationTestSupport.class);
3333
private KubernetesClient k8sClient;
3434
private MixedOperation<
35-
CustomResource,
36-
CustomResourceList,
37-
CustomResourceDoneable,
38-
Resource<CustomResource, CustomResourceDoneable>>
35+
CustomResource,
36+
CustomResourceList,
37+
CustomResourceDoneable,
38+
Resource<CustomResource, CustomResourceDoneable>>
3939
crOperations;
4040
private Operator operator;
4141
private ResourceController controller;
@@ -179,11 +179,11 @@ public KubernetesClient getK8sClient() {
179179
}
180180

181181
public MixedOperation<
182-
CustomResource,
183-
CustomResourceList,
184-
CustomResourceDoneable,
185-
Resource<CustomResource, CustomResourceDoneable>>
186-
getCrOperations() {
182+
CustomResource,
183+
CustomResourceList,
184+
CustomResourceDoneable,
185+
Resource<CustomResource, CustomResourceDoneable>>
186+
getCrOperations() {
187187
return crOperations;
188188
}
189189

@@ -196,6 +196,7 @@ public Operator getOperator() {
196196
}
197197

198198
public interface TestRun {
199+
199200
void run() throws Exception;
200201
}
201202
}

runtime-configuration/src/test/java/io/javaoperatorsdk/operator/SubResourceUpdateIT.java renamed to operator-framework/src/test/java/io/javaoperatorsdk/operator/SubResourceUpdateIT.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ public void updatesSubResourceStatusNoFinalizer() {
6262
});
6363
}
6464

65-
/** Note that we check on controller impl if there is finalizer on execution. */
65+
/**
66+
* Note that we check on controller impl if there is finalizer on execution.
67+
*/
6668
@Test
6769
public void ifNoFinalizerPresentFirstAddsTheFinalizerThenExecutesControllerAgain() {
6870
integrationTestSupport.teardownIfSuccess(
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.junit.jupiter.api.Test;
1717

1818
public class DefaultConfigurationServiceTest {
19+
1920
public static final String CUSTOM_FINALIZER_NAME = "a.custom/finalizer";
2021

2122
@Test
@@ -52,7 +53,10 @@ public void supportsInnerClassCustomResources() {
5253
@Controller(crdName = "test.crd", finalizerName = CUSTOM_FINALIZER_NAME)
5354
static class TestCustomFinalizerController
5455
implements ResourceController<TestCustomFinalizerController.InnerCustomResource> {
55-
public class InnerCustomResource extends CustomResource {}
56+
57+
public class InnerCustomResource extends CustomResource {
58+
59+
}
5660

5761
@Override
5862
public DeleteControl deleteResource(
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

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

5-
class TestCustomResource extends CustomResource {}
5+
class TestCustomResource extends CustomResource {
6+
7+
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242

4343
<modules>
4444
<module>operator-framework-core</module>
45+
<module>operator-framework</module>
4546
<module>spring-boot-starter</module>
4647
<module>samples</module>
4748
<module>quarkus-extension</module>
48-
<module>runtime-configuration</module>
4949
</modules>
5050

5151

quarkus-extension/runtime/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<dependencies>
1717
<dependency>
1818
<groupId>io.javaoperatorsdk</groupId>
19-
<artifactId>operator-framework</artifactId>
19+
<artifactId>operator-framework-core</artifactId>
2020
<version>${project.version}</version>
2121
<scope>compile</scope>
2222
</dependency>

samples/common/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@
2626
<artifactId>operator-framework</artifactId>
2727
<version>${project.version}</version>
2828
</dependency>
29-
<dependency>
30-
<groupId>io.javaoperatorsdk</groupId>
31-
<artifactId>runtime-configuration</artifactId>
32-
<version>${project.version}</version>
33-
<scope>compile</scope>
34-
</dependency>
3529
<dependency>
3630
<groupId>org.junit.jupiter</groupId>
3731
<artifactId>junit-jupiter-api</artifactId>

samples/mysql-schema/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
<artifactId>operator-framework</artifactId>
2727
<version>${project.version}</version>
2828
</dependency>
29-
<dependency>
30-
<groupId>io.javaoperatorsdk</groupId>
31-
<artifactId>runtime-configuration</artifactId>
32-
<version>${project.version}</version>
33-
</dependency>
3429
<dependency>
3530
<groupId>org.junit.jupiter</groupId>
3631
<artifactId>junit-jupiter-api</artifactId>

samples/pure-java/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
<artifactId>operator-framework-samples-common</artifactId>
2727
<version>${project.version}</version>
2828
</dependency>
29-
<dependency>
30-
<groupId>io.javaoperatorsdk</groupId>
31-
<artifactId>runtime-configuration</artifactId>
32-
<version>${project.version}</version>
33-
</dependency>
3429
</dependencies>
3530

3631
</project>

samples/spring-boot-plain/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
<artifactId>operator-framework-samples-common</artifactId>
2727
<version>${project.version}</version>
2828
</dependency>
29-
<dependency>
30-
<groupId>io.javaoperatorsdk</groupId>
31-
<artifactId>runtime-configuration</artifactId>
32-
<version>${project.version}</version>
33-
</dependency>
3429
<dependency>
3530
<groupId>org.springframework.boot</groupId>
3631
<artifactId>spring-boot-starter-log4j2</artifactId>

samples/tomcat/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828
<artifactId>operator-framework</artifactId>
2929
<version>${project.version}</version>
3030
</dependency>
31-
<dependency>
32-
<groupId>io.javaoperatorsdk</groupId>
33-
<artifactId>runtime-configuration</artifactId>
34-
<version>${project.version}</version>
35-
</dependency>
3631
<dependency>
3732
<groupId>org.apache.logging.log4j</groupId>
3833
<artifactId>log4j-slf4j-impl</artifactId>

samples/webserver/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
<artifactId>operator-framework</artifactId>
2727
<version>${project.version}</version>
2828
</dependency>
29-
<dependency>
30-
<groupId>io.javaoperatorsdk</groupId>
31-
<artifactId>runtime-configuration</artifactId>
32-
<version>${project.version}</version>
33-
</dependency>
3429
<dependency>
3530
<groupId>org.junit.jupiter</groupId>
3631
<artifactId>junit-jupiter-api</artifactId>

spring-boot-starter/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@
9191
<artifactId>operator-framework</artifactId>
9292
<version>${project.version}</version>
9393
</dependency>
94-
<dependency>
95-
<groupId>io.javaoperatorsdk</groupId>
96-
<artifactId>runtime-configuration</artifactId>
97-
<version>${project.version}</version>
98-
</dependency>
9994
<dependency>
10095
<groupId>org.mockito</groupId>
10196
<artifactId>mockito-core</artifactId>

0 commit comments

Comments
 (0)