Skip to content

Commit d9268ef

Browse files
committed
readiness probe to use admin port if administration port is enabled
1 parent b82a54e commit d9268ef

File tree

5 files changed

+70
-3
lines changed

5 files changed

+70
-3
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,16 @@ protected Map<String, String> getPodAnnotations() {
289289
return getServerSpec().getPodAnnotations();
290290
}
291291

292+
@Override
293+
boolean isLocalAdminProtocolChannelSecure() {
294+
return scan.isLocalAdminProtocolChannelSecure();
295+
}
296+
297+
@Override
298+
Integer getLocalAdminProtocolChannelPort() {
299+
return scan.getLocalAdminProtocolChannelPort();
300+
}
301+
292302
@Override
293303
Integer getDefaultPort() {
294304
return scan.getListenPort();

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ Integer getAsPort() {
161161
return domainTopology.getServerConfig(domainTopology.getAdminServerName()).getListenPort();
162162
}
163163

164+
boolean isLocalAdminProtocolChannelSecure() {
165+
return domainTopology
166+
.getServerConfig(domainTopology.getAdminServerName())
167+
.isLocalAdminProtocolChannelSecure();
168+
}
169+
170+
Integer getLocalAdminProtocolChannelPort() {
171+
return domainTopology
172+
.getServerConfig(domainTopology.getAdminServerName())
173+
.getLocalAdminProtocolChannelPort();
174+
}
175+
164176
private String getLogHome() {
165177
return getDomain().getLogHome();
166178
}
@@ -793,14 +805,21 @@ private V1Probe createReadinessProbe(TuningParameters.PodTuning tuning) {
793805
.timeoutSeconds(getReadinessProbeTimeoutSeconds(tuning))
794806
.periodSeconds(getReadinessProbePeriodSeconds(tuning))
795807
.failureThreshold(FAILURE_THRESHOLD)
796-
.httpGet(httpGetAction(READINESS_PATH, getDefaultPort()));
808+
.httpGet(
809+
httpGetAction(
810+
READINESS_PATH,
811+
getLocalAdminProtocolChannelPort(),
812+
isLocalAdminProtocolChannelSecure()));
797813
return readinessProbe;
798814
}
799815

800816
@SuppressWarnings("SameParameterValue")
801-
private V1HTTPGetAction httpGetAction(String path, int port) {
817+
private V1HTTPGetAction httpGetAction(String path, int port, boolean useHTTPS) {
802818
V1HTTPGetAction getAction = new V1HTTPGetAction();
803819
getAction.path(path).port(new IntOrString(port));
820+
if (useHTTPS) {
821+
getAction.scheme("HTTPS");
822+
}
804823
return getAction;
805824
}
806825

operator/src/main/java/oracle/kubernetes/operator/wlsconfig/WlsDynamicServerConfig.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static WlsDynamicServerConfig create(
7272
macroSubstitutor.substituteMacro(serverTemplate.getListenAddress()),
7373
sslListenPort,
7474
macroSubstitutor.substituteMacro(serverTemplate.getMachineName()),
75+
serverTemplate.getAdminPort(),
7576
networkAccessPoints);
7677
}
7778

@@ -84,6 +85,7 @@ static WlsDynamicServerConfig create(
8485
* @param listenAddress listen address of the dynamic server
8586
* @param sslListenPort SSL listen port of the dynamic server
8687
* @param machineName machine name of the dynamic server
88+
* @param adminPort administration port if administration port is enabled
8789
* @param networkAccessPoints network access points or channels configured for this dynamic server
8890
*/
8991
private WlsDynamicServerConfig(
@@ -92,8 +94,16 @@ private WlsDynamicServerConfig(
9294
String listenAddress,
9395
Integer sslListenPort,
9496
String machineName,
97+
Integer adminPort,
9598
List<NetworkAccessPoint> networkAccessPoints) {
96-
super(name, listenAddress, machineName, listenPort, sslListenPort, null, networkAccessPoints);
99+
super(
100+
name,
101+
listenAddress,
102+
machineName,
103+
listenPort,
104+
sslListenPort,
105+
adminPort,
106+
networkAccessPoints);
97107
}
98108

99109
/**

operator/src/main/java/oracle/kubernetes/operator/wlsconfig/WlsServerConfig.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,31 @@ public Integer getLocalAdminProtocolChannelPort() {
203203
return adminProtocolPort;
204204
}
205205

206+
public boolean isLocalAdminProtocolChannelSecure() {
207+
boolean adminProtocolPortSecure = false;
208+
boolean adminProtocolPortFound = false;
209+
if (networkAccessPoints != null) {
210+
for (NetworkAccessPoint nap : networkAccessPoints) {
211+
if (nap.isAdminProtocol()) {
212+
adminProtocolPortFound = true;
213+
adminProtocolPortSecure = false;
214+
break;
215+
}
216+
}
217+
}
218+
if (!adminProtocolPortFound) {
219+
if (adminPort != null) {
220+
adminProtocolPortSecure = true;
221+
} else if (sslListenPort != null) {
222+
adminProtocolPortSecure = true;
223+
} else if (listenPort != null) {
224+
adminProtocolPortSecure = false;
225+
}
226+
}
227+
228+
return adminProtocolPortSecure;
229+
}
230+
206231
/**
207232
* Creates a WLSServerConfig object using an "servers" or "serverTemplates" item parsed from JSON
208233
* result from WLS REST call.

operator/src/main/resources/scripts/introspectDomain.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ def addServer(self, server):
583583
self.writeln(" listenAddress: " + self.quote(self.env.toDNS1123Legal(self.env.getDomainUID() + "-" + server.getName())))
584584
if server.isAdministrationPortEnabled():
585585
self.writeln(" adminPort: " + str(server.getAdministrationPort()))
586+
else:
587+
if self.env.getDomain().isAdministrationPortEnabled():
588+
self.writeln(" adminPort: " + str(self.env.getDomain().getAdministrationPort()))
586589
self.addSSL(server)
587590
self.addNetworkAccessPoints(server)
588591

0 commit comments

Comments
 (0)