Skip to content

Commit

Permalink
feat: add enabled property to postgres backups spec (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
kosmoz committed Oct 12, 2023
1 parent 3f84c22 commit 345cdfc
Show file tree
Hide file tree
Showing 46 changed files with 165 additions and 83 deletions.
5 changes: 3 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions deploy/crd/giteas.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -133,8 +135,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
4 changes: 2 additions & 2 deletions deploy/crd/gitlabs.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -195,8 +197,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
4 changes: 2 additions & 2 deletions deploy/crd/glitchtips.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -123,8 +125,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
4 changes: 2 additions & 2 deletions deploy/crd/keycloaks.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -101,8 +103,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
4 changes: 2 additions & 2 deletions deploy/crd/metabases.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -119,8 +121,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
4 changes: 2 additions & 2 deletions deploy/crd/nextclouds.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -212,8 +214,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
4 changes: 2 additions & 2 deletions deploy/crd/odoos.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -98,8 +100,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
4 changes: 2 additions & 2 deletions deploy/crd/planes.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -285,8 +287,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
4 changes: 2 additions & 2 deletions deploy/crd/vaults.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ spec:
type: integer
backups:
properties:
enabled:
type: boolean
schedule:
type: string
retentionPolicy:
Expand Down Expand Up @@ -155,8 +157,6 @@ spec:
- accessKeySecret
- secretKeySecret
type: object
required:
- s3
type: object
storage:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import io.fabric8.generator.annotation.Required
import io.fabric8.kubernetes.api.model.SecretKeySelector

data class PostgresBackupsSpec(
val enabled: Boolean = true,
val schedule: String?,
val retentionPolicy: String?,
@field:Required
val s3: S3Spec
val s3: S3Spec?
) : BackupsSpec {
data class S3Spec(
val endpoint: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ import io.javaoperatorsdk.operator.api.reconciler.dependent.Dependent
Dependent(
type = GiteaPostgresBackup::class,
name = "GiteaPostgresBackup",
dependsOn = ["GiteaPostgresCluster"]
dependsOn = ["GiteaPostgresCluster"],
reconcilePrecondition = GiteaPostgresBackup.ReconcilePrecondition::class
),
Dependent(
type = GiteaConfigMap::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import eu.glasskube.operator.apps.gitea.Gitea
import eu.glasskube.operator.apps.gitea.GiteaReconciler
import eu.glasskube.operator.apps.gitea.genericResourceName
import eu.glasskube.operator.apps.gitea.resourceLabels
import eu.glasskube.operator.generic.dependent.postgres.PostgresWithoutBackupsSpecCondition
import eu.glasskube.operator.generic.dependent.postgres.backup.PostgresMinioBucketPrecondition
import eu.glasskube.operator.infra.minio.MinioBucket
import eu.glasskube.operator.infra.minio.MinioBucketSpec
import eu.glasskube.operator.infra.minio.minioBucket
Expand All @@ -15,7 +15,7 @@ import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDep

@KubernetesDependent(labelSelector = GiteaReconciler.SELECTOR)
class GiteaMinioBucket : CRUDKubernetesDependentResource<MinioBucket, Gitea>(MinioBucket::class.java) {
internal class ReconcilePrecondition : PostgresWithoutBackupsSpecCondition<MinioBucket, Gitea>()
internal class ReconcilePrecondition : PostgresMinioBucketPrecondition<MinioBucket, Gitea>()

override fun desired(primary: Gitea, context: Context<Gitea>) = minioBucket {
metadata {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import eu.glasskube.operator.generic.dependent.postgres.DependentPostgresSchedul
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent

@KubernetesDependent(labelSelector = GiteaReconciler.SELECTOR)
class GiteaPostgresBackup : DependentPostgresScheduledBackup<Gitea>(Gitea.Postgres)
class GiteaPostgresBackup : DependentPostgresScheduledBackup<Gitea>(Gitea.Postgres) {
class ReconcilePrecondition : DependentPostgresScheduledBackup.ReconcilePrecondition<Gitea>()
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ import io.javaoperatorsdk.operator.api.reconciler.dependent.Dependent
Dependent(
type = GitlabPostgresBackup::class,
name = "GitlabPostgresBackup",
dependsOn = ["GitlabPostgresCluster"]
dependsOn = ["GitlabPostgresCluster"],
reconcilePrecondition = GitlabPostgresBackup.ReconcilePrecondition::class
),
Dependent(
type = GitlabDeployment::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import eu.glasskube.operator.apps.gitlab.Gitlab
import eu.glasskube.operator.apps.gitlab.GitlabReconciler
import eu.glasskube.operator.apps.gitlab.genericResourceName
import eu.glasskube.operator.apps.gitlab.resourceLabels
import eu.glasskube.operator.generic.dependent.postgres.PostgresWithoutBackupsSpecCondition
import eu.glasskube.operator.generic.dependent.postgres.backup.PostgresMinioBucketPrecondition
import eu.glasskube.operator.infra.minio.MinioBucket
import eu.glasskube.operator.infra.minio.MinioBucketSpec
import eu.glasskube.operator.infra.minio.minioBucket
Expand All @@ -15,7 +15,7 @@ import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDep

@KubernetesDependent(labelSelector = GitlabReconciler.SELECTOR)
class GitlabMinioBucket : CRUDKubernetesDependentResource<MinioBucket, Gitlab>(MinioBucket::class.java) {
internal class ReconcilePrecondition : PostgresWithoutBackupsSpecCondition<MinioBucket, Gitlab>()
internal class ReconcilePrecondition : PostgresMinioBucketPrecondition<MinioBucket, Gitlab>()

override fun desired(primary: Gitlab, context: Context<Gitlab>) = minioBucket {
metadata {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import eu.glasskube.operator.generic.dependent.postgres.DependentPostgresSchedul
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent

@KubernetesDependent(labelSelector = GitlabReconciler.SELECTOR)
class GitlabPostgresBackup : DependentPostgresScheduledBackup<Gitlab>(Gitlab.Postgres)
class GitlabPostgresBackup : DependentPostgresScheduledBackup<Gitlab>(Gitlab.Postgres) {
class ReconcilePrecondition : DependentPostgresScheduledBackup.ReconcilePrecondition<Gitlab>()
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ import kotlin.jvm.optionals.getOrDefault
Dependent(
type = GlitchtipPostgresBackup::class,
name = "GlitchtipPostgresBackup",
dependsOn = ["GlitchtipPostgresCluster"]
dependsOn = ["GlitchtipPostgresCluster"],
reconcilePrecondition = GlitchtipPostgresBackup.ReconcilePrecondition::class
),
Dependent(
type = GlitchtipConfigMap::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import eu.glasskube.operator.apps.glitchtip.Glitchtip
import eu.glasskube.operator.apps.glitchtip.GlitchtipReconciler
import eu.glasskube.operator.apps.glitchtip.genericResourceName
import eu.glasskube.operator.apps.glitchtip.resourceLabels
import eu.glasskube.operator.generic.dependent.postgres.PostgresWithoutBackupsSpecCondition
import eu.glasskube.operator.generic.dependent.postgres.backup.PostgresMinioBucketPrecondition
import eu.glasskube.operator.infra.minio.MinioBucket
import eu.glasskube.operator.infra.minio.MinioBucketSpec
import eu.glasskube.operator.infra.minio.minioBucket
Expand All @@ -15,7 +15,7 @@ import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDep

@KubernetesDependent(labelSelector = GlitchtipReconciler.SELECTOR)
class GlitchtipMinioBucket : CRUDKubernetesDependentResource<MinioBucket, Glitchtip>(MinioBucket::class.java) {
internal class ReconcilePrecondition : PostgresWithoutBackupsSpecCondition<MinioBucket, Glitchtip>()
internal class ReconcilePrecondition : PostgresMinioBucketPrecondition<MinioBucket, Glitchtip>()

override fun desired(primary: Glitchtip, context: Context<Glitchtip>) = minioBucket {
metadata {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import eu.glasskube.operator.generic.dependent.postgres.DependentPostgresSchedul
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent

@KubernetesDependent(labelSelector = GlitchtipReconciler.SELECTOR)
class GlitchtipPostgresBackup : DependentPostgresScheduledBackup<Glitchtip>(Glitchtip.Postgres)
class GlitchtipPostgresBackup : DependentPostgresScheduledBackup<Glitchtip>(Glitchtip.Postgres) {
class ReconcilePrecondition : DependentPostgresScheduledBackup.ReconcilePrecondition<Glitchtip>()
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import kotlin.jvm.optionals.getOrDefault
Dependent(
type = KeycloakPostgresBackup::class,
name = "KeycloakPostgresBackup",
dependsOn = ["KeycloakPostgresCluster"]
dependsOn = ["KeycloakPostgresCluster"],
reconcilePrecondition = KeycloakPostgresBackup.ReconcilePrecondition::class
),
Dependent(
type = KeycloakDeployment::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import eu.glasskube.operator.generic.dependent.postgres.DependentPostgresSchedul
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent

@KubernetesDependent(labelSelector = KeycloakReconciler.SELECTOR)
class KeycloakPostgresBackup : DependentPostgresScheduledBackup<Keycloak>(Keycloak.Postgres)
class KeycloakPostgresBackup : DependentPostgresScheduledBackup<Keycloak>(Keycloak.Postgres) {
class ReconcilePrecondition : DependentPostgresScheduledBackup.ReconcilePrecondition<Keycloak>()
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import eu.glasskube.operator.apps.keycloak.Keycloak
import eu.glasskube.operator.apps.keycloak.KeycloakReconciler
import eu.glasskube.operator.apps.keycloak.backupBucketName
import eu.glasskube.operator.apps.keycloak.resourceLabels
import eu.glasskube.operator.generic.dependent.postgres.PostgresWithoutBackupsSpecCondition
import eu.glasskube.operator.generic.dependent.postgres.backup.PostgresMinioBucketPrecondition
import eu.glasskube.operator.infra.minio.MinioBucket
import eu.glasskube.operator.infra.minio.MinioBucketSpec
import eu.glasskube.operator.infra.minio.minioBucket
Expand All @@ -16,7 +16,7 @@ import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDep

@KubernetesDependent(labelSelector = KeycloakReconciler.SELECTOR)
class KeycloakPostgresBackupBucket : CRUDKubernetesDependentResource<MinioBucket, Keycloak>(MinioBucket::class.java) {
internal class ReconcilePrecondition : PostgresWithoutBackupsSpecCondition<MinioBucket, Keycloak>()
internal class ReconcilePrecondition : PostgresMinioBucketPrecondition<MinioBucket, Keycloak>()

override fun desired(primary: Keycloak, context: Context<Keycloak>) = minioBucket {
metadata {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ import io.javaoperatorsdk.operator.api.reconciler.dependent.Dependent
Dependent(
type = MetabasePostgresBackup::class,
name = "MetabasePostgresBackup",
dependsOn = ["MetabasePostgresCluster"]
dependsOn = ["MetabasePostgresCluster"],
reconcilePrecondition = MetabasePostgresBackup.ReconcilePrecondition::class
),
Dependent(
type = MetabaseConfigMap::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import eu.glasskube.operator.apps.metabase.Metabase
import eu.glasskube.operator.apps.metabase.MetabaseReconciler
import eu.glasskube.operator.apps.metabase.genericResourceName
import eu.glasskube.operator.apps.metabase.resourceLabels
import eu.glasskube.operator.generic.dependent.postgres.PostgresWithoutBackupsSpecCondition
import eu.glasskube.operator.generic.dependent.postgres.backup.PostgresMinioBucketPrecondition
import eu.glasskube.operator.infra.minio.MinioBucket
import eu.glasskube.operator.infra.minio.MinioBucketSpec
import eu.glasskube.operator.infra.minio.minioBucket
Expand All @@ -15,7 +15,7 @@ import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDep

@KubernetesDependent(labelSelector = MetabaseReconciler.SELECTOR)
class MetabaseMinioBucket : CRUDKubernetesDependentResource<MinioBucket, Metabase>(MinioBucket::class.java) {
internal class ReconcilePrecondition : PostgresWithoutBackupsSpecCondition<MinioBucket, Metabase>()
internal class ReconcilePrecondition : PostgresMinioBucketPrecondition<MinioBucket, Metabase>()

override fun desired(primary: Metabase, context: Context<Metabase>) = minioBucket {
metadata {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ import eu.glasskube.operator.generic.dependent.postgres.DependentPostgresSchedul
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent

@KubernetesDependent(labelSelector = MetabaseReconciler.SELECTOR)
class MetabasePostgresBackup : DependentPostgresScheduledBackup<Metabase>(Metabase.Postgres)
class MetabasePostgresBackup : DependentPostgresScheduledBackup<Metabase>(Metabase.Postgres) {
class ReconcilePrecondition : DependentPostgresScheduledBackup.ReconcilePrecondition<Metabase>()
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ import kotlin.jvm.optionals.getOrDefault
Dependent(
type = NextcloudPostgresBackup::class,
name = "NextcloudPostgresBackup",
dependsOn = ["NextcloudPostgresCluster"]
dependsOn = ["NextcloudPostgresCluster"],
reconcilePrecondition = NextcloudPostgresBackup.ReconcilePrecondition::class
),
Dependent(
type = NextcloudDeployment::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import eu.glasskube.operator.apps.nextcloud.Nextcloud
import eu.glasskube.operator.apps.nextcloud.NextcloudReconciler
import eu.glasskube.operator.apps.nextcloud.databaseBackupBucketName
import eu.glasskube.operator.apps.nextcloud.resourceLabels
import eu.glasskube.operator.generic.dependent.postgres.PostgresWithoutBackupsSpecCondition
import eu.glasskube.operator.generic.dependent.postgres.backup.PostgresMinioBucketPrecondition
import eu.glasskube.operator.infra.minio.MinioBucket
import eu.glasskube.operator.infra.minio.MinioBucketSpec
import eu.glasskube.operator.infra.minio.minioBucket
Expand All @@ -16,7 +16,7 @@ import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDep

@KubernetesDependent(labelSelector = NextcloudReconciler.SELECTOR)
class NextcloudMinioBucket : CRUDKubernetesDependentResource<MinioBucket, Nextcloud>(MinioBucket::class.java) {
internal class ReconcilePrecondition : PostgresWithoutBackupsSpecCondition<MinioBucket, Nextcloud>()
internal class ReconcilePrecondition : PostgresMinioBucketPrecondition<MinioBucket, Nextcloud>()

override fun desired(primary: Nextcloud, context: Context<Nextcloud>) = minioBucket {
metadata {
Expand Down
Loading

0 comments on commit 345cdfc

Please sign in to comment.