Skip to content
Snippets Groups Projects
Commit 1609b48e authored by Martin's avatar Martin
Browse files

OZG-7922 adjust level of LOGs

parent 31afbc93
No related branches found
No related tags found
1 merge request!3OZG-7922 adjust Keycloak usage, build new instance instead of using a...
...@@ -48,9 +48,8 @@ public class KeycloakClientReconciler implements Reconciler<OzgCloudKeycloakClie ...@@ -48,9 +48,8 @@ public class KeycloakClientReconciler implements Reconciler<OzgCloudKeycloakClie
@Override @Override
public UpdateControl<OzgCloudKeycloakClient> reconcile(OzgCloudKeycloakClient resource, Context<OzgCloudKeycloakClient> context) { public UpdateControl<OzgCloudKeycloakClient> reconcile(OzgCloudKeycloakClient resource, Context<OzgCloudKeycloakClient> context) {
try { try {
LOG.info("{} reconciling...", resource.getMetadata().getName()); LOG.debug("{} reconciling...", resource.getMetadata().getName());
Optional<String> preconditionError = preconditionService.getReconcilePreconditionErrors(resource); Optional<String> preconditionError = preconditionService.getReconcilePreconditionErrors(resource);
if (preconditionError.isPresent()) { if (preconditionError.isPresent()) {
...@@ -73,7 +72,7 @@ public class KeycloakClientReconciler implements Reconciler<OzgCloudKeycloakClie ...@@ -73,7 +72,7 @@ public class KeycloakClientReconciler implements Reconciler<OzgCloudKeycloakClie
} }
private UpdateControl<OzgCloudKeycloakClient> buildStatusInProgress(OzgCloudKeycloakClient resource, String errorMessage) { private UpdateControl<OzgCloudKeycloakClient> buildStatusInProgress(OzgCloudKeycloakClient resource, String errorMessage) {
LOG.info("{} could not yet reconcile in namespace {}: {}", resource.getMetadata().getName(), resource.getMetadata().getNamespace(), LOG.warn("{} could not yet reconcile in namespace {}: {}", resource.getMetadata().getName(), resource.getMetadata().getNamespace(),
errorMessage); errorMessage);
resource.setStatus(OzgCloudKeycloakClientStatus.builder().status(OzgCloudCustomResourceStatus.IN_PROGRESS).message(errorMessage).build()); resource.setStatus(OzgCloudKeycloakClientStatus.builder().status(OzgCloudCustomResourceStatus.IN_PROGRESS).message(errorMessage).build());
return UpdateControl.patchStatus(resource).rescheduleAfter(Config.RECONCILER_RETRY_SECONDS); return UpdateControl.patchStatus(resource).rescheduleAfter(Config.RECONCILER_RETRY_SECONDS);
......
...@@ -49,7 +49,7 @@ public class KeycloakGroupReconciler implements Reconciler<OzgCloudKeycloakGroup ...@@ -49,7 +49,7 @@ public class KeycloakGroupReconciler implements Reconciler<OzgCloudKeycloakGroup
@Override @Override
public UpdateControl<OzgCloudKeycloakGroup> reconcile(OzgCloudKeycloakGroup resource, Context<OzgCloudKeycloakGroup> context) { public UpdateControl<OzgCloudKeycloakGroup> reconcile(OzgCloudKeycloakGroup resource, Context<OzgCloudKeycloakGroup> context) {
try { try {
LOG.info("{} reconiling..", resource.getMetadata().getName()); LOG.debug("{} reconiling..", resource.getMetadata().getName());
Optional<String> preconditionError = preconditionService.getReconcilePreconditionErrors(resource); Optional<String> preconditionError = preconditionService.getReconcilePreconditionErrors(resource);
if (preconditionError.isPresent()) { if (preconditionError.isPresent()) {
...@@ -60,7 +60,7 @@ public class KeycloakGroupReconciler implements Reconciler<OzgCloudKeycloakGroup ...@@ -60,7 +60,7 @@ public class KeycloakGroupReconciler implements Reconciler<OzgCloudKeycloakGroup
return buildStatusOk(resource); return buildStatusOk(resource);
} catch (Exception e) { } catch (Exception e) {
LOG.warn(resource.getMetadata().getName() + " could not reconcile in namespace " + resource.getMetadata().getNamespace(), e); LOG.error(resource.getMetadata().getName() + " could not reconcile in namespace " + resource.getMetadata().getNamespace(), e);
resource.setStatus(OzgCloudKeycloakGroupStatus.builder().status(OzgCloudCustomResourceStatus.ERROR).message(e.getMessage()).build()); resource.setStatus(OzgCloudKeycloakGroupStatus.builder().status(OzgCloudCustomResourceStatus.ERROR).message(e.getMessage()).build());
return UpdateControl.patchStatus(resource).rescheduleAfter(Config.RECONCILER_RETRY_SECONDS); return UpdateControl.patchStatus(resource).rescheduleAfter(Config.RECONCILER_RETRY_SECONDS);
} }
......
...@@ -46,7 +46,7 @@ public class KeycloakRealmReconciler implements Reconciler<OzgCloudKeycloakRealm ...@@ -46,7 +46,7 @@ public class KeycloakRealmReconciler implements Reconciler<OzgCloudKeycloakRealm
@Override @Override
public UpdateControl<OzgCloudKeycloakRealm> reconcile(OzgCloudKeycloakRealm resource, Context<OzgCloudKeycloakRealm> context) { public UpdateControl<OzgCloudKeycloakRealm> reconcile(OzgCloudKeycloakRealm resource, Context<OzgCloudKeycloakRealm> context) {
LOG.info("{} reconciling...", resource.getMetadata().getName()); LOG.debug("{} reconciling...", resource.getMetadata().getName());
try { try {
var realmName = resource.getMetadata().getNamespace(); var realmName = resource.getMetadata().getNamespace();
...@@ -56,7 +56,7 @@ public class KeycloakRealmReconciler implements Reconciler<OzgCloudKeycloakRealm ...@@ -56,7 +56,7 @@ public class KeycloakRealmReconciler implements Reconciler<OzgCloudKeycloakRealm
return UpdateControl.patchStatus(resource); return UpdateControl.patchStatus(resource);
} catch (Exception e) { } catch (Exception e) {
LOG.warn(resource.getMetadata().getName() + " could not reconcile in namespace " + resource.getMetadata().getNamespace(), e); LOG.error(resource.getMetadata().getName() + " could not reconcile in namespace " + resource.getMetadata().getNamespace(), e);
resource.setStatus(OzgCloudKeycloakRealmStatus.builder().status(OzgCloudCustomResourceStatus.ERROR).message(e.getMessage()).build()); resource.setStatus(OzgCloudKeycloakRealmStatus.builder().status(OzgCloudCustomResourceStatus.ERROR).message(e.getMessage()).build());
return UpdateControl.patchStatus(resource).rescheduleAfter(Config.RECONCILER_RETRY_SECONDS); return UpdateControl.patchStatus(resource).rescheduleAfter(Config.RECONCILER_RETRY_SECONDS);
} }
...@@ -64,9 +64,9 @@ public class KeycloakRealmReconciler implements Reconciler<OzgCloudKeycloakRealm ...@@ -64,9 +64,9 @@ public class KeycloakRealmReconciler implements Reconciler<OzgCloudKeycloakRealm
@Override @Override
public DeleteControl cleanup(OzgCloudKeycloakRealm realm, Context<OzgCloudKeycloakRealm> context) { public DeleteControl cleanup(OzgCloudKeycloakRealm realm, Context<OzgCloudKeycloakRealm> context) {
LOG.info("{} cleanup...", realm.getMetadata().getName()); LOG.debug("{} cleanup...", realm.getMetadata().getName());
if (realm.getSpec().isKeepAfterDelete()) { if (realm.getSpec().isKeepAfterDelete()) {
LOG.info("keep data"); LOG.debug("keep data");
return DeleteControl.defaultDelete(); return DeleteControl.defaultDelete();
} }
if (!service.realmExists(realm.getMetadata().getNamespace())) { if (!service.realmExists(realm.getMetadata().getNamespace())) {
...@@ -77,12 +77,12 @@ public class KeycloakRealmReconciler implements Reconciler<OzgCloudKeycloakRealm ...@@ -77,12 +77,12 @@ public class KeycloakRealmReconciler implements Reconciler<OzgCloudKeycloakRealm
DeleteControl deleteRealm(OzgCloudKeycloakRealm realm) { DeleteControl deleteRealm(OzgCloudKeycloakRealm realm) {
var realmName = realm.getMetadata().getNamespace(); var realmName = realm.getMetadata().getNamespace();
LOG.info("{} do cleanup...", realmName); LOG.debug("{} do cleanup...", realmName);
try { try {
service.deleteRealm(realmName); service.deleteRealm(realmName);
return DeleteControl.defaultDelete(); return DeleteControl.defaultDelete();
} catch (Exception e) { } catch (Exception e) {
LOG.warn(realmName + " could not delete.", e); LOG.error(realmName + " could not delete.", e);
return DeleteControl.noFinalizerRemoval().rescheduleAfter(Config.RECONCILER_RETRY_SECONDS_ON_ERROR); return DeleteControl.noFinalizerRemoval().rescheduleAfter(Config.RECONCILER_RETRY_SECONDS_ON_ERROR);
} }
} }
......
...@@ -63,7 +63,7 @@ class KeycloakRealmService { ...@@ -63,7 +63,7 @@ class KeycloakRealmService {
remoteService.updateRealm(realmRepresentation); remoteService.updateRealm(realmRepresentation);
addUserProfileAttributes(realmRepresentation); addUserProfileAttributes(realmRepresentation);
} catch (Exception e) { } catch (Exception e) {
LOG.warn(existingRealm + ": Updating existing realm failed: ", e); LOG.error(existingRealm + ": Updating existing realm failed: ", e);
throw e; throw e;
} }
} }
......
...@@ -50,7 +50,7 @@ public class KeycloakUserReconciler implements Reconciler<OzgCloudKeycloakUser>, ...@@ -50,7 +50,7 @@ public class KeycloakUserReconciler implements Reconciler<OzgCloudKeycloakUser>,
var userName = resource.getMetadata().getName(); var userName = resource.getMetadata().getName();
var namespace = resource.getMetadata().getNamespace(); var namespace = resource.getMetadata().getNamespace();
LOG.info("{} reconciling...", userName); LOG.debug("{} reconciling...", userName);
try { try {
var preconditionError = preconditionService.getPreconditionErrors(resource); var preconditionError = preconditionService.getPreconditionErrors(resource);
...@@ -71,7 +71,7 @@ public class KeycloakUserReconciler implements Reconciler<OzgCloudKeycloakUser>, ...@@ -71,7 +71,7 @@ public class KeycloakUserReconciler implements Reconciler<OzgCloudKeycloakUser>,
return UserUpdateControlBuilder.fromResource(resource).withStatus(OzgCloudCustomResourceStatus.OK).build(); return UserUpdateControlBuilder.fromResource(resource).withStatus(OzgCloudCustomResourceStatus.OK).build();
} catch (Exception e) { } catch (Exception e) {
LOG.warn(userName + " could not reconcile in namespace " + namespace, e); LOG.error(userName + " could not reconcile in namespace " + namespace, e);
return UserUpdateControlBuilder.fromResource(resource) return UserUpdateControlBuilder.fromResource(resource)
.withStatus(OzgCloudCustomResourceStatus.ERROR) .withStatus(OzgCloudCustomResourceStatus.ERROR)
...@@ -83,9 +83,9 @@ public class KeycloakUserReconciler implements Reconciler<OzgCloudKeycloakUser>, ...@@ -83,9 +83,9 @@ public class KeycloakUserReconciler implements Reconciler<OzgCloudKeycloakUser>,
@Override @Override
public DeleteControl cleanup(OzgCloudKeycloakUser user, Context<OzgCloudKeycloakUser> context) { public DeleteControl cleanup(OzgCloudKeycloakUser user, Context<OzgCloudKeycloakUser> context) {
LOG.info("{} cleanup...", user.getMetadata().getName()); LOG.debug("{} cleanup...", user.getMetadata().getName());
if (user.getSpec().isKeepAfterDelete()) { if (user.getSpec().isKeepAfterDelete()) {
LOG.info("keep data"); LOG.debug("keep data");
return DeleteControl.defaultDelete(); return DeleteControl.defaultDelete();
} }
...@@ -99,12 +99,12 @@ public class KeycloakUserReconciler implements Reconciler<OzgCloudKeycloakUser>, ...@@ -99,12 +99,12 @@ public class KeycloakUserReconciler implements Reconciler<OzgCloudKeycloakUser>,
DeleteControl deleteUser(OzgCloudKeycloakUser user) { DeleteControl deleteUser(OzgCloudKeycloakUser user) {
var userName = user.getMetadata().getName(); var userName = user.getMetadata().getName();
var namespace = user.getMetadata().getNamespace(); var namespace = user.getMetadata().getNamespace();
LOG.info("{} do cleanup...", userName); LOG.debug("{} do cleanup...", userName);
try { try {
service.deleteUser(user.getSpec(), namespace); service.deleteUser(user.getSpec(), namespace);
return DeleteControl.defaultDelete(); return DeleteControl.defaultDelete();
} catch (Exception e) { } catch (Exception e) {
LOG.warn(userName + " could not delete user in namespace " + namespace, e); LOG.error(userName + " could not delete user in namespace " + namespace, e);
return DeleteControl.noFinalizerRemoval().rescheduleAfter(Config.RECONCILER_RETRY_SECONDS_ON_ERROR); return DeleteControl.noFinalizerRemoval().rescheduleAfter(Config.RECONCILER_RETRY_SECONDS_ON_ERROR);
} }
} }
......
...@@ -39,7 +39,7 @@ class KubernetesRemoteService { ...@@ -39,7 +39,7 @@ class KubernetesRemoteService {
private final KubernetesClient kubernetesClient; private final KubernetesClient kubernetesClient;
public Resource<Secret> getSecret(String namespace, String name) { public Resource<Secret> getSecret(String namespace, String name) {
LOG.info("KubernetesClient: Get {} secret from {} namespace.", name, namespace); LOG.debug("KubernetesClient: Get {} secret from {} namespace.", name, namespace);
return kubernetesClient.secrets().inNamespace(namespace).withName(name); return kubernetesClient.secrets().inNamespace(namespace).withName(name);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment