Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ public Builder<R> withNamespaces(Set<String> namespaces) {
return this;
}

/**
* @since 5.1.1
*/
public Builder<R> withNamespaces(String... namespaces) {
config.withNamespaces(Set.of(namespaces));
return this;
}

public Builder<R> withNamespacesInheritedFromController() {
withNamespaces(SAME_AS_CONTROLLER_NAMESPACES_SET);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ private io.javaoperatorsdk.operator.api.config.ControllerConfiguration<?> create
return configurationService.configFor(reconciler);
}

@Test
void overridingNamespacesShouldNotThrowNPE() {
var configuration = createConfiguration(new NullReconciler());
configuration =
ControllerConfigurationOverrider.override(configuration).settingNamespaces().build();
assertTrue(configuration.getInformerConfig().watchAllNamespaces());
}

private static class NullReconciler implements Reconciler<HasMetadata> {
@Override
public UpdateControl<HasMetadata> reconcile(HasMetadata resource, Context<HasMetadata> context)
throws Exception {
return null;
}
}

@Test
void overridingNamespacesShouldWork() {
var configuration = createConfiguration(new WatchCurrentReconciler());
Expand Down
Loading