Skip to content

Commit d90a9c5

Browse files
authored
Expose operator's ApiClient (#47)
1 parent 407b256 commit d90a9c5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.gradle.parallel=true
2+

hoptimator-operator/src/main/java/com/linkedin/hoptimator/operator/HoptimatorOperatorApp.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ public class HoptimatorOperatorApp {
3434

3535
final String modelPath;
3636
final String namespace;
37+
final ApiClient apiClient;
3738
final Properties properties;
3839
final Resource.Environment environment;
3940

4041
/** This constructor is likely to evolve and break. */
41-
public HoptimatorOperatorApp(String modelPath, String namespace, Properties properties) {
42+
public HoptimatorOperatorApp(String modelPath, String namespace, ApiClient apiClient, Properties properties) {
4243
this.modelPath = modelPath;
4344
this.namespace = namespace;
45+
this.apiClient = apiClient;
4446
this.properties = properties;
4547
this.environment = new Resource.SimpleEnvironment(properties);
4648
}
@@ -73,7 +75,8 @@ public static void main(String[] args) throws Exception {
7375
String modelFileInput = cmd.getArgs()[0];
7476
String namespaceInput = cmd.getOptionValue("namespace", "default");
7577

76-
new HoptimatorOperatorApp(modelFileInput, namespaceInput, new Properties()).run();
78+
new HoptimatorOperatorApp(modelFileInput, namespaceInput, Config.defaultClient(),
79+
new Properties()).run();
7780
}
7881

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

86-
ApiClient apiClient = Config.defaultClient();
8789
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder()
8890
.readTimeout(0, TimeUnit.SECONDS).build());
8991
SharedInformerFactory informerFactory = new SharedInformerFactory(apiClient);

0 commit comments

Comments
 (0)