Skip to content

Commit 3d89e92

Browse files
pooknullhors
andauthored
K8SPG-832: add .spec.backups.pgbackrest.repoHost.sidecars field (#1235)
* K8SPG-832: add `.spec.backups.pgbackrest.repoHost.sidecars` field https://perconadev.atlassian.net/browse/K8SPG-832 * address comments --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent 9703907 commit 3d89e92

File tree

15 files changed

+25605
-10711
lines changed

15 files changed

+25605
-10711
lines changed

build/crd/crunchy/generated/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 1458 additions & 0 deletions
Large diffs are not rendered by default.

build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml

Lines changed: 1458 additions & 0 deletions
Large diffs are not rendered by default.

cmd/postgres-operator/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ func main() {
8484

8585
features := feature.NewGate()
8686
err = features.SetFromMap(map[string]bool{
87-
string(feature.InstanceSidecars): true, // needed for PMM
88-
string(feature.PGBouncerSidecars): true, // K8SPG-645
89-
string(feature.TablespaceVolumes): true,
87+
feature.InstanceSidecars: true, // needed for PMM
88+
feature.PGBouncerSidecars: true, // K8SPG-645
89+
feature.PGBackrestRepoHostSidecars: true, // K8SPG-832
90+
feature.TablespaceVolumes: true,
9091
})
9192
assertNoError(err)
9293

config/crd/bases/pgv2.percona.com_perconapgclusters.yaml

Lines changed: 1458 additions & 0 deletions
Large diffs are not rendered by default.

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 1458 additions & 0 deletions
Large diffs are not rendered by default.

deploy/bundle.yaml

Lines changed: 6482 additions & 3566 deletions
Large diffs are not rendered by default.

deploy/cr.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,13 @@ spec:
496496
# repo3-path: /pgbackrest/postgres-operator/cluster1-multi-repo/repo3
497497
# repo4-path: /pgbackrest/postgres-operator/cluster1-multi-repo/repo4
498498
repoHost:
499+
# sidecars:
500+
# - name: testcontainer
501+
# image: busybox:latest
502+
# command: ["sleep", "30d"]
503+
# securityContext: {}
504+
# - name: testcontainer2
505+
# image: mycontainer1:latest
499506
# resources:
500507
# limits:
501508
# cpu: 200m

deploy/crd.yaml

Lines changed: 6482 additions & 3566 deletions
Large diffs are not rendered by default.

deploy/cw-bundle.yaml

Lines changed: 6482 additions & 3566 deletions
Large diffs are not rendered by default.

internal/controller/postgrescluster/pgbackrest.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,15 @@ func (r *Reconciler) generateRepoHostIntent(ctx context.Context, postgresCluster
730730

731731
// K8SPG-435
732732
resources := corev1.ResourceRequirements{}
733-
if postgresCluster.Spec.Backups.PGBackRest.RepoHost != nil {
733+
if repoHost := postgresCluster.Spec.Backups.PGBackRest.RepoHost; repoHost != nil {
734734
resources = postgresCluster.Spec.Backups.PGBackRest.RepoHost.Resources
735+
736+
// K8SPG-832
737+
// If the PGBackrestRepoHostSidecars feature gate is enabled and instance sidecars are
738+
// defined, add the defined container to the Pod.
739+
if feature.Enabled(ctx, feature.PGBackrestRepoHostSidecars) && repoHost.Sidecars != nil {
740+
repo.Spec.Template.Spec.Containers = append(repo.Spec.Template.Spec.Containers, repoHost.Sidecars...)
741+
}
735742
}
736743
sizeLimit := getTMPSizeLimit(repo.Labels[naming.LabelVersion], resources)
737744

0 commit comments

Comments
 (0)