mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-01-13 14:13:10 +01:00
chore: cleanup
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
This commit is contained in:
parent
57160bb6bf
commit
ccefe09773
@ -7,10 +7,7 @@ import (
|
|||||||
barmanBackup "github.com/cloudnative-pg/barman-cloud/pkg/backup"
|
barmanBackup "github.com/cloudnative-pg/barman-cloud/pkg/backup"
|
||||||
barmanCapabilities "github.com/cloudnative-pg/barman-cloud/pkg/capabilities"
|
barmanCapabilities "github.com/cloudnative-pg/barman-cloud/pkg/capabilities"
|
||||||
barmanCredentials "github.com/cloudnative-pg/barman-cloud/pkg/credentials"
|
barmanCredentials "github.com/cloudnative-pg/barman-cloud/pkg/credentials"
|
||||||
cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
|
|
||||||
"github.com/cloudnative-pg/cloudnative-pg/pkg/conditions"
|
|
||||||
"github.com/cloudnative-pg/cloudnative-pg/pkg/postgres"
|
"github.com/cloudnative-pg/cloudnative-pg/pkg/postgres"
|
||||||
"github.com/cloudnative-pg/cloudnative-pg/pkg/resources"
|
|
||||||
"github.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/decoder"
|
"github.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/decoder"
|
||||||
"github.com/cloudnative-pg/cnpg-i/pkg/backup"
|
"github.com/cloudnative-pg/cnpg-i/pkg/backup"
|
||||||
"github.com/cloudnative-pg/machinery/pkg/fileutils"
|
"github.com/cloudnative-pg/machinery/pkg/fileutils"
|
||||||
@ -61,16 +58,6 @@ func (b BackupServiceImplementation) Backup(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update backup status in cluster conditions on startup
|
|
||||||
if err := b.retryWithRefreshedCluster(ctx, cluster, func() error {
|
|
||||||
// TODO: this condition is set only here, never removed or handled?
|
|
||||||
return conditions.Patch(ctx, b.Client, cluster, cnpgv1.BackupStartingCondition)
|
|
||||||
}); err != nil {
|
|
||||||
contextLogger.Error(err, "Error changing backup condition (backup started)")
|
|
||||||
// We do not terminate here because we could still have a good backup
|
|
||||||
// even if we are unable to communicate with the Kubernetes API server
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := fileutils.EnsureDirectoryExists(postgres.BackupTemporaryDirectory); err != nil {
|
if err := fileutils.EnsureDirectoryExists(postgres.BackupTemporaryDirectory); err != nil {
|
||||||
contextLogger.Error(err, "Cannot create backup temporary directory", "err", err)
|
contextLogger.Error(err, "Cannot create backup temporary directory", "err", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -134,11 +121,3 @@ func (b BackupServiceImplementation) Backup(
|
|||||||
Metadata: nil,
|
Metadata: nil,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BackupServiceImplementation) retryWithRefreshedCluster(
|
|
||||||
ctx context.Context,
|
|
||||||
cluster *cnpgv1.Cluster,
|
|
||||||
cb func() error,
|
|
||||||
) error {
|
|
||||||
return resources.RetryWithRefreshedResource(ctx, b.Client, cluster, cb)
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user