Skip to content

Commit

Permalink
Expose operator's ApiClient (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannedolan authored Aug 14, 2023
1 parent 407b256 commit d90a9c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.parallel=true

Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ public class HoptimatorOperatorApp {

final String modelPath;
final String namespace;
final ApiClient apiClient;
final Properties properties;
final Resource.Environment environment;

/** This constructor is likely to evolve and break. */
public HoptimatorOperatorApp(String modelPath, String namespace, Properties properties) {
public HoptimatorOperatorApp(String modelPath, String namespace, ApiClient apiClient, Properties properties) {
this.modelPath = modelPath;
this.namespace = namespace;
this.apiClient = apiClient;
this.properties = properties;
this.environment = new Resource.SimpleEnvironment(properties);
}
Expand Down Expand Up @@ -73,7 +75,8 @@ public static void main(String[] args) throws Exception {
String modelFileInput = cmd.getArgs()[0];
String namespaceInput = cmd.getOptionValue("namespace", "default");

new HoptimatorOperatorApp(modelFileInput, namespaceInput, new Properties()).run();
new HoptimatorOperatorApp(modelFileInput, namespaceInput, Config.defaultClient(),
new Properties()).run();
}

public void run() throws Exception {
Expand All @@ -83,7 +86,6 @@ public void run() throws Exception {
// ensure model file works, and that static classes are initialized in the main thread
HoptimatorPlanner planner = plannerFactory.makePlanner();

ApiClient apiClient = Config.defaultClient();
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder()
.readTimeout(0, TimeUnit.SECONDS).build());
SharedInformerFactory informerFactory = new SharedInformerFactory(apiClient);
Expand Down

0 comments on commit d90a9c5

Please # to comment.