Avoid calls to Control Plane when the secondary resource is in cache

Closes #21109
This commit is contained in:
Martin Bartoš 2023-06-20 17:20:21 +02:00 committed by Bruno Oliveira da Silva
parent eb5edb3a9b
commit 13a463f71e

View file

@ -103,9 +103,7 @@ public class KeycloakController implements Reconciler<Keycloak>, EventSourceInit
var kcAdminSecret = new KeycloakAdminSecret(client, kc); var kcAdminSecret = new KeycloakAdminSecret(client, kc);
kcAdminSecret.createOrUpdateReconciled(); kcAdminSecret.createOrUpdateReconciled();
// TODO use caches in secondary resources; this is a workaround for https://github.com/java-operator-sdk/java-operator-sdk/issues/830 var kcDeployment = new KeycloakDeployment(client, config, kc, context.getSecondaryResource(StatefulSet.class).orElse(null), kcAdminSecret.getName());
// KeycloakDeployment deployment = new KeycloakDeployment(client, config, kc, context.getSecondaryResource(Deployment.class).orElse(null));
var kcDeployment = new KeycloakDeployment(client, config, kc, null, kcAdminSecret.getName());
var watchedSecrets = new WatchedSecretsStore(kcDeployment.getConfigSecretsNames(), client, kc); var watchedSecrets = new WatchedSecretsStore(kcDeployment.getConfigSecretsNames(), client, kc);
kcDeployment.createOrUpdateReconciled(); kcDeployment.createOrUpdateReconciled();
if (watchedSecrets.changesDetected()) { if (watchedSecrets.changesDetected()) {