Skip to content

Commit

Permalink
Fix connector resource defaults location (#7342)
Browse files Browse the repository at this point in the history
  • Loading branch information
gosusnp committed Jun 20, 2023
1 parent a974e58 commit 4ec8ad7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
10 changes: 0 additions & 10 deletions airbyte-container-orchestrator/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,6 @@ airbyte:
cpu-request: ${REPLICATION_ORCHESTRATOR_CPU_REQUEST:}
memory-limit: ${REPLICATION_ORCHESTRATOR_MEMORY_LIMIT:}
memory-request: ${REPLICATION_ORCHESTRATOR_MEMORY_REQUEST:}
source:
cpu-limit: ${SOURCE_CONTAINER_CPU_LIMIT:}
cpu-request: ${SOURCE_CONTAINER_CPU_REQUEST:0.5}
memory-limit: ${SOURCE_CONTAINER_MEMORY_LIMIT:}
memory-request: ${SOURCE_CONTAINER_MEMORY_REQUEST:}
source-database:
cpu-limit: ${SOURCE_DATABASE_CONTAINER_CPU_LIMIT:}
cpu-request: ${SOURCE_DATABASE_CONTAINER_CPU_REQUEST:1}
memory-limit: ${SOURCE_DATABASE_CONTAINER_MEMORY_LIMIT:}
memory-request: ${SOURCE_DATABASE_CONTAINER_MEMORY_REQUEST:}
replication:
persistence-flush-period-sec: ${REPLICATION_FLUSH_PERIOD_SECONDS:60}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import io.airbyte.commons.features.FeatureFlags;
import io.airbyte.config.EnvConfigs;
import io.airbyte.config.ResourceRequirements;
import io.airbyte.config.ResourceRequirementsType;
import io.airbyte.featureflag.FeatureFlagClient;
import io.airbyte.featureflag.TestClient;
import io.airbyte.persistence.job.models.JobRunConfig;
Expand All @@ -32,7 +30,6 @@
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import java.util.Map;
import java.util.Optional;
import org.junit.jupiter.api.Test;

// tests may be running on a real k8s environment, override the environment to something else for
Expand Down Expand Up @@ -125,24 +122,4 @@ void jobOrchestrator() {
assertTrue(caught, "invalid application name should have thrown an exception");
}

@Test
void checkDatabaseSourceResourceRequirements() {
final ResourceRequirements resourceRequirements =
workerConfigsProvider.getResourceRequirements(ResourceRequirementsType.SOURCE, Optional.of("database"));

assertEquals("1", resourceRequirements.getCpuRequest());
// This is verifying that we are inheriting the value from default.
assertEquals("1", resourceRequirements.getCpuLimit());
}

@Test
void checkSourceResourceRequirements() {
final ResourceRequirements resourceRequirements =
workerConfigsProvider.getResourceRequirements(ResourceRequirementsType.SOURCE, Optional.of("any"));

assertEquals("0.5", resourceRequirements.getCpuRequest());
// This is verifying that we are inheriting the value from default.
assertEquals("1", resourceRequirements.getCpuLimit());
}

}
10 changes: 10 additions & 0 deletions airbyte-workers/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ airbyte:
cpu-request: ${REPLICATION_ORCHESTRATOR_CPU_REQUEST:}
memory-limit: ${REPLICATION_ORCHESTRATOR_MEMORY_LIMIT:}
memory-request: ${REPLICATION_ORCHESTRATOR_MEMORY_REQUEST:}
source:
cpu-limit: ${SOURCE_CONTAINER_CPU_LIMIT:}
cpu-request: ${SOURCE_CONTAINER_CPU_REQUEST:0.5}
memory-limit: ${SOURCE_CONTAINER_MEMORY_LIMIT:}
memory-request: ${SOURCE_CONTAINER_MEMORY_REQUEST:}
source-database:
cpu-limit: ${SOURCE_DATABASE_CONTAINER_CPU_LIMIT:}
cpu-request: ${SOURCE_DATABASE_CONTAINER_CPU_REQUEST:1}
memory-limit: ${SOURCE_DATABASE_CONTAINER_MEMORY_LIMIT:}
memory-request: ${SOURCE_DATABASE_CONTAINER_MEMORY_REQUEST:}
spec:
annotations: ${SPEC_JOB_KUBE_ANNOTATIONS:}
node-selectors: ${SPEC_JOB_KUBE_NODE_SELECTORS:}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

import io.airbyte.config.ResourceRequirements;
import io.airbyte.config.ResourceRequirementsType;
import io.airbyte.workers.WorkerConfigs;
import io.airbyte.workers.config.WorkerConfigsProvider.ResourceType;
import io.micronaut.context.annotation.Value;
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import java.util.Optional;
import org.junit.jupiter.api.Test;

// We are overriding the default config with application-config-test.yaml for consistency of the
Expand Down Expand Up @@ -73,4 +76,24 @@ void checkWorkerConfigProvider() {
assertEquals("", specKubeConfig.getResourceRequirements().getMemoryRequest());
}

@Test
void checkDatabaseSourceResourceRequirements() {
final ResourceRequirements resourceRequirements =
workerConfigsProvider.getResourceRequirements(ResourceRequirementsType.SOURCE, Optional.of("database"));

assertEquals("1", resourceRequirements.getCpuRequest());
// This is verifying that we are inheriting the value from default.
assertEquals("default cpu limit", resourceRequirements.getCpuLimit());
}

@Test
void checkSourceResourceRequirements() {
final ResourceRequirements resourceRequirements =
workerConfigsProvider.getResourceRequirements(ResourceRequirementsType.SOURCE, Optional.of("any"));

assertEquals("0.5", resourceRequirements.getCpuRequest());
// This is verifying that we are inheriting the value from default.
assertEquals("default cpu limit", resourceRequirements.getCpuLimit());
}

}

0 comments on commit 4ec8ad7

Please sign in to comment.