Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed max replicas value #212

Merged
merged 1 commit into from
Jun 17, 2021
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 @@ -302,6 +302,10 @@ public static FunctionConfig createFunctionConfigFromV1alpha1Function(String ten
customRuntimeOptions.setClusterName(v1alpha1FunctionSpec.getClusterName());
}

if (v1alpha1FunctionSpec.getMaxReplicas() != null && v1alpha1FunctionSpec.getMaxReplicas() > 0) {
customRuntimeOptions.setMaxReplicas(v1alpha1FunctionSpec.getMaxReplicas());
}

if (v1alpha1FunctionSpecInput.getTopics() != null) {
for (String topic : v1alpha1FunctionSpecInput.getTopics()) {
ConsumerConfig consumerConfig = new ConsumerConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ public static SinkConfig createSinkConfigFromV1alpha1Sink(
if (Strings.isNotEmpty(v1alpha1SinkSpec.getClusterName())) {
customRuntimeOptions.setClusterName(v1alpha1SinkSpec.getClusterName());
}
if (v1alpha1SinkSpec.getMaxReplicas() != null && v1alpha1SinkSpec.getMaxReplicas() > 0) {
customRuntimeOptions.setMaxReplicas(v1alpha1SinkSpec.getMaxReplicas());
}

if (v1alpha1SinkSpecInput.getTopics() != null) {
for (String topic : v1alpha1SinkSpecInput.getTopics()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ public static SourceConfig createSourceConfigFromV1alpha1Source(String tenant, S
customRuntimeOptions.setClusterName(v1alpha1SourceSpec.getClusterName());
}

if (v1alpha1SourceSpec.getMaxReplicas() != null && v1alpha1SourceSpec.getMaxReplicas() > 0) {
customRuntimeOptions.setMaxReplicas(v1alpha1SourceSpec.getMaxReplicas());
}

if (v1alpha1SourceSpec.getSourceConfig() != null) {
sourceConfig.setConfigs(new HashMap<>(v1alpha1SourceSpec.getSourceConfig()));
}
Expand All @@ -300,6 +304,7 @@ public static SourceConfig createSourceConfigFromV1alpha1Source(String tenant, S
sourceConfig.setRuntimeFlags(v1alpha1SourceSpec.getRuntimeFlags());
}


if (v1alpha1SourceSpec.getJava() != null && Strings.isNotEmpty(v1alpha1SourceSpec.getJava().getJar())) {
sourceConfig.setArchive(v1alpha1SourceSpec.getJava().getJar());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ public void testGetSinkInfo() throws ApiException, IOException {
Double cpu = 0.1;
Long ram = 1L;
String clusterName = "test-pulsar";
String customRuntimeOptions = "{\"clusterName\":\"" + clusterName + "\",\"maxReplicas\":0}";
String customRuntimeOptions = "{\"clusterName\":\"" + clusterName + "\",\"maxReplicas\":1}";
Map<String, Object> configs = new HashMap<>();
configs.put("elasticSearchUrl", "https://testing-es.app");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ public void testGetSourceInfo()
Double cpu = 0.1;
Long ram = 1L;
String clusterName = "test-pulsar";
String customRuntimeOptions = "{\"clusterName\":\"" + clusterName + "\",\"maxReplicas\":0}";
String customRuntimeOptions = "{\"clusterName\":\"" + clusterName + "\",\"maxReplicas\":1}";
Map<String, Object> configs = new HashMap<>();
String configsName = "test-sourceConfig";
configs.put("name", configsName);
Expand Down