Skip to content

Commit b26e303

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 (cherry picked from commit be38059) e0da97b Correct detection of outdated CRD's
1 parent b214471 commit b26e303

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
@@ -768,20 +768,17 @@ private static List<ResourceVersion> getVersions(V1CustomResourceDefinition crd)
768768
@Override
769769
public boolean isOutdatedCrd(SemanticVersion productVersion, String resourceVersionString,
770770
V1CustomResourceDefinition actual, V1CustomResourceDefinition expected) {
771-
ResourceVersion current = new ResourceVersion(resourceVersionString);
772-
List<ResourceVersion> actualVersions = getVersions(actual);
773-
774-
for (ResourceVersion v : actualVersions) {
775-
if (!isLaterOrEqual(v, current)) {
776-
return false;
777-
}
778-
}
779-
780771
// Check product version label
781772
if (productVersion != null) {
782773
SemanticVersion currentCrdVersion = KubernetesUtils.getProductVersionFromMetadata(actual.getMetadata());
783-
if (currentCrdVersion == null || productVersion.compareTo(currentCrdVersion) < 0) {
774+
if (currentCrdVersion == null) {
775+
return false;
776+
}
777+
int compareToResult = productVersion.compareTo(currentCrdVersion);
778+
if (compareToResult < 0) {
784779
return false;
780+
} else if (compareToResult > 0) {
781+
return true;
785782
}
786783
}
787784

0 commit comments

Comments
 (0)