Skip to content

Commit be38059

Browse files
committed
Merge branch 'owls-127039' into 'release/4.2'
Correct detection of outdated CRD's See merge request weblogic-cloud/weblogic-kubernetes-operator!4919
2 parents cc42623 + e0da97b commit be38059

File tree

1 file changed

+7
-10
lines changed
  • operator/src/main/java/oracle/kubernetes/operator/helpers

1 file changed

+7
-10
lines changed

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -772,20 +772,17 @@ private static List<ResourceVersion> getVersions(V1CustomResourceDefinition crd)
772772
@Override
773773
public boolean isOutdatedCrd(SemanticVersion productVersion, String resourceVersionString,
774774
V1CustomResourceDefinition actual, V1CustomResourceDefinition expected) {
775-
ResourceVersion current = new ResourceVersion(resourceVersionString);
776-
List<ResourceVersion> actualVersions = getVersions(actual);
777-
778-
for (ResourceVersion v : actualVersions) {
779-
if (!isLaterOrEqual(v, current)) {
780-
return false;
781-
}
782-
}
783-
784775
// Check product version label
785776
if (productVersion != null) {
786777
SemanticVersion currentCrdVersion = KubernetesUtils.getProductVersionFromMetadata(actual.getMetadata());
787-
if (currentCrdVersion == null || productVersion.compareTo(currentCrdVersion) < 0) {
778+
if (currentCrdVersion == null) {
779+
return false;
780+
}
781+
int compareToResult = productVersion.compareTo(currentCrdVersion);
782+
if (compareToResult < 0) {
788783
return false;
784+
} else if (compareToResult > 0) {
785+
return true;
789786
}
790787
}
791788

0 commit comments

Comments
 (0)