mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-17 16:08:55 +02:00
revert pointers for PreparedDatabases structs
This commit is contained in:
@@ -975,7 +975,7 @@ func (c *Cluster) initSystemUsers() {
|
||||
func (c *Cluster) initPreparedDatabaseRoles() error {
|
||||
|
||||
if c.Spec.PreparedDatabases != nil && len(c.Spec.PreparedDatabases) == 0 { // TODO: add option to disable creating such a default DB
|
||||
c.Spec.PreparedDatabases = map[string]*acidv1.PreparedDatabase{strings.Replace(c.Name, "-", "_", -1): {}}
|
||||
c.Spec.PreparedDatabases = map[string]acidv1.PreparedDatabase{strings.Replace(c.Name, "-", "_", -1): {}}
|
||||
}
|
||||
|
||||
// create maps with default roles/users as keys and their membership as values
|
||||
@@ -994,7 +994,7 @@ func (c *Cluster) initPreparedDatabaseRoles() error {
|
||||
// get list of prepared schemas to set in search_path
|
||||
preparedSchemas := preparedDB.PreparedSchemas
|
||||
if len(preparedDB.PreparedSchemas) == 0 {
|
||||
preparedSchemas = map[string]*acidv1.PreparedSchema{"data": {DefaultRoles: util.True()}}
|
||||
preparedSchemas = map[string]acidv1.PreparedSchema{"data": {DefaultRoles: util.True()}}
|
||||
}
|
||||
|
||||
var searchPath strings.Builder
|
||||
|
||||
@@ -763,7 +763,7 @@ func TestInitSystemUsers(t *testing.T) {
|
||||
func TestPreparedDatabases(t *testing.T) {
|
||||
testName := "TestDefaultPreparedDatabase"
|
||||
|
||||
cl.Spec.PreparedDatabases = map[string]*acidv1.PreparedDatabase{}
|
||||
cl.Spec.PreparedDatabases = map[string]acidv1.PreparedDatabase{}
|
||||
cl.initPreparedDatabaseRoles()
|
||||
|
||||
for _, role := range []string{"acid_test_owner", "acid_test_reader", "acid_test_writer",
|
||||
@@ -775,10 +775,10 @@ func TestPreparedDatabases(t *testing.T) {
|
||||
|
||||
testName = "TestPreparedDatabaseWithSchema"
|
||||
|
||||
cl.Spec.PreparedDatabases = map[string]*acidv1.PreparedDatabase{
|
||||
cl.Spec.PreparedDatabases = map[string]acidv1.PreparedDatabase{
|
||||
"foo": {
|
||||
DefaultUsers: true,
|
||||
PreparedSchemas: map[string]*acidv1.PreparedSchema{
|
||||
PreparedSchemas: map[string]acidv1.PreparedSchema{
|
||||
"bar": {
|
||||
DefaultUsers: true,
|
||||
},
|
||||
|
||||
+3
-3
@@ -655,7 +655,7 @@ func (c *Cluster) syncDatabases() error {
|
||||
|
||||
// if no prepared databases are specified create a database named like the cluster
|
||||
if c.Spec.PreparedDatabases != nil && len(c.Spec.PreparedDatabases) == 0 { // TODO: add option to disable creating such a default DB
|
||||
c.Spec.PreparedDatabases = map[string]*acidv1.PreparedDatabase{strings.Replace(c.Name, "-", "_", -1): {}}
|
||||
c.Spec.PreparedDatabases = map[string]acidv1.PreparedDatabase{strings.Replace(c.Name, "-", "_", -1): {}}
|
||||
}
|
||||
for preparedDatabaseName := range c.Spec.PreparedDatabases {
|
||||
_, exists := currentDatabases[preparedDatabaseName]
|
||||
@@ -710,7 +710,7 @@ func (c *Cluster) syncPreparedDatabases() error {
|
||||
// now, prepare defined schemas
|
||||
preparedSchemas := preparedDB.PreparedSchemas
|
||||
if len(preparedDB.PreparedSchemas) == 0 {
|
||||
preparedSchemas = map[string]*acidv1.PreparedSchema{"data": {DefaultRoles: util.True()}}
|
||||
preparedSchemas = map[string]acidv1.PreparedSchema{"data": {DefaultRoles: util.True()}}
|
||||
}
|
||||
if err := c.syncPreparedSchemas(preparedDbName, preparedSchemas); err != nil {
|
||||
return err
|
||||
@@ -729,7 +729,7 @@ func (c *Cluster) syncPreparedDatabases() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) syncPreparedSchemas(databaseName string, preparedSchemas map[string]*acidv1.PreparedSchema) error {
|
||||
func (c *Cluster) syncPreparedSchemas(databaseName string, preparedSchemas map[string]acidv1.PreparedSchema) error {
|
||||
c.setProcessName("syncing prepared schemas")
|
||||
|
||||
currentSchemas, err := c.getSchemas()
|
||||
|
||||
Reference in New Issue
Block a user