kfaraz commented on code in PR #18413:
URL: https://github.com/apache/druid/pull/18413#discussion_r2295080026
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/k8s/K3sClusterResource.java:
##########
@@ -138,35 +141,61 @@ protected K3sContainer createContainer()
@Override
public void onStarted(EmbeddedDruidCluster cluster)
{
- client = new KubernetesClientBuilder()
- .withConfig(Config.fromKubeconfig(getContainer().getKubeConfigYaml()))
- .build();
- closer.register(client);
+ loadImageAndApplyClusterManifests(cluster);
+ injectClusterCommonPropertiesToConfigMap(cluster);
+ initializeDruidServices();
+ }
- loadLocalDockerImageIntoContainer(druidImageName, cluster.getTestFolder());
+ private void initializeDruidServices()
+ {
+ for (K3sDruidService druidService : services) {
+ final String serviceConfigMap = StringUtils.format(SERVICE_CONFIG_MAP,
druidService.getName());
+ applyConfigMap(
+ newConfigMap(serviceConfigMap, druidService.getProperties(),
"runtime.properties")
+ );
+ applyManifest(druidService);
+ }
- manifestFiles.forEach(this::applyManifest);
+ waitUntilPodsAreReady(DRUID_NAMESPACE);
+ waitUntilServicesAreHealthy();
+ }
+
+ protected void waitUntilServicesAreHealthy()
+ {
+ services.forEach(this::waitUntilServiceIsHealthy);
+ }
+
+ protected List<K3sDruidService> getServices()
+ {
+ return services;
+ }
- // Create common config map
+ protected Properties
injectClusterCommonPropertiesToConfigMap(EmbeddedDruidCluster cluster)
+ {
final Properties commonProperties = new Properties();
commonProperties.putAll(cluster.getCommonProperties());
commonProperties.remove("druid.extensions.modulesForEmbeddedTests");
applyConfigMap(
newConfigMap(COMMON_CONFIG_MAP, commonProperties,
"common.runtime.properties")
);
+ return commonProperties;
+ }
- // Create config maps and manifests for each service
- for (K3sDruidService druidService : services) {
- final String serviceConfigMap = StringUtils.format(SERVICE_CONFIG_MAP,
druidService.getName());
- applyConfigMap(
- newConfigMap(serviceConfigMap, druidService.getProperties(),
"runtime.properties")
- );
- applyManifest(druidService);
- }
+ protected void loadImageAndApplyClusterManifests(EmbeddedDruidCluster
cluster)
+ {
+ client = new KubernetesClientBuilder()
+ .withConfig(Config.fromKubeconfig(getContainer().getKubeConfigYaml()))
+ .build();
+ closer.register(client);
- // Wait for all pods to be ready and services to be healthy
-
client.pods().inNamespace(DRUID_NAMESPACE).resources().forEach(this::waitUntilPodIsReady);
- services.forEach(this::waitUntilServiceIsHealthy);
+ loadLocalDockerImageIntoContainer(druidImageName, cluster.getTestFolder());
+
+ manifestFiles.forEach(this::applyManifest);
Review Comment:
These 3 seem disjoint - they should be separate methods:
`initKubernetesClient`
`loadLocalDockerImageIntoContainer()`
`applyManifests()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]