Skip to content

Commit c49b208

Browse files
committed
Merge branch 'owls-124126' into 'main'
report referenced cluster resource name when cluster name mismatch See merge request weblogic-cloud/weblogic-kubernetes-operator!5038
2 parents c705cfd + 54ad688 commit c49b208

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

common/src/main/resources/Operator.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ WLSDO-0007=Configuration overridesConfigMap ''{0}'' is not supported if ''domain
183183
WLSDO-0008=ConfigMap ''{0}'' specified by ''{1}'' not found in namespace ''{2}''.
184184
WLSDO-0009=The secret ''{0}'' must be specified if ''domainHomeSourceType'' is configured as ''FromModel''.
185185
WLSDO-0010=The secret ''{0}'' must be specified if ''domainHomeSourceType'' is configured as ''FromModel'' and spec.configuration.model.domainType is configured as ''JRF''.
186-
WLSDO-0011=Cluster ''{0}'' specified in the domain resource does not exist in the WebLogic domain home configuration.
186+
WLSDO-0011=The Cluster resource ''{0}'' with clusterName ''{1}'' specified does not exist in the WebLogic domain home (config.xml) configuration.
187187
WLSDO-0012=Managed Server ''{0}'' specified in the domain resource does not exist in the WebLogic domain home configuration.
188188
WLSDO-0013=Istio is enabled and the domain resource specified to expose channel {0} in the adminServices section. The channel name default, \
189189
default-admin, default-secure are internal to the WebLogic Kubernetes Operator. Please create the network channel with a different name in the WebLogic Domain before \

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import oracle.kubernetes.operator.wlsconfig.WlsDynamicServersConfig;
2222
import oracle.kubernetes.operator.wlsconfig.WlsServerConfig;
2323
import oracle.kubernetes.operator.work.Packet;
24-
import oracle.kubernetes.weblogic.domain.model.ClusterResource;
25-
import oracle.kubernetes.weblogic.domain.model.ClusterSpec;
2624
import oracle.kubernetes.weblogic.domain.model.ManagedServer;
2725
import oracle.kubernetes.weblogic.domain.model.MonitoringExporterSpecification;
2826
import org.apache.commons.collections4.ListUtils;
@@ -128,8 +126,12 @@ List<String> getTopologyFailures() {
128126
private void verifyDomainResourceReferences() {
129127
getManagedServers().stream()
130128
.map(ManagedServer::getServerName).filter(this::isUnknownServer).forEach(this::reportUnknownServer);
131-
info.getReferencedClusters().stream().map(ClusterResource::getSpec)
132-
.map(ClusterSpec::getClusterName).filter(this::isUnknownCluster).forEach(this::reportUnknownCluster);
129+
info.getReferencedClusters().stream()
130+
.filter(cluster -> isUnknownCluster(cluster.getSpec().getClusterName()))
131+
.forEach(cluster -> reportUnknownCluster(
132+
cluster.getSpec().getClusterName(),
133+
cluster.getClusterResourceName()
134+
));
133135
}
134136

135137
private List<ManagedServer> getManagedServers() {
@@ -155,8 +157,8 @@ private boolean isUnknownCluster(String clusterName) {
155157
return !domainConfig.containsCluster(clusterName);
156158
}
157159

158-
private void reportUnknownCluster(String clusterName) {
159-
reportFailure(NO_CLUSTER_IN_DOMAIN, clusterName);
160+
private void reportUnknownCluster(String clusterName, String clusterResourceName) {
161+
reportFailure(NO_CLUSTER_IN_DOMAIN, clusterResourceName, clusterName);
160162
}
161163

162164
// Ensure that generated service names are valid.

operator/src/test/java/oracle/kubernetes/operator/helpers/TopologyValidationStepTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ void whenClusterDoesNotExistInDomain_logWarning() {
462462

463463
runTopologyValidationStep();
464464

465-
assertTopologyMismatchReported(NO_CLUSTER_IN_DOMAIN, "no-such-cluster");
465+
assertTopologyMismatchReported(NO_CLUSTER_IN_DOMAIN, "no-such-cluster", "no-such-cluster");
466466
}
467467

468468
@Test
@@ -532,7 +532,7 @@ void removeOldReplicasTooHighFailures() {
532532
void preserveTopologyFailuresThatStillExist() {
533533
consoleControl.ignoreMessage(NO_CLUSTER_IN_DOMAIN);
534534
final OffsetDateTime initialTime = SystemClock.now();
535-
final String message = getFormattedMessage(NO_CLUSTER_IN_DOMAIN, "no-such-cluster");
535+
final String message = getFormattedMessage(NO_CLUSTER_IN_DOMAIN, "no-such-cluster", "no-such-cluster");
536536
domain.getStatus().addCondition(new DomainCondition(FAILED).withReason(TOPOLOGY_MISMATCH)
537537
.withFailureInfo(domain.getSpec()).withMessage(message));
538538

@@ -1026,7 +1026,7 @@ void whenClusterDoesNotExistInDomain_logWarningAndCreateEvent() {
10261026

10271027
runTopologyValidationStep();
10281028

1029-
assertTopologyMismatchReported(NO_CLUSTER_IN_DOMAIN, "no-such-cluster");
1029+
assertTopologyMismatchReported(NO_CLUSTER_IN_DOMAIN, "no-such-cluster", "no-such-cluster");
10301030
}
10311031

10321032
@Test
@@ -1042,7 +1042,7 @@ void whenBothServerAndClusterDoNotExistInDomain_createEventWithBothWarnings() {
10421042

10431043
assertThat(testSupport, hasEvent(DOMAIN_FAILED_EVENT)
10441044
.withNoteContaining(getLocalizedString(TOPOLOGY_MISMATCH_EVENT_ERROR),
1045-
getFormattedMessage(NO_CLUSTER_IN_DOMAIN, "no-such-cluster"),
1045+
getFormattedMessage(NO_CLUSTER_IN_DOMAIN, "no-such-cluster", "no-such-cluster"),
10461046
getFormattedMessage(NO_MANAGED_SERVER_IN_DOMAIN, "no-such-server")));
10471047
}
10481048

0 commit comments

Comments
 (0)