Skip to content

Commit 65bf68d

Browse files
csvirimetacosm
authored andcommitted
improve: remove deprecated APIs (#2375)
Signed-off-by: Attila Mészáros <[email protected]>
1 parent e53a84c commit 65bf68d

File tree

22 files changed

+27
-300
lines changed

22 files changed

+27
-300
lines changed

micrometer-support/src/main/java/io/javaoperatorsdk/operator/monitoring/micrometer/MicrometerMetrics.java

-14
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,6 @@ public class MicrometerMetrics implements Metrics {
5959
private final Map<String, AtomicInteger> gauges = new ConcurrentHashMap<>();
6060
private final Cleaner cleaner;
6161

62-
/**
63-
* Creates a default micrometer-based Metrics implementation, collecting metrics on a per resource
64-
* basis and not dealing with cleaning these after these resources are deleted. Note that this
65-
* probably will change in a future release. If you want more control over what the implementation
66-
* actually does, please use the static factory methods instead.
67-
*
68-
* @param registry the {@link MeterRegistry} instance to use for metrics recording
69-
* @deprecated Use the factory methods / builders instead
70-
*/
71-
@Deprecated
72-
public MicrometerMetrics(MeterRegistry registry) {
73-
this(registry, Cleaner.NOOP, true);
74-
}
75-
7662
/**
7763
* Creates a MicrometerMetrics instance configured to not collect per-resource metrics, just
7864
* aggregates per resource **type**

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

+2-14
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public Operator() {
3535
}
3636

3737
Operator(KubernetesClient kubernetesClient) {
38-
this(kubernetesClient, null);
38+
this(initConfigurationService(kubernetesClient, null));
3939
}
4040

4141
/**
@@ -63,19 +63,7 @@ public Operator(ConfigurationService configurationService) {
6363
* {@link ConfigurationService} values
6464
*/
6565
public Operator(Consumer<ConfigurationServiceOverrider> overrider) {
66-
this(null, overrider);
67-
}
68-
69-
/**
70-
* @param client client to use to all Kubernetes related operations
71-
* @param overrider a {@link ConfigurationServiceOverrider} consumer used to override the default
72-
* {@link ConfigurationService} values
73-
* @deprecated Use {@link Operator#Operator(Consumer)} instead, passing your custom client with
74-
* {@link ConfigurationServiceOverrider#withKubernetesClient(KubernetesClient)}
75-
*/
76-
@Deprecated(since = "4.4.0")
77-
public Operator(KubernetesClient client, Consumer<ConfigurationServiceOverrider> overrider) {
78-
this(initConfigurationService(client, overrider));
66+
this(initConfigurationService(null, overrider));
7967
}
8068

8169
private static ConfigurationService initConfigurationService(KubernetesClient client,

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

-32
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ default boolean checkCRDAndValidateLocalModel() {
132132
}
133133

134134
int DEFAULT_RECONCILIATION_THREADS_NUMBER = 50;
135-
/**
136-
* @deprecated Not used anymore in the default implementation
137-
*/
138-
@Deprecated(forRemoval = true)
139-
int MIN_DEFAULT_RECONCILIATION_THREADS_NUMBER = 10;
140135

141136
/**
142137
* The number of threads the operator can spin out to dispatch reconciliation requests to
@@ -148,23 +143,7 @@ default int concurrentReconciliationThreads() {
148143
return DEFAULT_RECONCILIATION_THREADS_NUMBER;
149144
}
150145

151-
/**
152-
* The minimum number of threads the operator starts in the thread pool for reconciliations.
153-
*
154-
* @deprecated not used anymore by default executor implementation
155-
* @return the minimum number of concurrent reconciliation threads
156-
*/
157-
@Deprecated(forRemoval = true)
158-
default int minConcurrentReconciliationThreads() {
159-
return MIN_DEFAULT_RECONCILIATION_THREADS_NUMBER;
160-
}
161-
162146
int DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER = DEFAULT_RECONCILIATION_THREADS_NUMBER;
163-
/**
164-
* @deprecated Not used anymore in the default implementation
165-
*/
166-
@Deprecated(forRemoval = true)
167-
int MIN_DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER = MIN_DEFAULT_RECONCILIATION_THREADS_NUMBER;
168147

169148
/**
170149
* Number of threads the operator can spin out to be used in the workflows with the default
@@ -176,17 +155,6 @@ default int concurrentWorkflowExecutorThreads() {
176155
return DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER;
177156
}
178157

179-
/**
180-
* The minimum number of threads the operator starts in the thread pool for workflows.
181-
*
182-
* @deprecated not used anymore by default executor implementation
183-
* @return the minimum number of concurrent workflow threads
184-
*/
185-
@Deprecated(forRemoval = true)
186-
default int minConcurrentWorkflowExecutorThreads() {
187-
return MIN_DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER;
188-
}
189-
190158
default Metrics getMetrics() {
191159
return Metrics.NOOP;
192160
}

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

+2-54
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.Optional;
55
import java.util.Set;
66
import java.util.concurrent.ExecutorService;
7-
import java.util.function.Consumer;
87
import java.util.function.Function;
98

109
import org.slf4j.Logger;
@@ -23,9 +22,7 @@ public class ConfigurationServiceOverrider {
2322
private Metrics metrics;
2423
private Boolean checkCR;
2524
private Integer concurrentReconciliationThreads;
26-
private Integer minConcurrentReconciliationThreads;
2725
private Integer concurrentWorkflowExecutorThreads;
28-
private Integer minConcurrentWorkflowExecutorThreads;
2926
private Cloner cloner;
3027
private Boolean closeClientOnStop;
3128
private KubernetesClient client;
@@ -64,24 +61,6 @@ public ConfigurationServiceOverrider withConcurrentWorkflowExecutorThreads(int t
6461
return this;
6562
}
6663

67-
private int minimumMaxValueFor(Integer minValue) {
68-
return minValue != null ? (minValue < 0 ? 0 : minValue) + 1 : 1;
69-
}
70-
71-
public ConfigurationServiceOverrider withMinConcurrentReconciliationThreads(int threadNumber) {
72-
this.minConcurrentReconciliationThreads = Utils.ensureValid(threadNumber,
73-
"minimum reconciliation threads", ExecutorServiceManager.MIN_THREAD_NUMBER,
74-
original.minConcurrentReconciliationThreads());
75-
return this;
76-
}
77-
78-
public ConfigurationServiceOverrider withMinConcurrentWorkflowExecutorThreads(int threadNumber) {
79-
this.minConcurrentWorkflowExecutorThreads = Utils.ensureValid(threadNumber,
80-
"minimum workflow execution threads", ExecutorServiceManager.MIN_THREAD_NUMBER,
81-
original.minConcurrentWorkflowExecutorThreads());
82-
return this;
83-
}
84-
8564
@SuppressWarnings("rawtypes")
8665
public ConfigurationServiceOverrider withDependentResourceFactory(
8766
DependentResourceFactory dependentResourceFactory) {
@@ -222,7 +201,7 @@ public int concurrentReconciliationThreads() {
222201
overriddenValueOrDefault(concurrentReconciliationThreads,
223202
ConfigurationService::concurrentReconciliationThreads),
224203
"maximum reconciliation threads",
225-
minimumMaxValueFor(minConcurrentReconciliationThreads),
204+
1,
226205
original.concurrentReconciliationThreads());
227206
}
228207

@@ -232,30 +211,10 @@ public int concurrentWorkflowExecutorThreads() {
232211
overriddenValueOrDefault(concurrentWorkflowExecutorThreads,
233212
ConfigurationService::concurrentWorkflowExecutorThreads),
234213
"maximum workflow execution threads",
235-
minimumMaxValueFor(minConcurrentWorkflowExecutorThreads),
214+
1,
236215
original.concurrentWorkflowExecutorThreads());
237216
}
238217

239-
/**
240-
* @deprecated Not used anymore in the default implementation
241-
*/
242-
@Deprecated(forRemoval = true)
243-
@Override
244-
public int minConcurrentReconciliationThreads() {
245-
return overriddenValueOrDefault(minConcurrentReconciliationThreads,
246-
ConfigurationService::minConcurrentReconciliationThreads);
247-
}
248-
249-
/**
250-
* @deprecated Not used anymore in the default implementation
251-
*/
252-
@Override
253-
@Deprecated(forRemoval = true)
254-
public int minConcurrentWorkflowExecutorThreads() {
255-
return overriddenValueOrDefault(minConcurrentWorkflowExecutorThreads,
256-
ConfigurationService::minConcurrentWorkflowExecutorThreads);
257-
}
258-
259218
@Override
260219
public Metrics getMetrics() {
261220
return overriddenValueOrDefault(metrics, ConfigurationService::getMetrics);
@@ -344,15 +303,4 @@ public boolean cloneSecondaryResourcesWhenGettingFromCache() {
344303
};
345304
}
346305

347-
/**
348-
* @deprecated Use
349-
* {@link ConfigurationService#newOverriddenConfigurationService(ConfigurationService, Consumer)}
350-
* instead
351-
* @param original that will be overridden
352-
* @return current overrider
353-
*/
354-
@Deprecated(since = "2.2.0")
355-
public static ConfigurationServiceOverrider override(ConfigurationService original) {
356-
return new ConfigurationServiceOverrider(original);
357-
}
358306
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
public class ExecutorServiceManager {
2323

2424
private static final Logger log = LoggerFactory.getLogger(ExecutorServiceManager.class);
25-
public static final int MIN_THREAD_NUMBER = 0;
2625
private ExecutorService executor;
2726
private ExecutorService workflowExecutor;
2827
private ExecutorService cachingExecutorService;

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

+2-56
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.javaoperatorsdk.operator.api.monitoring;
22

3-
import java.util.Collections;
43
import java.util.Map;
54

65
import io.fabric8.kubernetes.api.model.HasMetadata;
@@ -37,16 +36,6 @@ default void controllerRegistered(Controller<? extends HasMetadata> controller)
3736
*/
3837
default void receivedEvent(Event event, Map<String, Object> metadata) {}
3938

40-
/**
41-
* @param metadata additional metadata
42-
* @param resourceID of primary resource
43-
* @param retryInfo for current execution
44-
* @deprecated Use {@link #reconcileCustomResource(HasMetadata, RetryInfo, Map)} instead
45-
*/
46-
@Deprecated(forRemoval = true)
47-
@SuppressWarnings("unused")
48-
default void reconcileCustomResource(ResourceID resourceID, RetryInfo retryInfo,
49-
Map<String, Object> metadata) {}
5039

5140
/**
5241
* Called right before a resource is dispatched to the ExecutorService for reconciliation.
@@ -56,19 +45,6 @@ default void reconcileCustomResource(ResourceID resourceID, RetryInfo retryInfo,
5645
* @param metadata metadata associated with the resource being processed
5746
*/
5847
default void reconcileCustomResource(HasMetadata resource, RetryInfo retryInfo,
59-
Map<String, Object> metadata) {
60-
reconcileCustomResource(ResourceID.fromResource(resource), retryInfo, metadata);
61-
}
62-
63-
/**
64-
* @param exception actual exception
65-
* @param metadata additional metadata
66-
* @param resourceID of primary resource
67-
* @deprecated Use {@link #failedReconciliation(HasMetadata, Exception, Map)} instead
68-
*/
69-
@Deprecated(forRemoval = true)
70-
@SuppressWarnings("unused")
71-
default void failedReconciliation(ResourceID resourceID, Exception exception,
7248
Map<String, Object> metadata) {}
7349

7450
/**
@@ -81,24 +57,14 @@ default void failedReconciliation(ResourceID resourceID, Exception exception,
8157
* @param metadata metadata associated with the resource being processed
8258
*/
8359
default void failedReconciliation(HasMetadata resource, Exception exception,
84-
Map<String, Object> metadata) {
85-
failedReconciliation(ResourceID.fromResource(resource), exception, metadata);
86-
}
60+
Map<String, Object> metadata) {}
8761

8862

8963
default void reconciliationExecutionStarted(HasMetadata resource, Map<String, Object> metadata) {}
9064

9165
default void reconciliationExecutionFinished(HasMetadata resource,
9266
Map<String, Object> metadata) {}
9367

94-
/**
95-
* @param resourceID of primary resource
96-
* @deprecated Use (and implement) {@link #cleanupDoneFor(ResourceID, Map)} instead
97-
*/
98-
@Deprecated
99-
default void cleanupDoneFor(ResourceID resourceID) {
100-
cleanupDoneFor(resourceID, Collections.emptyMap());
101-
}
10268

10369
/**
10470
* Called when the resource associated with the specified {@link ResourceID} has been successfully
@@ -109,24 +75,6 @@ default void cleanupDoneFor(ResourceID resourceID) {
10975
*/
11076
default void cleanupDoneFor(ResourceID resourceID, Map<String, Object> metadata) {}
11177

112-
/**
113-
* @param resourceID of primary resource
114-
* @deprecated Use (and implement) {@link #finishedReconciliation(ResourceID, Map)} instead
115-
*/
116-
@Deprecated
117-
default void finishedReconciliation(ResourceID resourceID) {
118-
finishedReconciliation(resourceID, Collections.emptyMap());
119-
}
120-
121-
/**
122-
* @param resourceID of primary resource
123-
* @param metadata additional metadata
124-
* @deprecated Use {@link #finishedReconciliation(HasMetadata, Map)} instead
125-
*/
126-
@Deprecated(forRemoval = true)
127-
@SuppressWarnings("unused")
128-
default void finishedReconciliation(ResourceID resourceID, Map<String, Object> metadata) {}
129-
13078
/**
13179
* Called when the
13280
* {@link io.javaoperatorsdk.operator.api.reconciler.Reconciler#reconcile(HasMetadata, Context)}
@@ -136,9 +84,7 @@ default void finishedReconciliation(ResourceID resourceID, Map<String, Object> m
13684
* @param resource the {@link ResourceID} associated with the resource being processed
13785
* @param metadata metadata associated with the resource being processed
13886
*/
139-
default void finishedReconciliation(HasMetadata resource, Map<String, Object> metadata) {
140-
finishedReconciliation(ResourceID.fromResource(resource), metadata);
141-
}
87+
default void finishedReconciliation(HasMetadata resource, Map<String, Object> metadata) {}
14288

14389
/**
14490
* Encapsulates the information about a controller execution i.e. a call to either

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/dependent/managed/KubernetesClientAware.java

-15
This file was deleted.

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/kubernetes/KubernetesDependentResourceConfig.java

-15
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,6 @@ public KubernetesDependentResourceConfig(Set<String> namespaces,
5252
this.useSSA = useSSA;
5353
}
5454

55-
// use builder instead
56-
@Deprecated(forRemoval = true)
57-
public KubernetesDependentResourceConfig(Set<String> namespaces, String labelSelector) {
58-
this(namespaces, labelSelector, true, DEFAULT_CREATE_RESOURCE_ONLY_IF_NOT_EXISTING_WITH_SSA,
59-
null, null,
60-
null, null, null);
61-
}
62-
63-
// use builder instead
64-
@Deprecated(forRemoval = true)
65-
public KubernetesDependentResourceConfig<R> setLabelSelector(String labelSelector) {
66-
this.labelSelector = labelSelector;
67-
return this;
68-
}
69-
7055
public Set<String> namespaces() {
7156
return namespaces;
7257
}

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/DefaultManagedWorkflow.java

-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
1414
import io.javaoperatorsdk.operator.api.reconciler.dependent.EventSourceReferencer;
1515
import io.javaoperatorsdk.operator.api.reconciler.dependent.NameSetter;
16-
import io.javaoperatorsdk.operator.api.reconciler.dependent.managed.KubernetesClientAware;
1716

1817
import static io.javaoperatorsdk.operator.api.reconciler.Constants.NO_VALUE_SET;
1918

@@ -112,10 +111,6 @@ private <R> DependentResource<R, P> resolve(DependentResourceSpec<R, P> spec,
112111
((NameSetter) dependentResource).setName(name);
113112
}
114113

115-
if (dependentResource instanceof KubernetesClientAware) {
116-
((KubernetesClientAware) dependentResource).setKubernetesClient(client);
117-
}
118-
119114
spec.getUseEventSourceWithName()
120115
.ifPresent(esName -> {
121116
if (dependentResource instanceof EventSourceReferencer) {

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/WorkflowResult.java

-9
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@ public Map<DependentResource, Exception> getErroredDependents() {
2121
return erroredDependents;
2222
}
2323

24-
/**
25-
* @deprecated Use {@link #erroredDependentsExist()} instead
26-
* @return if any dependents are in error state
27-
*/
28-
@Deprecated(forRemoval = true)
29-
public boolean erroredDependentsExists() {
30-
return !erroredDependents.isEmpty();
31-
}
32-
3324
@SuppressWarnings("unused")
3425
public boolean erroredDependentsExist() {
3526
return !erroredDependents.isEmpty();

0 commit comments

Comments
 (0)