-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
154 additions
and
2 deletions.
There are no files selected for viewing
150 changes: 150 additions & 0 deletions
150
operator/src/main/java/com/redhat/agogos/k8s/AgogosConfigurationServiceProvider.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,150 @@ | ||
package com.redhat.agogos.k8s; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; | ||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.fabric8.kubernetes.client.Config; | ||
import io.javaoperatorsdk.operator.api.config.*; | ||
import io.javaoperatorsdk.operator.api.monitoring.Metrics; | ||
import io.javaoperatorsdk.operator.api.reconciler.Reconciler; | ||
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResourceFactory; | ||
import io.javaoperatorsdk.operator.processing.dependent.workflow.ManagedWorkflowFactory; | ||
import io.quarkiverse.operatorsdk.runtime.QuarkusConfigurationService; | ||
import io.quarkiverse.operatorsdk.runtime.QuarkusControllerConfiguration; | ||
|
||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
import java.time.Duration; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.concurrent.ExecutorService; | ||
|
||
public class AgogosConfigurationServiceProvider { | ||
@Inject | ||
QuarkusConfigurationService qosdkConfigurationService; | ||
|
||
@Produces | ||
@Singleton | ||
AgogosConfigurationService congfigurationService() { | ||
return new AgogosConfigurationService(qosdkConfigurationService); | ||
} | ||
|
||
public static class AgogosConfigurationService implements ConfigurationService { | ||
|
||
private final QuarkusConfigurationService delegate; | ||
private final ObjectMapper mapper; | ||
|
||
@Override | ||
public Config getClientConfiguration() { | ||
return delegate.getClientConfiguration(); | ||
} | ||
|
||
@Override | ||
public <R extends HasMetadata> QuarkusControllerConfiguration<R> getConfigurationFor(Reconciler<R> reconciler) { | ||
return delegate.getConfigurationFor(reconciler); | ||
} | ||
|
||
@Override | ||
public boolean checkCRDAndValidateLocalModel() { | ||
return delegate.checkCRDAndValidateLocalModel(); | ||
} | ||
|
||
@Override | ||
public int concurrentReconciliationThreads() { | ||
return delegate.concurrentReconciliationThreads(); | ||
} | ||
|
||
@Override | ||
public int getTerminationTimeoutSeconds() { | ||
return delegate.getTerminationTimeoutSeconds(); | ||
} | ||
|
||
@Override | ||
public Metrics getMetrics() { | ||
return delegate.getMetrics(); | ||
} | ||
|
||
@Override | ||
public Optional<LeaderElectionConfiguration> getLeaderElectionConfiguration() { | ||
return delegate.getLeaderElectionConfiguration(); | ||
} | ||
|
||
@Override | ||
public Optional<InformerStoppedHandler> getInformerStoppedHandler() { | ||
return delegate.getInformerStoppedHandler(); | ||
} | ||
|
||
@Override | ||
public int concurrentWorkflowExecutorThreads() { | ||
return delegate.concurrentWorkflowExecutorThreads(); | ||
} | ||
|
||
@Override | ||
public boolean closeClientOnStop() { | ||
return delegate.closeClientOnStop(); | ||
} | ||
|
||
@Override | ||
public boolean stopOnInformerErrorDuringStartup() { | ||
return delegate.stopOnInformerErrorDuringStartup(); | ||
} | ||
|
||
@Override | ||
public Duration cacheSyncTimeout() { | ||
return delegate.cacheSyncTimeout(); | ||
} | ||
|
||
@Override | ||
public DependentResourceFactory<QuarkusControllerConfiguration<?>> dependentResourceFactory() { | ||
return delegate.dependentResourceFactory(); | ||
} | ||
|
||
@Override | ||
public ManagedWorkflowFactory<QuarkusControllerConfiguration<?>> getWorkflowFactory() { | ||
return delegate.getWorkflowFactory(); | ||
} | ||
|
||
@Override | ||
public Set<String> getKnownReconcilerNames() { | ||
return delegate.getKnownReconcilerNames(); | ||
} | ||
|
||
@Override | ||
public Version getVersion() { | ||
return delegate.getVersion(); | ||
} | ||
|
||
@Override | ||
public Cloner getResourceCloner() { | ||
return delegate.getResourceCloner(); | ||
} | ||
|
||
@Override | ||
public ObjectMapper getObjectMapper() { | ||
return mapper; | ||
} | ||
|
||
@Override | ||
public ExecutorService getExecutorService() { | ||
return delegate.getExecutorService(); | ||
} | ||
|
||
@Override | ||
public ExecutorService getWorkflowExecutorService() { | ||
return delegate.getWorkflowExecutorService(); | ||
} | ||
|
||
@Override | ||
public ResourceClassResolver getResourceClassResolver() { | ||
return delegate.getResourceClassResolver(); | ||
} | ||
|
||
public AgogosConfigurationService(QuarkusConfigurationService delegate) { | ||
this.delegate = delegate; | ||
mapper = new ObjectMapper(); | ||
mapper.registerModule(new JavaTimeModule()); | ||
} | ||
} | ||
} |
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