Skip to content

Commit

Permalink
fix: make sure generated CRDs are applied
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Laprun <[email protected]>
  • Loading branch information
metacosm committed Jan 9, 2025
1 parent 73c03ed commit b8b3fb7
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public void applyCrd(String resourceTypeName) {
} catch (IOException e) {
throw new IllegalStateException("Cannot open CRD file at " + path.toAbsolutePath(), e);
}
crdMappings.remove(resourceTypeName);
} else {
// if no manually defined CRD matches the resource type, apply the generated one
applyCrd(resourceTypeName, getKubernetesClient());
Expand Down Expand Up @@ -263,10 +264,7 @@ protected void before(ExtensionContext context) {
final var resourceTypeName = ReconcilerUtils.getResourceTypeName(resourceClass);
// only try to apply a CRD for the reconciler if it is associated to a CR
if (CustomResource.class.isAssignableFrom(resourceClass)) {
if (crdMappings.get(resourceTypeName) != null) {
applyCrd(resourceTypeName);
crdMappings.remove(resourceTypeName);
}
applyCrd(resourceTypeName);
}

// apply yet unapplied CRDs
Expand All @@ -282,6 +280,7 @@ protected void before(ExtensionContext context) {
}
applyCrd(crdString, path, getKubernetesClient());
});
crdMappings.clear();

LOGGER.debug("Starting the operator locally");
this.operator.start();
Expand Down

0 comments on commit b8b3fb7

Please sign in to comment.