-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DBZ-8061: Provided Service Account instead of managed
- Loading branch information
1 parent
7a27169
commit 26972b3
Showing
3 changed files
with
28 additions
and
6 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
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
25 changes: 25 additions & 0 deletions
25
...ore/src/main/java/io/debezium/operator/core/dependent/conditions/ServiceAccountReady.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,25 @@ | ||
/* | ||
* Copyright Debezium Authors. | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.debezium.operator.core.dependent.conditions; | ||
|
||
import io.debezium.operator.api.model.DebeziumServer; | ||
import io.debezium.operator.core.dependent.ServiceAccountDependent; | ||
import io.fabric8.kubernetes.api.model.ServiceAccount; | ||
import io.javaoperatorsdk.operator.api.reconciler.Context; | ||
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource; | ||
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition; | ||
|
||
public class ServiceAccountReady implements Condition<ServiceAccount, DebeziumServer> { | ||
@Override | ||
public boolean isMet( | ||
DependentResource<ServiceAccount, DebeziumServer> dependentResource, | ||
DebeziumServer primary, | ||
Context<DebeziumServer> context) { | ||
var namespace = primary.getMetadata().getNamespace(); | ||
var serviceAccountName = ServiceAccountDependent.serviceAccountNameFor(primary); | ||
return context.getClient().serviceAccounts().inNamespace(namespace).withName(serviceAccountName).get() != null; | ||
} | ||
} |