Skip to content

Commit 4f0292f

Browse files
committed
Merge branch 'master' into feature/dynamic-cluster
2 parents 6d6ed14 + 73bb077 commit 4f0292f

File tree

5 files changed

+48
-23
lines changed

5 files changed

+48
-23
lines changed

operator/src/main/java/oracle/kubernetes/operator/http/HTTPException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ public class HTTPException extends Exception {
1111
final int statusCode;
1212

1313
public HTTPException(int statusCode) {
14+
super("status code: " + statusCode);
1415
this.statusCode = statusCode;
1516
}
17+
18+
public int getStatusCode() {
19+
return statusCode;
20+
}
1621
}

operator/src/main/java/oracle/kubernetes/operator/http/HttpClient.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ public Result executeGetOnServiceClusterIP(String requestUrl, String serviceURL)
7676
return new Result(responseString, status, successful);
7777
}
7878

79+
/**
80+
* Constructs a URL using the provided service URL and request URL, and use the resulting URL and the
81+
* payload provided to issue a HTTP POST request.
82+
* This method does not throw HTTPException if the HTTP request returns failure status code
83+
*
84+
* @param requestUrl The request URL containing the request of the REST call
85+
* @param serviceURL The service URL containing the host and port of the server where the HTTP
86+
* request is to be sent to
87+
* @param payload The payload to be used in the HTTP POST request
88+
*
89+
* @return A Result object containing the respond from the REST call
90+
* @throws HTTPException if throwOnFailure is true and the status of the HTTP response indicates the request was not
91+
* successful
92+
*/
7993
public Result executePostUrlOnServiceClusterIP(String requestUrl, String serviceURL, String payload) {
8094
Result result = null;
8195
try {

operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,12 @@ private MessageKeys() {}
134134
public static final String CLUSTER_SERVICE_DELETED = "WLSKO-0124";
135135
public static final String INGRESS_DELETED = "WLSKO-0125";
136136
public static final String TUNING_PARAMETERS = "WLSKO-0126";
137-
public static final String WLS_UPDATE_CLUSTER_SIZE_STARTING = "WLSKO-0127";
138-
public static final String WLS_UPDATE_CLUSTER_SIZE_FAILED = "WLSKO-0128";
139-
public static final String WLS_UPDATE_CLUSTER_SIZE_TIMED_OUT = "WLSKO-0129";
140-
public static final String WLS_UPDATE_CLUSTER_SIZE_INVALID_CLUSTER = "WLSKO-0130";
141-
public static final String WLS_CLUSTER_SIZE_UPDATED = "WLSKO-0131";
142-
public static final String WLS_SERVER_TEMPLATE_NOT_FOUND = "WLSKO-0132";
143-
public static final String WLS_CREATING_MACHINE = "WLSKO-0133";
137+
public static final String WLS_HEALTH_READ_FAILED = "WLSKO-0127";
138+
public static final String WLS_UPDATE_CLUSTER_SIZE_STARTING = "WLSKO-0128";
139+
public static final String WLS_UPDATE_CLUSTER_SIZE_FAILED = "WLSKO-0129";
140+
public static final String WLS_UPDATE_CLUSTER_SIZE_TIMED_OUT = "WLSKO-0130";
141+
public static final String WLS_UPDATE_CLUSTER_SIZE_INVALID_CLUSTER = "WLSKO-0131";
142+
public static final String WLS_CLUSTER_SIZE_UPDATED = "WLSKO-0132";
143+
public static final String WLS_SERVER_TEMPLATE_NOT_FOUND = "WLSKO-0133";
144+
public static final String WLS_CREATING_MACHINE = "WLSKO-0134";
144145
}

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ public NextAction apply(Packet packet) {
256256
WlsDomainConfig wlsDomainConfig = null;
257257
String jsonResult = httpClient.executePostUrlOnServiceClusterIP(
258258
WlsDomainConfig.getRetrieveServersSearchUrl(), serviceURL,
259-
WlsDomainConfig.getRetrieveServersSearchPayload()).getResponse();
260-
if (jsonResult != null) {
261-
wlsDomainConfig = WlsDomainConfig.create(jsonResult);
262-
}
259+
WlsDomainConfig.getRetrieveServersSearchPayload(),
260+
true).getResponse();
261+
262+
wlsDomainConfig = WlsDomainConfig.create(jsonResult);
263263

264264
List<ConfigUpdate> suggestedConfigUpdates = new ArrayList<>();
265265

@@ -269,7 +269,7 @@ public NextAction apply(Packet packet) {
269269

270270
info.setScan(wlsDomainConfig);
271271
info.setLastScanTime(new DateTime());
272-
272+
273273
LOGGER.info(MessageKeys.WLS_CONFIGURATION_READ, (System.currentTimeMillis() - ((Long) packet.get(START_TIME))), wlsDomainConfig);
274274

275275
// If there are suggested WebLogic configuration update, perform them as the
@@ -286,8 +286,8 @@ public NextAction apply(Packet packet) {
286286
} else { // RequestType.HEALTH
287287
String jsonResult = httpClient.executePostUrlOnServiceClusterIP(
288288
getRetrieveHealthSearchUrl(), serviceURL,
289-
getRetrieveHealthSearchPayload()).getResponse();
290-
289+
getRetrieveHealthSearchPayload(), true).getResponse();
290+
291291
ObjectMapper mapper = new ObjectMapper();
292292
JsonNode root = mapper.readTree(jsonResult);
293293

@@ -335,8 +335,12 @@ public NextAction apply(Packet packet) {
335335

336336
return doNext(packet);
337337
} catch (Throwable t) {
338-
LOGGER.warning(MessageKeys.WLS_CONFIGURATION_READ_FAILED, t);
339-
338+
if (RequestType.CONFIG.equals(requestType)) {
339+
LOGGER.warning(MessageKeys.WLS_CONFIGURATION_READ_FAILED, t);
340+
} else {
341+
LOGGER.warning(MessageKeys.WLS_HEALTH_READ_FAILED, packet.get(ProcessingConstants.SERVER_NAME), t);
342+
}
343+
340344
// exponential back-off
341345
Integer retryCount = (Integer) packet.get(RETRY_COUNT);
342346
if (retryCount == null) {

operator/src/main/resources/Operator.properties

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ WLSKO-0123=Service for domain with domainUID {0} in namespace {1} and with serve
125125
WLSKO-0124=Service for domain with domainUID {0} in namespace {1} and with cluster name {2} deleted; validating domain
126126
WLSKO-0125=Ingress for domain with domainUID {0} in namespace {1} and with cluster name {2} deleted; validating domain
127127
WLSKO-0126=Reloading tuning parameters from Operator's config map
128-
WLSKO-0127=Updating cluster size for WebLogic dynamic cluster {0} to {1}
129-
WLSKO-0128=Failed to update WebLogic dynamic cluster size for cluster {0} due to exception: {1}
130-
WLSKO-0129=Failed to update WebLogic dynamic cluster size for cluster {0} within timeout of {1} milliseconds
131-
WLSKO-0130=Failed to update WebLogic dynamic cluster size for cluster {0}. Cluster is not a dynamic cluster
132-
WLSKO-0131=Updated cluster size for WebLogic dynamic cluster {0} to {1}. Time taken {2} ms
133-
WLSKO-0132=Cannot find WebLogic server template with name {0} which is referenced by WebLogic cluster {1}
134-
WLSKO-0133=Creating WebLogic machine named {0}
128+
WLSKO-0127=Failed to read health information from server {0} due to exception: {1}
129+
WLSKO-0128=Updating cluster size for WebLogic dynamic cluster {0} to {1}
130+
WLSKO-0129=Failed to update WebLogic dynamic cluster size for cluster {0} due to exception: {1}
131+
WLSKO-0130=Failed to update WebLogic dynamic cluster size for cluster {0} within timeout of {1} milliseconds
132+
WLSKO-0131=Failed to update WebLogic dynamic cluster size for cluster {0}. Cluster is not a dynamic cluster
133+
WLSKO-0132=Updated cluster size for WebLogic dynamic cluster {0} to {1}. Time taken {2} ms
134+
WLSKO-0133=Cannot find WebLogic server template with name {0} which is referenced by WebLogic cluster {1}
135+
WLSKO-0134=Creating WebLogic machine named {0}

0 commit comments

Comments
 (0)