Skip to content

Commit 7e61694

Browse files
committed
Merge remote-tracking branch 'origin/main' into release/4.0
2 parents bf83587 + 6535e20 commit 7e61694

File tree

14 files changed

+170
-81
lines changed

14 files changed

+170
-81
lines changed

documentation/4.0/content/introduction/platforms/environments.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,14 @@ See also the [Tanzu Kubernetes Grid sample]({{<relref "/samples/tanzu-kubernetes
166166

167167
OpenShift can be a cloud platform or can be deployed on premises.
168168

169-
- Operator 3.4.0+ is certified for use on OpenShift Container Platform 4.10.4+ with Kubernetes 1.23+.
170-
- Operator v3.4.4 is certified for use on:
169+
- Operator v3.4.6 is certified for use on:
171170
- OpenShift Container Platform 4.9.50 with Kubernetes 1.22, RedHat OpenShift Mesh 2.3, and Istio 1.14.
172-
- OpenShift Container Platform 4.11.0 with Kubernetes 1.24, RedHat OpenShift Mesh 2.3, and Istio 1.14.
171+
- OpenShift Container Platform 4.10.20 with Kubernetes 1.23, RedHat OpenShift Mesh 2.2.1, and Istio 1.14.
172+
- OpenShift Container Platform 4.11.6 with Kubernetes 1.24, RedHat OpenShift Mesh 2.2.3, and Istio 1.12.9.
173+
-
174+
- Operator v4.0.5 is certified for use on:
175+
- OpenShift Container Platform 4.11.30 with Kubernetes 1.24, RedHat OpenShift Mesh 2.3.2, and Istio 1.14.5.
176+
- OpenShift Container Platform 4.12.2 with Kubernetes 1.25, RedHat OpenShift Mesh 2.3.2, and Istio 1.14.5.
173177

174178
To accommodate OpenShift security requirements:
175179
- For security requirements to run WebLogic Server in OpenShift, see the [OpenShift]({{<relref "/security/openshift.md">}}) documentation.

documentation/4.0/content/security/openshift.md

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@ weight: 7
55
description: "OpenShift information for the operator."
66
---
77

8+
#### Set the Helm chart property `kubernetesPlatform` to `OpenShift`
9+
10+
Beginning with operator version 3.3.2,
11+
set the operator `kubernetesPlatform` Helm chart property to `OpenShift`.
12+
This property accommodates OpenShift security requirements. Specifically, the operator's deployment and any pods created
13+
by the operator for WebLogic Server instances will not contain `runAsUser: 1000` in the configuration of the `securityContext`. This is to
14+
accommodate OpenShift's default `restricted` security context constraint.
15+
For more information, see [Operator Helm configuration values]({{<relref "/managing-operators/using-helm#operator-helm-configuration-values">}}).
16+
17+
#### Use a dedicated namespace
18+
19+
When the user that installs an individual instance of the operator
20+
does _not_ have the required privileges to create resources at the Kubernetes cluster level,
21+
they can use a `Dedicated` namespace selection strategy for the operator instance to limit
22+
it to managing domain resources in its local namespace only
23+
(see [Operator namespace management]({{< relref "/managing-operators/namespace-management#choose-a-domain-namespace-selection-strategy" >}})),
24+
and they may need to manually install the Domain Custom Resource (CRD)
25+
(see [Prepare for installation]({{< relref "/managing-operators/preparation#how-to-manually-install-the-domain-resource-custom-resource-definition-crd" >}})).
26+
27+
#### With WIT, set the `target` parameter to `OpenShift`
28+
29+
When using the [WebLogic Image Tool](https://oracle.github.io/weblogic-image-tool/) (WIT),
30+
`create`, `rebase`, or `update` command, to create a
31+
[Domain in Image]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}) domain home,
32+
[Model in Image]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}) image,
33+
or [Model in Image]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}) auxiliary image,
34+
you can specify the `--target` parameter for the target Kubernetes environment.
35+
Its value can be either `Default` or `OpenShift`.
36+
The `OpenShift` option changes the domain directory files such that the group permissions
37+
for those files will be the same as the user permissions (group writable, in most cases).
38+
If you do not supply the OS group and user setting with `--chown`,
39+
then the `Default` setting for this option is changed from `oracle:oracle` to `oracle:root`
40+
to be in line with the expectations of an OpenShift environment.
41+
842
#### Security requirements to run WebLogic in OpenShift
943

1044
WebLogic Kubernetes Operator images starting with version 3.1 and
@@ -50,6 +84,10 @@ than are needed, and is therefore less secure.
5084

5185
#### Create a custom Security Context Constraint
5286

87+
For most use cases, customers should use OpenShift's default `restricted` security context constraint. If you do need to
88+
create and use a custom security context constraint, this section describes the settings necessary to be compatible with
89+
the operator and pods for WebLogic Server instances.
90+
5391
To create a custom security context constraint, create a YAML file with the following
5492
content. This example assumes that your OpenShift project is called `weblogic` and
5593
that the service account you will use to run the operator and domains
@@ -113,34 +151,3 @@ For additional information about OpenShift requirements and the operator,
113151
see [OpenShift]({{<relref "/introduction/platforms/environments#openshift">}}).
114152
{{% /notice %}}
115153

116-
#### Use a dedicated namespace
117-
118-
When the user that installs an individual instance of the operator
119-
does _not_ have the required privileges to create resources at the Kubernetes cluster level,
120-
they can use a `Dedicated` namespace selection strategy for the operator instance to limit
121-
it to managing domain resources in its local namespace only
122-
(see [Operator namespace management]({{< relref "/managing-operators/namespace-management#choose-a-domain-namespace-selection-strategy" >}})),
123-
and they may need to manually install the Domain Custom Resource (CRD)
124-
(see [Prepare for installation]({{< relref "/managing-operators/preparation.md" >}})).
125-
126-
#### Set the Helm chart property `kubernetesPlatform` to `OpenShift`
127-
128-
Beginning with operator version 3.3.2,
129-
set the operator `kubernetesPlatform` Helm chart property to `OpenShift`.
130-
This property accommodates OpenShift security requirements.
131-
For more information, see [Operator Helm configuration values]({{<relref "/managing-operators/using-helm#operator-helm-configuration-values">}}).
132-
133-
#### With WIT, set the `target` parameter to `OpenShift`
134-
135-
When using the [WebLogic Image Tool](https://oracle.github.io/weblogic-image-tool/) (WIT),
136-
`create`, `rebase`, or `update` command, to create a
137-
[Domain in Image]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}) domain home,
138-
[Model in Image]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}) image,
139-
or [Model in Image]({{< relref "/managing-domains/choosing-a-model/_index.md" >}}) auxiliary image,
140-
you can specify the `--target` parameter for the target Kubernetes environment.
141-
Its value can be either `Default` or `OpenShift`.
142-
The `OpenShift` option changes the domain directory files such that the group permissions
143-
for those files will be the same as the user permissions (group writable, in most cases).
144-
If you do not supply the OS group and user setting with `--chown`,
145-
then the `Default` setting for this option is changed from `oracle:oracle` to `oracle:root`
146-
to be in line with the expectations of an OpenShift environment.

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItHorizontalPodAutoscalerCustomMetrics.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import oracle.weblogic.kubernetes.actions.impl.primitive.HelmParams;
2929
import oracle.weblogic.kubernetes.annotations.IntegrationTest;
3030
import oracle.weblogic.kubernetes.annotations.Namespaces;
31+
import oracle.weblogic.kubernetes.assertions.impl.Kubernetes;
3132
import oracle.weblogic.kubernetes.logging.LoggingFacade;
3233
import oracle.weblogic.kubernetes.utils.ExecCommand;
3334
import oracle.weblogic.kubernetes.utils.ExecResult;
@@ -305,11 +306,27 @@ void testHPAWithCustomMetrics() {
305306
() -> verifyHPA(domainNamespace, "0/5"),
306307
logger,
307308
"Checking if total_open_session metric is 0");
309+
testUntil(
310+
withLongRetryPolicy,
311+
() -> verifyHPA(domainNamespace, "2 3 2"),
312+
logger,
313+
"Checking if replica switched to 2");
314+
308315
try {
309316
checkPodDeleted(managedServerPrefix + 3, domainUid, domainNamespace);
310317
} catch (Exception ex) {
311-
//retry again
312-
checkPodDeleted(managedServerPrefix + 3, domainUid, domainNamespace);
318+
//check if different server was scaled down
319+
try {
320+
if (!Kubernetes.doesPodExist(domainNamespace, domainUid, managedServerPrefix + 1)) {
321+
logger.info("HPA scaled down managed server 1");
322+
} else if (!Kubernetes.doesPodExist(domainNamespace, domainUid, managedServerPrefix + 2)) {
323+
logger.info("HPA scaled down managed server 2");
324+
} else {
325+
checkPodDeleted(managedServerPrefix + 3, domainUid, domainNamespace);
326+
}
327+
} catch (Exception ex1) {
328+
throw ex;
329+
}
313330
}
314331
}
315332

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItRetryImprovements.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2022, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes;
@@ -54,6 +54,7 @@
5454
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
5555
import static oracle.weblogic.kubernetes.utils.ConfigMapUtils.configMapExist;
5656
import static oracle.weblogic.kubernetes.utils.ConfigMapUtils.createConfigMapFromFiles;
57+
import static oracle.weblogic.kubernetes.utils.DomainUtils.checkDomainStatusMessageContainsExpectedMsg;
5758
import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify;
5859
import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainResourceForDomainInImage;
5960
import static oracle.weblogic.kubernetes.utils.DomainUtils.createMiiDomainResourceWithConfigMap;
@@ -357,14 +358,12 @@ void testRetryStoppedAfterfailureRetryLimitMinutesExpired() {
357358
DomainResource domain = createDomainResourceForRetryTest(failureRetryLimitMinutes, replicaCount,false);
358359
createDomainForRetryTest(domain);
359360

360-
String retryDoneMsgRegex = new StringBuffer(".*operator\\s*failed\\s*after\\s*retrying\\s*for\\s*")
361-
.append(failureRetryLimitMinutes.toString())
362-
.append("\\s*minutes.*Please\\s*resolve.*update\\s*domain.spec.introspectVersion\\s*")
363-
.append(".*to\\s*force\\s*another\\s*retry.*").toString();
364-
365-
// verify that the operator stops retry after failure retry limit minutes expired
366-
testUntil(() -> findStringInDomainStatusMessage(domainNamespace, domainUid, retryDoneMsgRegex),
367-
logger, "The operator stops retry after failure retry limit minutes expired");
361+
String retryDoneMsgRegex = "The operator failed after retrying for "
362+
+ failureRetryLimitMinutes
363+
+ " minutes. This time limit may be specified in spec.failureRetryLimitMinutes. "
364+
+ "Please resolve the error and then update domain.spec.introspectVersion to force another retry.";
365+
// verify that retryDoneMsgRegex message found in domain status message
366+
checkDomainStatusMessageContainsExpectedMsg(domainUid, domainNamespace, retryDoneMsgRegex);
368367
}
369368

370369
/**
@@ -382,23 +381,23 @@ void testRetryOccursAndErrorFromIntrospectorLoggedInOperator() throws Exception
382381
String badModelFileCm = "bad-model-in-cm";
383382
String badModelFileName = "bad-model-file.yaml";
384383
Path badModelFile = Paths.get(MODEL_DIR, badModelFileName);
384+
String domainUid = "retrydomain2";
385385

386386
logger.info("Creating a domain resource with bad model file from configmap");
387387
DomainResource domain =
388388
createDomainResourceForRetryTestWithConfigMap(failureRetryLimitMinutes,
389-
replicaCount, badModelFile, badModelFileCm);
389+
replicaCount, badModelFile, badModelFileCm, domainUid);
390390
createDomainAndVerify(domain, domainNamespace);
391391

392392
String createDomainFailedMsgRegex = new StringBuffer(".*SEVERE.*createDomain\\s*was\\s*unable\\s*to\\s*load.*")
393393
.append(badModelFileName).toString();
394-
String retryDoneMsgRegex = new StringBuffer(".*operator\\s*failed\\s*after\\s*retrying\\s*for\\s*")
395-
.append(failureRetryLimitMinutes.toString())
396-
.append("\\s*minutes.*Please\\s*resolve.*update\\s*domain.spec.introspectVersion\\s*")
397-
.append(".*to\\s*force\\s*another\\s*retry.*").toString();
398394

395+
String retryDoneMsgRegex = "The operator failed after retrying for "
396+
+ failureRetryLimitMinutes
397+
+ " minutes. This time limit may be specified in spec.failureRetryLimitMinutes. "
398+
+ "Please resolve the error and then update domain.spec.introspectVersion to force another retry.";
399399
// verify that retryDoneMsgRegex message found in domain status message
400-
testUntil(() -> findStringInDomainStatusMessage(domainNamespace, domainUid, retryDoneMsgRegex),
401-
logger, "{0} is found in domain status message", retryDoneMsgRegex);
400+
checkDomainStatusMessageContainsExpectedMsg(domainUid, domainNamespace, retryDoneMsgRegex);
402401

403402
// verify that SEVERE and createDomainFailedMsgRegex message found in Operator log
404403
testUntil(() -> checkPodLogContainsRegex(createDomainFailedMsgRegex, operatorPodName, opNamespace),
@@ -418,6 +417,10 @@ void testRetryOccursAndErrorFromIntrospectorLoggedInOperator() throws Exception
418417
if (configMapExist.call().booleanValue()) {
419418
deleteConfigMap(badModelFileCm, domainNamespace);
420419
}
420+
deleteClusterCustomResource(domainUid + "-" + clusterName, domainNamespace);
421+
if (domainExists(domainUid, DOMAIN_VERSION, domainNamespace).call().booleanValue()) {
422+
deleteDomainResource(domainNamespace, domainUid);
423+
}
421424
}
422425

423426
private void verifyDomainExistsAndServerStarted(int replicaCount) {
@@ -485,7 +488,8 @@ private static DomainResource createDomainResourceForRetryTest(Long failureRetry
485488
private static DomainResource createDomainResourceForRetryTestWithConfigMap(Long failureRetryLimitMinutes,
486489
int replicaCount,
487490
Path modelFile,
488-
String configmapName) {
491+
String configmapName,
492+
String domainUid) {
489493
final List<Path> modelList = Collections.singletonList(modelFile);
490494
String imageName = MII_BASIC_IMAGE_NAME;
491495
String imageTag = "empty-domain-image";

integration-tests/src/test/java/oracle/weblogic/kubernetes/TestConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public interface TestConstants {
183183
public static final String TRAEFIK_CHART_NAME = "traefik";
184184
public static final String TRAEFIK_INGRESS_IMAGE_NAME = "weblogick8s/test-images/traefik-ingress/traefik";
185185
public static final String TRAEFIK_INGRESS_IMAGE_REGISTRY = TEST_IMAGES_REPO;
186+
186187
public static final String TRAEFIK_INGRESS_IMAGE_TAG = "v2.9.6";
187188

188189
// Voyager constants

integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/TraefikParams.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ public class TraefikParams {
2323
private String traefikImage = TRAEFIK_INGRESS_IMAGE_NAME;
2424
private String traefikImageTag = TRAEFIK_INGRESS_IMAGE_TAG;
2525
private String traefikRegistry = TRAEFIK_INGRESS_IMAGE_REGISTRY;
26+
2627
private static final String NODEPORTS_HTTP = "ports.web.nodePort";
2728
private static final String NODEPORTS_HTTPS = "ports.websecure.nodePort";
2829
private static final String TRAEFIK_IMAGE = "image.repository";
30+
private static final String TRAEFIK_IMAGE_REGISTRY = "image.registry";
2931
private static final String TRAEFIK_IMAGE_TAG = "image.tag";
3032
private static final String TRAEFIK_IMAGE_REGISTRY = "image.registry";
3133

@@ -58,6 +60,11 @@ public TraefikParams traefikImage(String traefikImage) {
5860
return this;
5961
}
6062

63+
public TraefikParams traefikRegistry(String traefikRegistry) {
64+
this.traefikRegistry = traefikRegistry;
65+
return this;
66+
}
67+
6168
public TraefikParams traefikImageTag(String traefikImageTag) {
6269
this.traefikImageTag = traefikImageTag;
6370
return this;
@@ -79,6 +86,7 @@ public Map<String, Object> getValues() {
7986
}
8087

8188
values.put(TRAEFIK_IMAGE, traefikImage);
89+
values.put(TRAEFIK_IMAGE_REGISTRY, traefikRegistry);
8290
values.put(TRAEFIK_IMAGE_TAG, traefikImageTag);
8391
values.put(TRAEFIK_IMAGE_REGISTRY, traefikRegistry);
8492
values.values().removeIf(Objects::isNull);

integration-tests/src/test/java/oracle/weblogic/kubernetes/assertions/TestAssertions.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes.assertions;
@@ -622,6 +622,33 @@ public static Callable<Boolean> domainStatusReasonMatches(String domainUid, Stri
622622
};
623623
}
624624

625+
/**
626+
* Check the status message of the domain contains the expected message.
627+
* @param domainUid domain uid
628+
* @param namespace namespace in which the domain resource exists
629+
* @param statusMsg the expected status message of the domain
630+
* @return true if the status message contains the expected message, false otherwise
631+
*/
632+
public static Callable<Boolean> domainStatusMessageContainsExpectedMsg(String domainUid, String namespace,
633+
String statusMsg) {
634+
LoggingFacade logger = getLogger();
635+
return () -> {
636+
DomainResource domain = getDomainCustomResource(domainUid, namespace);
637+
if (domain != null && domain.getStatus() != null && domain.getStatus().getMessage() != null) {
638+
return domain.getStatus().getMessage().equalsIgnoreCase(statusMsg);
639+
} else {
640+
if (domain == null) {
641+
logger.info("domain is null");
642+
} else if (domain.getStatus() == null) {
643+
logger.info("domain status is null");
644+
} else if (domain.getStatus().getMessage() == null) {
645+
logger.info("domain status message is null");
646+
}
647+
return false;
648+
}
649+
};
650+
}
651+
625652
/**
626653
* Check the domain status condition type exists.
627654
* @param domainUid uid of the domain

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DomainUtils.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainExists;
106106
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainStatusConditionTypeExists;
107107
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainStatusConditionTypeHasExpectedStatus;
108+
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainStatusMessageContainsExpectedMsg;
108109
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainStatusReasonMatches;
109110
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainStatusServerStatusHasExpectedPodStatus;
110111
import static oracle.weblogic.kubernetes.assertions.TestAssertions.pvExists;
@@ -242,12 +243,32 @@ public static void checkDomainStatusReasonMatches(String domainUid, String names
242243
LoggingFacade logger = getLogger();
243244
testUntil(assertDoesNotThrow(() -> domainStatusReasonMatches(domainUid, namespace, statusReason)),
244245
logger,
245-
"the status reason of the domain {0} in namespace {1}",
246+
"the status reason of the domain {0} in namespace {1} matches {2}",
246247
domainUid,
247248
namespace,
248249
statusReason);
249250
}
250251

252+
/**
253+
* Check the status message of the domainUid contains the expected msg.
254+
*
255+
* @param domainUid domain uid
256+
* @param namespace the namespace in which the domainUid exists
257+
* @param statusMsg the expected status msg of the domainUid
258+
*/
259+
public static void checkDomainStatusMessageContainsExpectedMsg(String domainUid,
260+
String namespace,
261+
String statusMsg) {
262+
LoggingFacade logger = getLogger();
263+
testUntil(withLongRetryPolicy,
264+
assertDoesNotThrow(() -> domainStatusMessageContainsExpectedMsg(domainUid, namespace, statusMsg)),
265+
logger,
266+
"the status msg of the domain {0} in namespace {1} contains {2}",
267+
domainUid,
268+
namespace,
269+
statusMsg);
270+
}
271+
251272
/**
252273
* Check the domain status condition has expected status value.
253274
* @param domainUid Uid of the domain

operator/src/main/java/oracle/kubernetes/operator/steps/HttpRequestProcessing.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private String getHost() {
131131

132132
private String toServiceHost(@Nonnull V1ObjectMeta meta) {
133133
String ns = Optional.ofNullable(meta.getNamespace()).orElse("default");
134-
return meta.getName() + "." + ns;
134+
return meta.getName() + "." + ns + ".svc";
135135
}
136136

137137
protected V1Pod getPod() {

0 commit comments

Comments
 (0)