MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / generateRepoHostLogPath

Function generateRepoHostLogPath

internal/pgbackrest/config.go:780–794  ·  view source on GitHub ↗

generateRepoHostLogPath takes a postgrescluster and returns the log path that should be used by pgbackrest in the Repo Host Pod based on the repos specified and whether the user has specified a log path. This function assumes that the backups/pgbackrest spec is present in cluster.

(cluster *v1beta1.PostgresCluster)

Source from the content-addressed store, hash-verified

778//
779// This function assumes that the backups/pgbackrest spec is present in cluster.
780func generateRepoHostLogPath(cluster *v1beta1.PostgresCluster) string {
781 for _, repo := range cluster.Spec.Backups.PGBackRest.Repos {
782 if repo.Volume != nil {
783 // If the user has set a log path in the spec, use it.
784 // Otherwise, default to /pgbackrest/repo#/log
785 if cluster.Spec.Backups.PGBackRest.RepoHost != nil &&
786 cluster.Spec.Backups.PGBackRest.RepoHost.Log != nil &&
787 cluster.Spec.Backups.PGBackRest.RepoHost.Log.Path != "" {
788 return cluster.Spec.Backups.PGBackRest.RepoHost.Log.Path
789 }
790 return fmt.Sprintf(naming.PGBackRestRepoLogPath, repo.Name)
791 }
792 }
793 return ""
794}

Callers 3

MakePGBackrestLogDirFunction · 0.85

Calls

no outgoing calls

Tested by 1