-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9911b3
commit 08d639f
Showing
11 changed files
with
85 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/org/trustify/operator/cdrs/v2alpha1/db/DBSecretDiscriminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.trustify.operator.cdrs.v2alpha1.db; | ||
|
||
import io.fabric8.kubernetes.api.model.Secret; | ||
import io.javaoperatorsdk.operator.api.reconciler.Context; | ||
import io.javaoperatorsdk.operator.api.reconciler.ResourceDiscriminator; | ||
import io.javaoperatorsdk.operator.processing.event.ResourceID; | ||
import io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource; | ||
import org.trustify.operator.cdrs.v2alpha1.Trustify; | ||
import org.trustify.operator.controllers.TrustifyReconciler; | ||
|
||
import java.util.Optional; | ||
|
||
public class DBSecretDiscriminator implements ResourceDiscriminator<Secret, Trustify> { | ||
@Override | ||
public Optional<Secret> distinguish(Class<Secret> resource, Trustify cr, Context<Trustify> context) { | ||
String secret = DBSecret.getSecretName(cr); | ||
ResourceID resourceID = new ResourceID(secret, cr.getMetadata().getNamespace()); | ||
var informerEventSource = (InformerEventSource<Secret, Trustify>) context.eventSourceRetriever().getResourceEventSourceFor(Secret.class, TrustifyReconciler.SECRET_EVENT_SOURCE); | ||
return informerEventSource.get(resourceID); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...main/java/org/trustify/operator/cdrs/v2alpha1/keycloak/KeycloakDBSecretDiscriminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.trustify.operator.cdrs.v2alpha1.keycloak; | ||
|
||
import io.fabric8.kubernetes.api.model.Secret; | ||
import io.javaoperatorsdk.operator.api.reconciler.Context; | ||
import io.javaoperatorsdk.operator.api.reconciler.ResourceDiscriminator; | ||
import io.javaoperatorsdk.operator.processing.event.ResourceID; | ||
import io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource; | ||
import org.trustify.operator.cdrs.v2alpha1.Trustify; | ||
import org.trustify.operator.controllers.TrustifyReconciler; | ||
|
||
import java.util.Optional; | ||
|
||
public class KeycloakDBSecretDiscriminator implements ResourceDiscriminator<Secret, Trustify> { | ||
@Override | ||
public Optional<Secret> distinguish(Class<Secret> resource, Trustify cr, Context<Trustify> context) { | ||
String secret = KeycloakDBSecret.getSecretName(cr); | ||
ResourceID resourceID = new ResourceID(secret, cr.getMetadata().getNamespace()); | ||
var informerEventSource = (InformerEventSource<Secret, Trustify>) context.eventSourceRetriever().getResourceEventSourceFor(Secret.class, TrustifyReconciler.SECRET_EVENT_SOURCE); | ||
return informerEventSource.get(resourceID); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters