-
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
0209206
commit 54a603c
Showing
16 changed files
with
265 additions
and
88 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
16 changes: 16 additions & 0 deletions
16
src/main/java/org/trustify/operator/cdrs/v2alpha1/db/DBActivationCondition.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,16 @@ | ||
package org.trustify.operator.cdrs.v2alpha1.db; | ||
|
||
import org.trustify.operator.cdrs.v2alpha1.Trustify; | ||
import org.trustify.operator.cdrs.v2alpha1.TrustifySpec; | ||
|
||
import java.util.Optional; | ||
|
||
public abstract class DBActivationCondition { | ||
|
||
protected boolean isMet(Trustify cr) { | ||
return !Optional.ofNullable(cr.getSpec().databaseSpec()) | ||
.map(TrustifySpec.DatabaseSpec::externalDatabase) | ||
.orElse(false); | ||
} | ||
|
||
} |
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
18 changes: 18 additions & 0 deletions
18
src/main/java/org/trustify/operator/cdrs/v2alpha1/db/DBDeploymentActivationCondition.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,18 @@ | ||
package org.trustify.operator.cdrs.v2alpha1.db; | ||
|
||
import io.fabric8.kubernetes.api.model.apps.Deployment; | ||
import io.javaoperatorsdk.operator.api.reconciler.Context; | ||
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource; | ||
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.trustify.operator.cdrs.v2alpha1.Trustify; | ||
|
||
@ApplicationScoped | ||
public class DBDeploymentActivationCondition extends DBActivationCondition implements Condition<Deployment, Trustify> { | ||
|
||
@Override | ||
public boolean isMet(DependentResource<Deployment, Trustify> resource, Trustify cr, Context<Trustify> context) { | ||
return super.isMet(cr); | ||
} | ||
|
||
} |
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
18 changes: 18 additions & 0 deletions
18
...va/org/trustify/operator/cdrs/v2alpha1/db/DBPersistentVolumeClaimActivationCondition.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,18 @@ | ||
package org.trustify.operator.cdrs.v2alpha1.db; | ||
|
||
import io.fabric8.kubernetes.api.model.PersistentVolumeClaim; | ||
import io.javaoperatorsdk.operator.api.reconciler.Context; | ||
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource; | ||
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.trustify.operator.cdrs.v2alpha1.Trustify; | ||
|
||
@ApplicationScoped | ||
public class DBPersistentVolumeClaimActivationCondition extends DBActivationCondition implements Condition<PersistentVolumeClaim, Trustify> { | ||
|
||
@Override | ||
public boolean isMet(DependentResource<PersistentVolumeClaim, Trustify> resource, Trustify cr, Context<Trustify> context) { | ||
return super.isMet(cr); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/org/trustify/operator/cdrs/v2alpha1/db/DBSecretActivationCondition.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,26 @@ | ||
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.dependent.DependentResource; | ||
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.trustify.operator.cdrs.v2alpha1.Trustify; | ||
|
||
import java.util.Optional; | ||
|
||
@ApplicationScoped | ||
public class DBSecretActivationCondition extends DBActivationCondition implements Condition<Secret, Trustify> { | ||
|
||
@Override | ||
public boolean isMet(DependentResource<Secret, Trustify> resource, Trustify cr, Context<Trustify> context) { | ||
boolean databaseRequired = super.isMet(cr); | ||
|
||
boolean manualSecretIsNotSet = Optional.ofNullable(cr.getSpec().databaseSpec()) | ||
.map(databaseSpec -> databaseSpec.usernameSecret() == null || databaseSpec.passwordSecret() == null) | ||
.orElse(true); | ||
|
||
return databaseRequired && manualSecretIsNotSet; | ||
} | ||
|
||
} |
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
18 changes: 18 additions & 0 deletions
18
src/main/java/org/trustify/operator/cdrs/v2alpha1/db/DBServiceActivationCondition.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,18 @@ | ||
package org.trustify.operator.cdrs.v2alpha1.db; | ||
|
||
import io.fabric8.kubernetes.api.model.Service; | ||
import io.javaoperatorsdk.operator.api.reconciler.Context; | ||
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource; | ||
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.trustify.operator.cdrs.v2alpha1.Trustify; | ||
|
||
@ApplicationScoped | ||
public class DBServiceActivationCondition extends DBActivationCondition implements Condition<Service, Trustify> { | ||
|
||
@Override | ||
public boolean isMet(DependentResource<Service, Trustify> resource, Trustify cr, Context<Trustify> context) { | ||
return super.isMet(cr); | ||
} | ||
|
||
} |
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
Oops, something went wrong.