generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update to informer configuration changes for controller (#895)
Requires JOSDK PR 2455 Signed-off-by: Chris Laprun <[email protected]>
- Loading branch information
Showing
7 changed files
with
179 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/OneNSConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package io.quarkiverse.operatorsdk.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.Set; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.javaoperatorsdk.operator.api.config.ConfigurationService; | ||
import io.quarkiverse.operatorsdk.test.sources.OneNSReconciler; | ||
import io.quarkiverse.operatorsdk.test.sources.TestCR; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OneNSConfigurationTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.overrideConfigKey("quarkus.operator-sdk.start-operator", "false") | ||
.withApplicationRoot( | ||
jar -> jar.addClasses(OneNSReconciler.class, TestCR.class)); | ||
|
||
@Inject | ||
ConfigurationService configurationService; | ||
|
||
@Inject | ||
OneNSReconciler testReconciler; | ||
|
||
@Test | ||
void checkDefaultOperatorLevelNamespaces() { | ||
final var config = configurationService.getConfigurationFor(testReconciler); | ||
assertEquals(Set.of(OneNSReconciler.NS), config.getNamespaces()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
core/deployment/src/test/java/io/quarkiverse/operatorsdk/test/sources/OneNSReconciler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.quarkiverse.operatorsdk.test.sources; | ||
|
||
import io.javaoperatorsdk.operator.api.reconciler.Context; | ||
import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration; | ||
import io.javaoperatorsdk.operator.api.reconciler.Reconciler; | ||
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl; | ||
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.InformerConfig; | ||
|
||
@ControllerConfiguration(informerConfig = @InformerConfig(namespaces = OneNSReconciler.NS)) | ||
public class OneNSReconciler implements Reconciler<TestCR> { | ||
|
||
public static final String NS = "foo"; | ||
|
||
@Override | ||
public UpdateControl<TestCR> reconcile(TestCR testCR, Context<TestCR> context) throws Exception { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.