convertPostgresIDToK8s transforms a postgres identifier to be a valid K8s label. NOTE: this is a reversible transformation, as we swap invalid K8s chars into invalid PG chars
(tablespaceName string)
| 69 | // |
| 70 | // NOTE: this is a reversible transformation, as we swap invalid K8s chars into invalid PG chars |
| 71 | func convertPostgresIDToK8s(tablespaceName string) string { |
| 72 | // Postgres identifiers can begin with _ or a letter, K8's must begin |
| 73 | // with an alphanumeric. We convert _ to 1 in this edge case |
| 74 | if strings.HasPrefix(tablespaceName, "_") { |
| 75 | tablespaceName = strings.Replace(tablespaceName, "_", "1", 1) |
| 76 | } |
| 77 | name := strings.ReplaceAll(tablespaceName, "$", "-") |
| 78 | return name |
| 79 | } |
| 80 | |
| 81 | // PvcNameForTablespace returns the normalized tablespace PVC name for a given |
| 82 | // tablespace, on a cluster pod |
no outgoing calls
no test coverage detected