Skip to content

Commit 495ff39

Browse files
committed
refactor: rename operator-framework module to operator-framework-core
1 parent 85c466f commit 495ff39

File tree

81 files changed

+67
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+67
-47
lines changed

operator-framework/pom.xml renamed to operator-framework-core/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<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">
45
<modelVersion>4.0.0</modelVersion>
5-
66
<parent>
77
<groupId>io.javaoperatorsdk</groupId>
88
<artifactId>java-operator-sdk</artifactId>
99
<version>1.5.1-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

13-
<artifactId>operator-framework</artifactId>
14-
<name>Operator SDK - Framework</name>
15-
<description>Framework for implementing Kubernetes operators</description>
13+
<artifactId>operator-framework-core</artifactId>
14+
<name>Operator SDK - Framework - Core</name>
15+
<description>Core framework for implementing Kubernetes operators</description>
1616
<packaging>jar</packaging>
1717

1818
<properties>

operator-framework/src/main/java/io/javaoperatorsdk/operator/Operator.java renamed to operator-framework-core/src/main/java/io/javaoperatorsdk/operator/Operator.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public <R extends CustomResource> void register(ResourceController<R> controller
4242
throws OperatorException {
4343
final var configuration = configurationService.getConfigurationFor(controller);
4444
final var retry = GenericRetry.fromConfiguration(configuration.getRetryConfiguration());
45-
final var targetNamespaces = configuration.getNamespaces().toArray(new String[] {});
45+
final var targetNamespaces = configuration.getNamespaces().toArray(new String[]{});
4646
registerController(controller, configuration.watchAllNamespaces(), retry, targetNamespaces);
4747
}
4848

@@ -129,7 +129,7 @@ private CustomResourceEventSource createCustomResourceEventSource(
129129
CustomResourceEventSource customResourceEventSource =
130130
watchAllNamespaces
131131
? CustomResourceEventSource.customResourceEventSourceForAllNamespaces(
132-
customResourceCache, client, generationAware, finalizer)
132+
customResourceCache, client, generationAware, finalizer)
133133
: CustomResourceEventSource.customResourceEventSourceForTargetNamespaces(
134134
customResourceCache, client, targetNamespaces, generationAware, finalizer);
135135

@@ -152,15 +152,15 @@ private CustomResourceDefinitionContext getCustomResourceDefinitionForController
152152
}
153153

154154
public Map<Class<? extends CustomResource>, CustomResourceOperationsImpl>
155-
getCustomResourceClients() {
155+
getCustomResourceClients() {
156156
return customResourceClients;
157157
}
158158

159159
public <
160-
T extends CustomResource,
161-
L extends CustomResourceList<T>,
162-
D extends CustomResourceDoneable<T>>
163-
CustomResourceOperationsImpl<T, L, D> getCustomResourceClients(Class<T> customResourceClass) {
160+
T extends CustomResource,
161+
L extends CustomResourceList<T>,
162+
D extends CustomResourceDoneable<T>>
163+
CustomResourceOperationsImpl<T, L, D> getCustomResourceClients(Class<T> customResourceClass) {
164164
return customResourceClients.get(customResourceClass);
165165
}
166166
}

operator-framework/src/main/java/io/javaoperatorsdk/operator/OperatorException.java renamed to operator-framework-core/src/main/java/io/javaoperatorsdk/operator/OperatorException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
public class OperatorException extends RuntimeException {
44

5-
public OperatorException() {}
5+
public OperatorException() {
6+
}
67

78
public OperatorException(String message) {
89
super(message);

operator-framework/src/main/java/io/javaoperatorsdk/operator/api/Controller.java renamed to operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/Controller.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@Retention(RetentionPolicy.RUNTIME)
99
@Target({ElementType.TYPE})
1010
public @interface Controller {
11+
1112
String NULL = "";
1213

1314
String crdName();

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

Lines changed: 7 additions & 6 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
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>
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>
3232
*/
3333
UpdateControl<R> createOrUpdateResource(R resource, Context<R> context);
3434

@@ -37,7 +37,8 @@ public interface ResourceController<R extends CustomResource> {
3737
*
3838
* @param eventSourceManager
3939
*/
40-
default void init(EventSourceManager eventSourceManager) {}
40+
default void init(EventSourceManager eventSourceManager) {
41+
}
4142

4243
default String getName() {
4344
final var clazz = getClass();

operator-framework/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java renamed to operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.javaoperatorsdk.operator.api.ResourceController;
66

77
public interface ConfigurationService {
8+
89
<R extends CustomResource> ControllerConfiguration<R> getConfigurationFor(
910
ResourceController<R> controller);
1011

operator-framework/src/main/java/io/javaoperatorsdk/operator/api/config/ControllerConfiguration.java renamed to operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ControllerConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.Set;
77

88
public interface ControllerConfiguration<R extends CustomResource> {
9+
910
String WATCH_ALL_NAMESPACES_MARKER = "ALL_NAMESPACES";
1011

1112
String getName();
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
package io.javaoperatorsdk.operator.api.config;
22

3-
public class DefaultRetryConfiguration implements RetryConfiguration {}
3+
public class DefaultRetryConfiguration implements RetryConfiguration {
4+
5+
}

operator-framework/src/main/java/io/javaoperatorsdk/operator/api/config/RetryConfiguration.java renamed to operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/RetryConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.javaoperatorsdk.operator.api.config;
22

33
public interface RetryConfiguration {
4+
45
RetryConfiguration DEFAULT = new DefaultRetryConfiguration();
56

67
int DEFAULT_MAX_ATTEMPTS = 5;

operator-framework/src/main/java/io/javaoperatorsdk/operator/processing/CustomResourceCache.java renamed to operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/CustomResourceCache.java

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

1313
public class CustomResourceCache {
14+
1415
private static final Logger log = LoggerFactory.getLogger(CustomResourceCache.class);
1516

1617
private final Map<String, CustomResource> resources = new ConcurrentHashMap<>();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ 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 we
197+
* <p>Note that without the conditional locking in the cache, there is a very minor chance that
198+
* we
198199
* would override an additional change coming from a different client.
199200
*/
200201
private void cacheUpdatedResourceIfChanged(

operator-framework/src/main/java/io/javaoperatorsdk/operator/processing/event/AbstractEventSource.java renamed to operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/AbstractEventSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ public void setEventHandler(EventHandler eventHandler) {
1010
}
1111

1212
@Override
13-
public void eventSourceDeRegisteredForResource(String customResourceUid) {}
13+
public void eventSourceDeRegisteredForResource(String customResourceUid) {
14+
}
1415
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public String toString() {
4242
+ getCustomResource().getMetadata().getResourceVersion()
4343
+ ", markedForDeletion: "
4444
+ (getCustomResource().getMetadata().getDeletionTimestamp() != null
45-
&& !getCustomResource().getMetadata().getDeletionTimestamp().isEmpty())
45+
&& !getCustomResource().getMetadata().getDeletionTimestamp().isEmpty())
4646
+ " ]}";
4747
}
4848

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import org.slf4j.Logger;
2020
import org.slf4j.LoggerFactory;
2121

22-
/** This is a special case since is not bound to a single custom resource */
22+
/**
23+
* This is a special case since is not bound to a single custom resource
24+
*/
2325
public class CustomResourceEventSource extends AbstractEventSource
2426
implements Watcher<CustomResource> {
2527

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public void cancelOnceSchedule(String customResourceUid) {
6060
}
6161

6262
public class EventProducerTimeTask extends TimerTask {
63+
6364
protected final String customResourceUid;
6465

6566
public EventProducerTimeTask(String customResourceUid) {

operator-framework/src/test/java/io/javaoperatorsdk/operator/EventDispatcherTest.java renamed to operator-framework-core/src/test/java/io/javaoperatorsdk/operator/EventDispatcherTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ void callsDeleteIfObjectHasFinalizerAndMarkedForDelete() {
120120
verify(controller, times(1)).deleteResource(eq(testCustomResource), any());
121121
}
122122

123-
/** Note that there could be more finalizers. Out of our control. */
123+
/**
124+
* Note that there could be more finalizers. Out of our control.
125+
*/
124126
@Test
125127
void callDeleteOnControllerIfMarkedForDeletionButThereIsNoDefaultFinalizer() {
126128
markForDeletion(testCustomResource);
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package io.javaoperatorsdk.operator.sample.retry;
22

33
import io.javaoperatorsdk.operator.TestExecutionInfoProvider;
4-
import io.javaoperatorsdk.operator.api.*;
4+
import io.javaoperatorsdk.operator.api.Context;
5+
import io.javaoperatorsdk.operator.api.Controller;
6+
import io.javaoperatorsdk.operator.api.DeleteControl;
7+
import io.javaoperatorsdk.operator.api.ResourceController;
8+
import io.javaoperatorsdk.operator.api.UpdateControl;
59
import java.util.concurrent.atomic.AtomicInteger;
610
import org.slf4j.Logger;
711
import org.slf4j.LoggerFactory;

operator-framework/src/test/resources/io/javaoperatorsdk/operator/eventsource-test-crd.yaml renamed to operator-framework-core/src/test/resources/io/javaoperatorsdk/operator/eventsource-test-crd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ spec:
66
group: sample.javaoperatorsdk
77
version: v1
88
subresources:
9-
status: {}
9+
status: { }
1010
scope: Namespaced
1111
names:
1212
plural: eventsourcesamples

operator-framework/src/test/resources/io/javaoperatorsdk/operator/retry-test-crd.yaml renamed to operator-framework-core/src/test/resources/io/javaoperatorsdk/operator/retry-test-crd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ spec:
66
group: sample.javaoperatorsdk
77
version: v1
88
subresources:
9-
status: {}
9+
status: { }
1010
scope: Namespaced
1111
names:
1212
plural: retrysamples

operator-framework/src/test/resources/io/javaoperatorsdk/operator/subresource-test-crd.yaml renamed to operator-framework-core/src/test/resources/io/javaoperatorsdk/operator/subresource-test-crd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ spec:
66
group: sample.javaoperatorsdk
77
version: v1
88
subresources:
9-
status: {}
9+
status: { }
1010
scope: Namespaced
1111
names:
1212
plural: subresourcesample
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Configuration status="WARN">
3+
<Appenders>
4+
<Console name="Console" target="SYSTEM_OUT">
5+
<PatternLayout
6+
pattern="%style{%d}{yellow} %style{%threadId}{green} %style{%-30c{1.}}{cyan} %highlight{[%-5level] %msg%n%throwable}{INFO=black}"/>
7+
</Console>
8+
</Appenders>
9+
<Loggers>
10+
<Root level="debug">
11+
<AppenderRef ref="Console"/>
12+
</Root>
13+
</Loggers>
14+
</Configuration>

operator-framework/src/test/resources/log4j2.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</properties>
4242

4343
<modules>
44-
<module>operator-framework</module>
44+
<module>operator-framework-core</module>
4545
<module>spring-boot-starter</module>
4646
<module>samples</module>
4747
<module>quarkus-extension</module>

runtime-configuration/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<dependencies>
2121
<dependency>
2222
<groupId>io.javaoperatorsdk</groupId>
23-
<artifactId>operator-framework</artifactId>
23+
<artifactId>operator-framework-core</artifactId>
2424
<version>${project.version}</version>
2525
</dependency>
2626
<dependency>
@@ -75,7 +75,7 @@
7575
</dependency>
7676
<dependency>
7777
<groupId>io.javaoperatorsdk</groupId>
78-
<artifactId>operator-framework</artifactId>
78+
<artifactId>operator-framework-core</artifactId>
7979
<version>${project.version}</version>
8080
<classifier>tests</classifier>
8181
<type>test-jar</type>

0 commit comments

Comments
 (0)