Skip to content
Snippets Groups Projects
Commit a1e2b319 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-3961 - manually re-reconcile on errors

parent e8ffaf2b
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
public class Config {
public static final int RECONCILER_RETRY_SECONDS = 20;
public static final int RECONCILER_RETRY_SECONDS_ON_ERROR = 60;
// @Bean
// KeycloakUserReconciler customServiceController(KeycloakUserService keycloakUserService) {
......
......@@ -48,8 +48,7 @@ public class KeycloakClientReconciler implements Reconciler<OzgKeycloakClient> {
+ e.getMessage(),
e);
resource.setStatus(OzgKeycloakClientStatus.builder().status(OzgCustomResourceStatus.ERROR).message(e.getMessage()).build());
UpdateControl.updateStatus(resource);
throw e;
return UpdateControl.updateStatus(resource).rescheduleAfter(Duration.ofSeconds(Config.RECONCILER_RETRY_SECONDS));
}
}
......
......@@ -48,8 +48,7 @@ public class KeycloakGroupReconciler implements Reconciler<OzgKeycloakGroup> {
+ e.getMessage(),
e);
resource.setStatus(OzgKeycloakGroupStatus.builder().status(OzgCustomResourceStatus.ERROR).message(e.getMessage()).build());
UpdateControl.updateStatus(resource);
throw e;
return UpdateControl.updateStatus(resource).rescheduleAfter(Duration.ofSeconds(Config.RECONCILER_RETRY_SECONDS));
}
}
......
package de.ozgcloud.operator.keycloak.realm;
import java.time.Duration;
import java.util.logging.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import de.ozgcloud.operator.Config;
import de.ozgcloud.operator.keycloak.OzgCustomResourceStatus;
import io.javaoperatorsdk.operator.api.reconciler.Cleaner;
import io.javaoperatorsdk.operator.api.reconciler.Context;
......@@ -41,8 +43,7 @@ public class KeycloakRealmReconciler implements Reconciler<OzgKeycloakRealm>, Cl
+ e.getMessage(),
e);
resource.setStatus(OzgKeycloakRealmStatus.builder().status(OzgCustomResourceStatus.ERROR).message(e.getMessage()).build());
UpdateControl.updateStatus(resource);
throw e;
return UpdateControl.updateStatus(resource).rescheduleAfter(Duration.ofSeconds(Config.RECONCILER_RETRY_SECONDS));
}
}
......
......@@ -50,8 +50,7 @@ public class KeycloakUserReconciler implements Reconciler<OzgKeycloakUser>, Clea
+ e.getMessage(),
e);
resource.setStatus(OzgKeycloakUserStatus.builder().status(OzgCustomResourceStatus.ERROR).message(e.getMessage()).build());
UpdateControl.updateStatus(resource);
throw e;
return UpdateControl.updateStatus(resource).rescheduleAfter(Duration.ofSeconds(Config.RECONCILER_RETRY_SECONDS));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment