Skip to content

Commit e9f394c

Browse files
committed
Remove asNodePort and use ServerStartup's nodePort instead
Signed-off-by: Dongbo Xiao <[email protected]>
1 parent d67b5c2 commit e9f394c

File tree

5 files changed

+17
-43
lines changed

5 files changed

+17
-43
lines changed

kubernetes/internal/domain-custom-resource-template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ spec:
2828
asName: "%ADMIN_SERVER_NAME%"
2929
# The Admin Server's ListenPort
3030
asPort: %ADMIN_PORT%
31-
# The Admin Server's NodePort
32-
%EXPOSE_ADMIN_PORT_PREFIX%asNodePort: %ADMIN_NODE_PORT%
3331
# startupControl legal values are "ALL", "ADMIN", "SPECIFIED", or "AUTO"
3432
# This determines which WebLogic Servers the Operator will start up when it discovers this Domain
3533
# - "ALL" will start up all defined servers
@@ -49,6 +47,8 @@ spec:
4947
- desiredState: "RUNNING"
5048
# the name of the server to apply these rules to
5149
serverName: "%ADMIN_SERVER_NAME%"
50+
# The Admin Server's NodePort
51+
%EXPOSE_ADMIN_PORT_PREFIX%nodePort: %ADMIN_NODE_PORT%
5252
# an (optional) list of environment variable to be set on the server
5353
env:
5454
- name: JAVA_OPTIONS

src-generated-swagger/main/java/oracle/kubernetes/operator/domain/model/oracle/kubernetes/weblogic/domain/v1/DomainSpec.java

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public class DomainSpec {
4949
@SerializedName("asPort")
5050
private Integer asPort = null;
5151

52-
@SerializedName("asNodePort")
53-
private Integer asNodePort = null;
54-
5552
@SerializedName("asEnv")
5653
private List<io.kubernetes.client.models.V1EnvVar> asEnv = null;
5754

@@ -208,28 +205,6 @@ public void setAsPort(Integer asPort) {
208205
this.asPort = asPort;
209206
}
210207

211-
public DomainSpec asNodePort(Integer asNodePort) {
212-
this.asNodePort = asNodePort;
213-
return this;
214-
}
215-
216-
/**
217-
* Administration server NodePort port. The port on each node on which the
218-
* administration server will be exposed. If specified, this value must be an
219-
* unused port. By default, the administration server will not be exposed
220-
* outside the Kubernetes cluster.
221-
*
222-
* @return asNodePort
223-
**/
224-
@ApiModelProperty(value = "Administration server NodePort port. The port on each node on which the administration server will be exposed. If specified, this value must be an unused port. By default, the administration server will not be exposed outside the Kubernetes cluster.")
225-
public Integer getAsNodePort() {
226-
return asNodePort;
227-
}
228-
229-
public void setAsNodePort(Integer asNodePort) {
230-
this.asNodePort = asNodePort;
231-
}
232-
233208
public DomainSpec asEnv(List<io.kubernetes.client.models.V1EnvVar> asEnv) {
234209
this.asEnv = asEnv;
235210
return this;
@@ -409,7 +384,6 @@ public boolean equals(java.lang.Object o) {
409384
&& Objects.equals(this.adminSecret, oracleKubernetesWeblogicDomainV1DomainSpec.adminSecret)
410385
&& Objects.equals(this.asName, oracleKubernetesWeblogicDomainV1DomainSpec.asName)
411386
&& Objects.equals(this.asPort, oracleKubernetesWeblogicDomainV1DomainSpec.asPort)
412-
&& Objects.equals(this.asNodePort, oracleKubernetesWeblogicDomainV1DomainSpec.asNodePort)
413387
&& Objects.equals(this.asEnv, oracleKubernetesWeblogicDomainV1DomainSpec.asEnv)
414388
&& Objects.equals(this.exportT3Channels, oracleKubernetesWeblogicDomainV1DomainSpec.exportT3Channels)
415389
&& Objects.equals(this.startupControl, oracleKubernetesWeblogicDomainV1DomainSpec.startupControl)
@@ -420,7 +394,7 @@ public boolean equals(java.lang.Object o) {
420394

421395
@Override
422396
public int hashCode() {
423-
return Objects.hash(domainUID, domainName, image, imagePullPolicy, adminSecret, asName, asPort, asNodePort, asEnv,
397+
return Objects.hash(domainUID, domainName, image, imagePullPolicy, adminSecret, asName, asPort, asEnv,
424398
exportT3Channels, startupControl, serverStartup, clusterStartup, replicas);
425399
}
426400

@@ -436,7 +410,6 @@ public String toString() {
436410
sb.append(" adminSecret: ").append(toIndentedString(adminSecret)).append("\n");
437411
sb.append(" asName: ").append(toIndentedString(asName)).append("\n");
438412
sb.append(" asPort: ").append(toIndentedString(asPort)).append("\n");
439-
sb.append(" asNodePort: ").append(toIndentedString(asNodePort)).append("\n");
440413
sb.append(" asEnv: ").append(toIndentedString(asEnv)).append("\n");
441414
sb.append(" exportT3Channels: ").append(toIndentedString(exportT3Channels)).append("\n");
442415
sb.append(" startupControl: ").append(toIndentedString(startupControl)).append("\n");

src/integration-tests/bash/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,15 +1051,15 @@ function verify_admin_server_ext_service {
10511051

10521052
trace "verify that admin server REST and console are accessible from outside of the kubernetes cluster"
10531053

1054-
local get_configured_nodePort="kubectl get domains -n $NAMESPACE -o jsonpath='{.items[?(@.metadata.name == \"$DOMAIN_UID\")].spec.asNodePort}'"
1054+
local get_configured_nodePort="kubectl get domains -n $NAMESPACE -o jsonpath='{.items[?(@.metadata.name == \"$DOMAIN_UID\")].spec.serverStartup[?(@.serverName == \"admin-server\")].nodePort}'"
10551055

10561056
local configuredNodePort=`eval $get_configured_nodePort`
10571057

1058-
trace "configured asNodePort in domain $DOMAIN_UID is ${configuredNodePort}"
1058+
trace "configured NodePort for the admin server in domain $DOMAIN_UID is ${configuredNodePort}"
10591059

10601060
if [ -z ${configuredNodePort} ]; then
10611061
kubectl describe domain $DOMAIN_UID -n $NAMESPACE
1062-
trace "Either domain $DOMAIN_UID does not exist or asNodePort is not configured in domain $DOMAIN_UID. Skipping this verify"
1062+
trace "Either domain $DOMAIN_UID does not exist or no NodePort is not configured for the admin server in domain $DOMAIN_UID. Skipping this verify"
10631063
return
10641064
fi
10651065

@@ -1074,7 +1074,7 @@ function verify_admin_server_ext_service {
10741074
fi
10751075

10761076
if [ "$nodePort" -ne "$configuredNodePort" ]; then
1077-
fail "Configured asNodePort of ${configuredNodePort} is different from nodePort found in service ${ADMIN_SERVER_NODEPORT_SERVICE}: ${nodePort}"
1077+
fail "Configured NodePort of ${configuredNodePort} for the admin server is different from nodePort found in service ${ADMIN_SERVER_NODEPORT_SERVICE}: ${nodePort}"
10781078
fi
10791079

10801080
local TEST_REST_URL="http://${NODEPORT_HOST}:${nodePort}/management/weblogic/latest/serverRuntime"

src/main/java/oracle/kubernetes/operator/Main.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,15 @@ public NextAction apply(Packet packet) {
658658

659659
packet.put(ProcessingConstants.SERVER_NAME, spec.getAsName());
660660
packet.put(ProcessingConstants.PORT, spec.getAsPort());
661-
packet.put(ProcessingConstants.NODE_PORT, spec.getAsNodePort());
661+
List<ServerStartup> ssl = spec.getServerStartup();
662+
if (ssl != null) {
663+
for (ServerStartup ss : ssl) {
664+
if (ss.getServerName().equals(spec.getAsName())) {
665+
packet.put(ProcessingConstants.NODE_PORT, ss.getNodePort());
666+
break;
667+
}
668+
}
669+
}
662670
return doNext(packet);
663671
}
664672
}
@@ -1004,9 +1012,6 @@ public NextAction apply(Packet packet) {
10041012
if (serverStartup != null) {
10051013
nodePort = serverStartup.getNodePort();
10061014
}
1007-
if (nodePort == null && serverName.equals(spec.getAsName())) {
1008-
nodePort = spec.getAsNodePort();
1009-
}
10101015

10111016
p.put(ProcessingConstants.SERVER_NAME, serverName);
10121017
if (ssi.clusterConfig != null) {

swagger/domain.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,10 +1520,6 @@
15201520
"description": "Administration server port. Note: Possibly temporary as we could find this value through domain home inspection.",
15211521
"type": "integer"
15221522
},
1523-
"asNodePort": {
1524-
"description": "Administration server NodePort port. The port on each node on which the administration server will be exposed. If specified, this value must be an unused port. By default, the administration server will not be exposed outside the Kubernetes cluster.",
1525-
"type": "integer"
1526-
},
15271523
"asEnv": {
15281524
"description": "Environment variables for use in starting the administration server.",
15291525
"type": "array",
@@ -1631,4 +1627,4 @@
16311627
"BearerToken": []
16321628
}
16331629
]
1634-
}
1630+
}

0 commit comments

Comments
 (0)