diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/devconsole/ControllerInfo.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/devconsole/ControllerInfo.java index 90c6ca3cb..ced697854 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/devconsole/ControllerInfo.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/devconsole/ControllerInfo.java @@ -24,7 +24,7 @@ public ControllerInfo(Controller

controller) { .map(spec -> new DependentInfo(spec)) .sorted() .collect(Collectors.toCollection(LinkedHashSet::new)); - eventSources = controller.getEventSourceManager().getNamedEventSourcesStream() + eventSources = controller.getEventSourceManager().getEventSourcesStream() .map(EventSourceInfo::new) .sorted() .collect(Collectors.toCollection(LinkedHashSet::new)); @@ -66,7 +66,7 @@ public Set getDependents() { @SuppressWarnings("unused") public List

getKnownResources() { - return controller.getEventSourceManager().getControllerResourceEventSource().list() + return controller.getEventSourceManager().getControllerEventSource().list() .collect(Collectors.toList()); } } diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/devconsole/EventSourceInfo.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/devconsole/EventSourceInfo.java index dd7cdbe6c..4aff19a55 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/devconsole/EventSourceInfo.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/devconsole/EventSourceInfo.java @@ -1,11 +1,15 @@ package io.quarkiverse.operatorsdk.runtime.devconsole; -import io.javaoperatorsdk.operator.processing.event.EventSourceMetadata; +import java.util.Optional; + +import io.fabric8.kubernetes.api.model.HasMetadata; +import io.javaoperatorsdk.operator.processing.event.source.Configurable; +import io.javaoperatorsdk.operator.processing.event.source.EventSource; public class EventSourceInfo implements Comparable { - private final EventSourceMetadata metadata; + private final EventSource metadata; - public EventSourceInfo(EventSourceMetadata metadata) { + public EventSourceInfo(EventSource metadata) { this.metadata = metadata; } @@ -15,11 +19,16 @@ public String getName() { @SuppressWarnings("unused") public String getResourceClass() { - return metadata.resourceType().map(Class::getName).orElse(null); + return metadata.resourceType().getName(); } public String getType() { - return metadata.type().getName(); + return metadata.getClass().getName(); + } + + public Optional getConfiguration() { + return metadata instanceof Configurable ? Optional.of(((Configurable) metadata).configuration()) + : Optional.empty(); } @Override diff --git a/samples/mysql-schema/src/main/java/io/quarkiverse/operatorsdk/samples/mysqlschema/dependent/SchemaDependentResource.java b/samples/mysql-schema/src/main/java/io/quarkiverse/operatorsdk/samples/mysqlschema/dependent/SchemaDependentResource.java index 4c5e30f6d..72c2478c3 100644 --- a/samples/mysql-schema/src/main/java/io/quarkiverse/operatorsdk/samples/mysqlschema/dependent/SchemaDependentResource.java +++ b/samples/mysql-schema/src/main/java/io/quarkiverse/operatorsdk/samples/mysqlschema/dependent/SchemaDependentResource.java @@ -5,6 +5,7 @@ import java.sql.Connection; import java.sql.SQLException; +import java.time.Duration; import java.util.Base64; import java.util.Collections; import java.util.Optional; @@ -19,7 +20,6 @@ import io.fabric8.kubernetes.api.model.Secret; import io.javaoperatorsdk.operator.api.reconciler.Context; import io.javaoperatorsdk.operator.api.reconciler.dependent.Deleter; -import io.javaoperatorsdk.operator.api.reconciler.dependent.EventSourceProvider; import io.javaoperatorsdk.operator.api.reconciler.dependent.managed.DependentResourceConfigurator; import io.javaoperatorsdk.operator.processing.dependent.Creator; import io.javaoperatorsdk.operator.processing.dependent.external.PerResourcePollingDependentResource; @@ -30,7 +30,7 @@ @ApplicationScoped public class SchemaDependentResource extends PerResourcePollingDependentResource - implements EventSourceProvider, + implements DependentResourceConfigurator, Creator, Deleter { @@ -47,13 +47,13 @@ public SchemaDependentResource() { @Override public void configureWith(ResourcePollerConfig config) { if (config != null) { - setPollingPeriod(config.getPollPeriod()); + setPollingPeriod(Duration.ofSeconds(config.getPollPeriod())); } } @Override public Optional configuration() { - return Optional.of(new ResourcePollerConfig((int) getPollingPeriod())); + return Optional.of(new ResourcePollerConfig((int) getPollingPeriod().toSeconds())); } @Override