Skip to content

Commit

Permalink
fix handling of shared container
Browse files Browse the repository at this point in the history
  • Loading branch information
dlg99 committed Jun 27, 2024
1 parent cf3ec67 commit cf611b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,7 @@ public class PulsarCluster {
* @return the built pulsar cluster
*/
public static PulsarCluster forSpec(PulsarClusterSpec spec) {
CSContainer csContainer = null;
if (!spec.enableOxia) {
csContainer = new CSContainer(spec.clusterName)
.withNetwork(Network.newNetwork())
.withNetworkAliases(CSContainer.NAME);
}
return new PulsarCluster(spec, null, csContainer, false);
return forSpec(spec, Network.newNetwork());
}

public static PulsarCluster forSpec(PulsarClusterSpec spec, Network network) {
Expand All @@ -93,7 +87,7 @@ public static PulsarCluster forSpec(PulsarClusterSpec spec, Network network) {
}

public static PulsarCluster forSpec(PulsarClusterSpec spec, CSContainer csContainer) {
return new PulsarCluster(spec, null, csContainer, true);
return new PulsarCluster(spec, csContainer.getNetwork(), csContainer, true);
}

@Getter
Expand Down Expand Up @@ -121,13 +115,12 @@ public static PulsarCluster forSpec(PulsarClusterSpec spec, CSContainer csContai
private final String configurationMetadataStoreUrl;

private PulsarCluster(PulsarClusterSpec spec, Network network, CSContainer csContainer, boolean sharedCsContainer) {

this.spec = spec;
this.sharedCsContainer = sharedCsContainer;
this.clusterName = spec.clusterName();
if (network != null) {
this.network = network;
} else if (csContainer != null ) {
} else if (csContainer != null) {
this.network = csContainer.getNetwork();
} else {
this.network = Network.newNetwork();
Expand Down Expand Up @@ -277,7 +270,7 @@ private PulsarCluster(PulsarClusterSpec spec, Network network, CSContainer csCon
));

if (spec.dataContainer != null) {
if (csContainer != null) {
if (!sharedCsContainer && csContainer != null) {
csContainer.withVolumesFrom(spec.dataContainer, BindMode.READ_WRITE);
}
if (zkContainer != null) {
Expand All @@ -294,7 +287,7 @@ private PulsarCluster(PulsarClusterSpec spec, Network network, CSContainer csCon
if (zkContainer != null) {
zkContainer.withClasspathResourceMapping(key, value, BindMode.READ_WRITE);
}
if (csContainer != null) {
if (!sharedCsContainer && csContainer != null) {
csContainer.withClasspathResourceMapping(key, value, BindMode.READ_WRITE);
}
proxyContainer.withClasspathResourceMapping(key, value, BindMode.READ_WRITE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class PulsarClusterSpec {
Map<String, String> classPathVolumeMounts = new TreeMap<>();

/**
* Daat container
* Data container
*/
@Builder.Default
GenericContainer<?> dataContainer = null;
Expand Down

0 comments on commit cf611b2

Please sign in to comment.