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)
| 778 | // |
| 779 | // This function assumes that the backups/pgbackrest spec is present in cluster. |
| 780 | func 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 | } |
no outgoing calls