Skip to content

Commit 8a78ddd

Browse files
committed
No need to expose nm port for admin server. update PodHelper unit tests
1 parent d74dc7b commit 8a78ddd

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,8 @@ protected V1Pod computeAdminPodConfig(Packet packet) {
223223
V1ContainerPort containerPort = new V1ContainerPort();
224224
containerPort.setContainerPort(spec.getAsPort());
225225
containerPort.setProtocol("TCP");
226-
containerPort.setName("weblogic");
227226
container.addPortsItem(containerPort);
228227

229-
V1ContainerPort nmPort = new V1ContainerPort();
230-
nmPort.setContainerPort(5556);
231-
nmPort.setProtocol("TCP");
232-
nmPort.setName("node-manager");
233-
container.addPortsItem(nmPort);
234-
235228
V1Lifecycle lifecycle = new V1Lifecycle();
236229
V1Handler preStopHandler = new V1Handler();
237230
V1ExecAction lifecycleExecAction = new V1ExecAction();

src/test/java/oracle/kubernetes/operator/create/PodHelperConfigTest.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import java.util.List;
77

8+
import io.kubernetes.client.models.V1ContainerPort;
89
import io.kubernetes.client.models.V1PersistentVolumeClaimList;
910
import io.kubernetes.client.models.V1Pod;
1011
import static oracle.kubernetes.operator.KubernetesConstants.*;
@@ -263,7 +264,7 @@ public V1Pod computeManagedPodConfig(Domain domain, V1PersistentVolumeClaimList
263264
packet.put(
264265
ProcessingConstants.SERVER_SCAN,
265266
// no listen address, no network access points since PodHelper doesn't use them:
266-
new WlsServerConfig(MANAGED_SERVER_NAME, MANAGED_SERVER_PORT, null, null));
267+
new WlsServerConfig(MANAGED_SERVER_NAME, MANAGED_SERVER_PORT, null, null, false, null, null));
267268
packet.put(
268269
ProcessingConstants.CLUSTER_SCAN,
269270
// don't attach WlsServerConfigs for the managed server to the WlsClusterConfig
@@ -366,6 +367,9 @@ private V1Pod getDesiredManagedServerPodConfigForDefaults(String image, String i
366367
.value(MANAGED_OPTION2_VALUE));
367368
pod.getMetadata()
368369
.putLabelsItem("weblogic.clusterName", CLUSTER_NAME);
370+
pod.getSpec().getContainers().get(0).addCommandItem(ADMIN_SERVER_NAME).addCommandItem(String.valueOf(ADMIN_SERVER_PORT));
371+
pod.getSpec().getContainers().get(0).getPorts().get(0).setName("weblogic");
372+
pod.getSpec().getContainers().get(0).addPortsItem(new V1ContainerPort().protocol("TCP").containerPort(5556).name("node-manager"));
369373
return pod;
370374
}
371375

@@ -397,11 +401,18 @@ private V1Pod getDesiredBaseServerPodConfigForDefaults(String image, String imag
397401
.name("weblogic-server")
398402
.image(image)
399403
.imagePullPolicy(imagePullPolicy)
400-
.addCommandItem("/shared/domain/" + DOMAIN_NAME + "/servers/" + serverName + "/nodemgr_home/startServer.sh")
404+
.addCommandItem("/weblogic-operator/scripts/startServer.sh")
405+
.addCommandItem(DOMAIN_UID)
406+
.addCommandItem(serverName)
407+
.addCommandItem(DOMAIN_NAME)
401408
.lifecycle(newLifecycle()
402409
.preStop(newHandler()
403410
.exec(newExecAction()
404-
.addCommandItem("/shared/domain/" + DOMAIN_NAME + "/servers/" + serverName + "/nodemgr_home/stopServer.sh"))))
411+
.addCommandItem("/weblogic-operator/scripts/stopServer.sh")
412+
.addCommandItem(DOMAIN_UID)
413+
.addCommandItem(serverName)
414+
.addCommandItem(DOMAIN_NAME)
415+
)))
405416
.livenessProbe(newProbe()
406417
.initialDelaySeconds(10)
407418
.periodSeconds(10)

0 commit comments

Comments
 (0)