Skip to content

Commit ea18649

Browse files
committed
wip
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent a82f09a commit ea18649

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright Java Operator SDK Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io;
17+
18+
import io.fabric8.kubernetes.client.CustomResource;
19+
import io.javaoperatorsdk.operator.api.reconciler.Context;
20+
import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration;
21+
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
22+
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
23+
24+
/**
25+
* The reconciled resource is itself a generic type, so the resolved resource type is a
26+
* parameterized {@code DeclaredType}. Only its erasure can be written to the mapping resource,
27+
* because that is the only form {@code ClassMappingProvider} is able to load at runtime.
28+
*/
29+
@ControllerConfiguration
30+
public class GenericResourceReconciler implements
31+
Reconciler<GenericResourceReconciler.MyGenericCustomResource<String>> {
32+
33+
public static class MyGenericCustomResource<S> extends CustomResource<S, Void> {
34+
}
35+
36+
@Override
37+
public UpdateControl<MyGenericCustomResource<String>> reconcile(
38+
MyGenericCustomResource<String> customResource,
39+
Context<MyGenericCustomResource<String>> context) {
40+
return UpdateControl.noUpdate();
41+
}
42+
}

0 commit comments

Comments
 (0)