@@ -2935,11 +2935,7 @@ func ensurePath(file string, defaultDir string, defaultFile string) string {
29352935func (c * Cluster ) generatePgbackrestConfigmap () (* v1.ConfigMap , error ) {
29362936 config := "[db]\n pg1-path = /home/postgres/pgdata/pgroot/data\n pg1-port = 5432\n pg1-socket-path = /var/run/postgresql/\n "
29372937 config += "\n [global]\n log-path = /home/postgres/pgdata/pgbackrest/log\n spool-path = /home/postgres/pgdata/pgbackrest/spool-path"
2938- config += "\n tls-server-address=*"
2939- config += "\n tls-server-ca-file = /etc/pgbackrest/certs/pgbackrest.ca-roots"
2940- config += "\n tls-server-cert-file = /etc/pgbackrest/certs/pgbackrest-client.crt"
2941- config += "\n tls-server-key-file = /etc/pgbackrest/certs/pgbackrest-client.key"
2942- config += "\n tls-server-auth = " + c .clientCommonName () + "=*"
2938+
29432939 if c .Postgresql .Spec .Backup != nil && c .Postgresql .Spec .Backup .Pgbackrest != nil {
29442940 if global := c .Postgresql .Spec .Backup .Pgbackrest .Global ; global != nil {
29452941 for k , v := range global {
@@ -2950,20 +2946,43 @@ func (c *Cluster) generatePgbackrestConfigmap() (*v1.ConfigMap, error) {
29502946
29512947 if len (repos ) >= 1 {
29522948 for i , repo := range repos {
2953- if repo .Storage == "pvc" {
2949+ switch repo .Storage {
2950+ case "pvc" :
29542951 c .logger .Debugf ("DEBUG_OUTPUT %s %s" , c .clusterName ().Name , c .Namespace )
2952+ config += "\n tls-server-address=*"
2953+ config += "\n tls-server-ca-file = /etc/pgbackrest/certs/pgbackrest.ca-roots"
2954+ config += "\n tls-server-cert-file = /etc/pgbackrest/certs/pgbackrest-client.crt"
2955+ config += "\n tls-server-key-file = /etc/pgbackrest/certs/pgbackrest-client.key"
2956+ config += "\n tls-server-auth = " + c .clientCommonName () + "=*"
29552957 config += "\n repo" + fmt .Sprintf ("%d" , i + 1 ) + "-host = " + c .clusterName ().Name + "-pgbackrest-repo-host-0." + c .serviceName (ClusterPods ) + "." + c .Namespace + ".svc." + c .OpConfig .ClusterDomain
29562958 config += "\n repo" + fmt .Sprintf ("%d" , i + 1 ) + "-host-ca-file = /etc/pgbackrest/certs/pgbackrest.ca-roots"
29572959 config += "\n repo" + fmt .Sprintf ("%d" , i + 1 ) + "-host-cert-file = /etc/pgbackrest/certs/pgbackrest-client.crt"
29582960 config += "\n repo" + fmt .Sprintf ("%d" , i + 1 ) + "-host-key-file = /etc/pgbackrest/certs/pgbackrest-client.key"
29592961 config += "\n repo" + fmt .Sprintf ("%d" , i + 1 ) + "-host-type = tls"
29602962 config += "\n repo" + fmt .Sprintf ("%d" , i + 1 ) + "-host-user = postgres"
2961- } else {
2963+
2964+ case "s3" :
29622965 config += fmt .Sprintf ("\n %s-%s-bucket = %s" , repo .Name , repo .Storage , repo .Resource )
29632966 config += fmt .Sprintf ("\n %s-%s-endpoint = %s" , repo .Name , repo .Storage , repo .Endpoint )
29642967 config += fmt .Sprintf ("\n %s-%s-region = %s" , repo .Name , repo .Storage , repo .Region )
29652968 config += fmt .Sprintf ("\n %s-type = %s" , repo .Name , repo .Storage )
2969+
2970+ case "gcs" :
2971+ config += fmt .Sprintf ("\n %s-%s-bucket = %s" , repo .Name , repo .Storage , repo .Resource )
2972+ config += fmt .Sprintf ("\n %s-%s-key = /etc/pgbackrest/conf.d/%s" , repo .Name , repo .Storage , repo .Key )
2973+ config += fmt .Sprintf ("\n %s-%s-key-type = %s" , repo .Name , repo .Storage , repo .KeyType )
2974+ config += fmt .Sprintf ("\n %s-type = %s" , repo .Name , repo .Storage )
2975+
2976+ case "azure" :
2977+ config += fmt .Sprintf ("\n %s-%s-container = %s" , repo .Name , repo .Storage , repo .Resource )
2978+ config += fmt .Sprintf ("\n %s-%s-endpoint = %s" , repo .Name , repo .Storage , repo .Endpoint )
2979+ config += fmt .Sprintf ("\n %s-%s-key = %s" , repo .Name , repo .Storage , repo .Key )
2980+ config += fmt .Sprintf ("\n %s-%s-account = %s" , repo .Name , repo .Storage , repo .Account )
2981+
2982+ config += fmt .Sprintf ("\n %s-type = %s" , repo .Name , repo .Storage )
2983+ default :
29662984 }
2985+
29672986 }
29682987 }
29692988 }
0 commit comments