From c0a4c83df18c7f6a7bda4a9a01ceacd0097068c3 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Thu, 17 Dec 2020 10:11:10 +0100 Subject: [PATCH 1/2] use pointer types for preparedDatabases and nodeAffinity --- pkg/apis/acid.zalan.do/v1/postgresql_type.go | 48 +++++++++---------- .../acid.zalan.do/v1/zz_generated.deepcopy.go | 30 ++++++++++-- pkg/cluster/cluster.go | 10 ++-- pkg/cluster/cluster_test.go | 6 +-- pkg/cluster/connection_pooler.go | 2 +- pkg/cluster/k8sres.go | 2 +- pkg/cluster/k8sres_test.go | 2 +- pkg/cluster/sync.go | 6 +-- 8 files changed, 63 insertions(+), 43 deletions(-) diff --git a/pkg/apis/acid.zalan.do/v1/postgresql_type.go b/pkg/apis/acid.zalan.do/v1/postgresql_type.go index 0c87f96f8..d0a767abd 100644 --- a/pkg/apis/acid.zalan.do/v1/postgresql_type.go +++ b/pkg/apis/acid.zalan.do/v1/postgresql_type.go @@ -53,27 +53,27 @@ type PostgresSpec struct { // load balancers' source ranges are the same for master and replica services AllowedSourceRanges []string `json:"allowedSourceRanges"` - NumberOfInstances int32 `json:"numberOfInstances"` - Users map[string]UserFlags `json:"users,omitempty"` - MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"` - Clone *CloneDescription `json:"clone,omitempty"` - ClusterName string `json:"-"` - Databases map[string]string `json:"databases,omitempty"` - PreparedDatabases map[string]PreparedDatabase `json:"preparedDatabases,omitempty"` - SchedulerName *string `json:"schedulerName,omitempty"` - NodeAffinity v1.NodeAffinity `json:"nodeAffinity,omitempty"` - Tolerations []v1.Toleration `json:"tolerations,omitempty"` - Sidecars []Sidecar `json:"sidecars,omitempty"` - InitContainers []v1.Container `json:"initContainers,omitempty"` - PodPriorityClassName string `json:"podPriorityClassName,omitempty"` - ShmVolume *bool `json:"enableShmVolume,omitempty"` - EnableLogicalBackup bool `json:"enableLogicalBackup,omitempty"` - LogicalBackupSchedule string `json:"logicalBackupSchedule,omitempty"` - StandbyCluster *StandbyDescription `json:"standby,omitempty"` - PodAnnotations map[string]string `json:"podAnnotations,omitempty"` - ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"` - TLS *TLSDescription `json:"tls,omitempty"` - AdditionalVolumes []AdditionalVolume `json:"additionalVolumes,omitempty"` + NumberOfInstances int32 `json:"numberOfInstances"` + Users map[string]UserFlags `json:"users,omitempty"` + MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"` + Clone *CloneDescription `json:"clone,omitempty"` + ClusterName string `json:"-"` + Databases map[string]string `json:"databases,omitempty"` + PreparedDatabases map[string]*PreparedDatabase `json:"preparedDatabases,omitempty"` + SchedulerName *string `json:"schedulerName,omitempty"` + NodeAffinity *v1.NodeAffinity `json:"nodeAffinity,omitempty"` + Tolerations []v1.Toleration `json:"tolerations,omitempty"` + Sidecars []Sidecar `json:"sidecars,omitempty"` + InitContainers []v1.Container `json:"initContainers,omitempty"` + PodPriorityClassName string `json:"podPriorityClassName,omitempty"` + ShmVolume *bool `json:"enableShmVolume,omitempty"` + EnableLogicalBackup bool `json:"enableLogicalBackup,omitempty"` + LogicalBackupSchedule string `json:"logicalBackupSchedule,omitempty"` + StandbyCluster *StandbyDescription `json:"standby,omitempty"` + PodAnnotations map[string]string `json:"podAnnotations,omitempty"` + ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"` + TLS *TLSDescription `json:"tls,omitempty"` + AdditionalVolumes []AdditionalVolume `json:"additionalVolumes,omitempty"` // deprecated json tags InitContainersOld []v1.Container `json:"init_containers,omitempty"` @@ -92,9 +92,9 @@ type PostgresqlList struct { // PreparedDatabase describes elements to be bootstrapped type PreparedDatabase struct { - PreparedSchemas map[string]PreparedSchema `json:"schemas,omitempty"` - DefaultUsers bool `json:"defaultUsers,omitempty" defaults:"false"` - Extensions map[string]string `json:"extensions,omitempty"` + PreparedSchemas map[string]*PreparedSchema `json:"schemas,omitempty"` + DefaultUsers bool `json:"defaultUsers,omitempty" defaults:"false"` + Extensions map[string]string `json:"extensions,omitempty"` } // PreparedSchema describes elements to be bootstrapped per schema diff --git a/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go b/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go index 83cd18c40..e1f189944 100644 --- a/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go +++ b/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go @@ -623,9 +623,17 @@ func (in *PostgresSpec) DeepCopyInto(out *PostgresSpec) { } if in.PreparedDatabases != nil { in, out := &in.PreparedDatabases, &out.PreparedDatabases - *out = make(map[string]PreparedDatabase, len(*in)) + *out = make(map[string]*PreparedDatabase, len(*in)) for key, val := range *in { - (*out)[key] = *val.DeepCopy() + var outVal *PreparedDatabase + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(PreparedDatabase) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal } } if in.SchedulerName != nil { @@ -633,7 +641,11 @@ func (in *PostgresSpec) DeepCopyInto(out *PostgresSpec) { *out = new(string) **out = **in } - in.NodeAffinity.DeepCopyInto(&out.NodeAffinity) + if in.NodeAffinity != nil { + in, out := &in.NodeAffinity, &out.NodeAffinity + *out = new(corev1.NodeAffinity) + (*in).DeepCopyInto(*out) + } if in.Tolerations != nil { in, out := &in.Tolerations, &out.Tolerations *out = make([]corev1.Toleration, len(*in)) @@ -953,9 +965,17 @@ func (in *PreparedDatabase) DeepCopyInto(out *PreparedDatabase) { *out = *in if in.PreparedSchemas != nil { in, out := &in.PreparedSchemas, &out.PreparedSchemas - *out = make(map[string]PreparedSchema, len(*in)) + *out = make(map[string]*PreparedSchema, len(*in)) for key, val := range *in { - (*out)[key] = *val.DeepCopy() + var outVal *PreparedSchema + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(PreparedSchema) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal } } if in.Extensions != nil { diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 050aeb5b5..8e17e56a0 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -113,9 +113,9 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec acidv1.Postgres return fmt.Sprintf("%s-%s", e.PodName, e.ResourceVersion), nil }) - password_encryption, ok := pgSpec.Spec.PostgresqlParam.Parameters["password_encryption"] + passwordEncryption, ok := pgSpec.Spec.PostgresqlParam.Parameters["password_encryption"] if !ok { - password_encryption = "md5" + passwordEncryption = "md5" } cluster := &Cluster{ @@ -128,7 +128,7 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec acidv1.Postgres Secrets: make(map[types.UID]*v1.Secret), Services: make(map[PostgresRole]*v1.Service), Endpoints: make(map[PostgresRole]*v1.Endpoints)}, - userSyncStrategy: users.DefaultUserSyncStrategy{PasswordEncryption: password_encryption}, + userSyncStrategy: users.DefaultUserSyncStrategy{PasswordEncryption: passwordEncryption}, deleteOptions: metav1.DeleteOptions{PropagationPolicy: &deletePropagationPolicy}, podEventsQueue: podEventsQueue, KubeClient: kubeClient, @@ -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 diff --git a/pkg/cluster/cluster_test.go b/pkg/cluster/cluster_test.go index 1f6510e65..ba1a64394 100644 --- a/pkg/cluster/cluster_test.go +++ b/pkg/cluster/cluster_test.go @@ -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, }, diff --git a/pkg/cluster/connection_pooler.go b/pkg/cluster/connection_pooler.go index 82b855bf2..1d1d609e4 100644 --- a/pkg/cluster/connection_pooler.go +++ b/pkg/cluster/connection_pooler.go @@ -22,7 +22,7 @@ import ( "github.com/zalando/postgres-operator/pkg/util/k8sutil" ) -// K8S objects that are belong to connection pooler +// ConnectionPoolerObjects K8s objects that are belong to connection pooler type ConnectionPoolerObjects struct { Deployment *appsv1.Deployment Service *v1.Service diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index 1650d38d3..6b47b37f6 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -1223,7 +1223,7 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef effectiveRunAsUser, effectiveRunAsGroup, effectiveFSGroup, - nodeAffinity(c.OpConfig.NodeReadinessLabel, &spec.NodeAffinity), + nodeAffinity(c.OpConfig.NodeReadinessLabel, spec.NodeAffinity), spec.SchedulerName, int64(c.OpConfig.PodTerminateGracePeriod.Seconds()), c.OpConfig.PodServiceAccountName, diff --git a/pkg/cluster/k8sres_test.go b/pkg/cluster/k8sres_test.go index 8a5103cbe..8ab77eec3 100644 --- a/pkg/cluster/k8sres_test.go +++ b/pkg/cluster/k8sres_test.go @@ -882,7 +882,7 @@ func TestNodeAffinity(t *testing.T) { Volume: acidv1.Volume{ Size: "1G", }, - NodeAffinity: *nodeAffinity, + NodeAffinity: nodeAffinity, } } diff --git a/pkg/cluster/sync.go b/pkg/cluster/sync.go index dc54ae8ee..fcce438bc 100644 --- a/pkg/cluster/sync.go +++ b/pkg/cluster/sync.go @@ -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() From f10c3ab77caa1bec888d0516e67240c260d84ab3 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Fri, 18 Dec 2020 09:52:45 +0100 Subject: [PATCH 2/2] revert pointers for PreparedDatabases structs --- pkg/apis/acid.zalan.do/v1/postgresql_type.go | 48 +++++++++---------- .../acid.zalan.do/v1/zz_generated.deepcopy.go | 24 ++-------- pkg/cluster/cluster.go | 4 +- pkg/cluster/cluster_test.go | 6 +-- pkg/cluster/sync.go | 6 +-- 5 files changed, 36 insertions(+), 52 deletions(-) diff --git a/pkg/apis/acid.zalan.do/v1/postgresql_type.go b/pkg/apis/acid.zalan.do/v1/postgresql_type.go index d0a767abd..bdae22a7c 100644 --- a/pkg/apis/acid.zalan.do/v1/postgresql_type.go +++ b/pkg/apis/acid.zalan.do/v1/postgresql_type.go @@ -53,27 +53,27 @@ type PostgresSpec struct { // load balancers' source ranges are the same for master and replica services AllowedSourceRanges []string `json:"allowedSourceRanges"` - NumberOfInstances int32 `json:"numberOfInstances"` - Users map[string]UserFlags `json:"users,omitempty"` - MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"` - Clone *CloneDescription `json:"clone,omitempty"` - ClusterName string `json:"-"` - Databases map[string]string `json:"databases,omitempty"` - PreparedDatabases map[string]*PreparedDatabase `json:"preparedDatabases,omitempty"` - SchedulerName *string `json:"schedulerName,omitempty"` - NodeAffinity *v1.NodeAffinity `json:"nodeAffinity,omitempty"` - Tolerations []v1.Toleration `json:"tolerations,omitempty"` - Sidecars []Sidecar `json:"sidecars,omitempty"` - InitContainers []v1.Container `json:"initContainers,omitempty"` - PodPriorityClassName string `json:"podPriorityClassName,omitempty"` - ShmVolume *bool `json:"enableShmVolume,omitempty"` - EnableLogicalBackup bool `json:"enableLogicalBackup,omitempty"` - LogicalBackupSchedule string `json:"logicalBackupSchedule,omitempty"` - StandbyCluster *StandbyDescription `json:"standby,omitempty"` - PodAnnotations map[string]string `json:"podAnnotations,omitempty"` - ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"` - TLS *TLSDescription `json:"tls,omitempty"` - AdditionalVolumes []AdditionalVolume `json:"additionalVolumes,omitempty"` + NumberOfInstances int32 `json:"numberOfInstances"` + Users map[string]UserFlags `json:"users,omitempty"` + MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"` + Clone *CloneDescription `json:"clone,omitempty"` + ClusterName string `json:"-"` + Databases map[string]string `json:"databases,omitempty"` + PreparedDatabases map[string]PreparedDatabase `json:"preparedDatabases,omitempty"` + SchedulerName *string `json:"schedulerName,omitempty"` + NodeAffinity *v1.NodeAffinity `json:"nodeAffinity,omitempty"` + Tolerations []v1.Toleration `json:"tolerations,omitempty"` + Sidecars []Sidecar `json:"sidecars,omitempty"` + InitContainers []v1.Container `json:"initContainers,omitempty"` + PodPriorityClassName string `json:"podPriorityClassName,omitempty"` + ShmVolume *bool `json:"enableShmVolume,omitempty"` + EnableLogicalBackup bool `json:"enableLogicalBackup,omitempty"` + LogicalBackupSchedule string `json:"logicalBackupSchedule,omitempty"` + StandbyCluster *StandbyDescription `json:"standby,omitempty"` + PodAnnotations map[string]string `json:"podAnnotations,omitempty"` + ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"` + TLS *TLSDescription `json:"tls,omitempty"` + AdditionalVolumes []AdditionalVolume `json:"additionalVolumes,omitempty"` // deprecated json tags InitContainersOld []v1.Container `json:"init_containers,omitempty"` @@ -92,9 +92,9 @@ type PostgresqlList struct { // PreparedDatabase describes elements to be bootstrapped type PreparedDatabase struct { - PreparedSchemas map[string]*PreparedSchema `json:"schemas,omitempty"` - DefaultUsers bool `json:"defaultUsers,omitempty" defaults:"false"` - Extensions map[string]string `json:"extensions,omitempty"` + PreparedSchemas map[string]PreparedSchema `json:"schemas,omitempty"` + DefaultUsers bool `json:"defaultUsers,omitempty" defaults:"false"` + Extensions map[string]string `json:"extensions,omitempty"` } // PreparedSchema describes elements to be bootstrapped per schema diff --git a/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go b/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go index e1f189944..2f4104ce9 100644 --- a/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go +++ b/pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go @@ -623,17 +623,9 @@ func (in *PostgresSpec) DeepCopyInto(out *PostgresSpec) { } if in.PreparedDatabases != nil { in, out := &in.PreparedDatabases, &out.PreparedDatabases - *out = make(map[string]*PreparedDatabase, len(*in)) + *out = make(map[string]PreparedDatabase, len(*in)) for key, val := range *in { - var outVal *PreparedDatabase - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(PreparedDatabase) - (*in).DeepCopyInto(*out) - } - (*out)[key] = outVal + (*out)[key] = *val.DeepCopy() } } if in.SchedulerName != nil { @@ -965,17 +957,9 @@ func (in *PreparedDatabase) DeepCopyInto(out *PreparedDatabase) { *out = *in if in.PreparedSchemas != nil { in, out := &in.PreparedSchemas, &out.PreparedSchemas - *out = make(map[string]*PreparedSchema, len(*in)) + *out = make(map[string]PreparedSchema, len(*in)) for key, val := range *in { - var outVal *PreparedSchema - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(PreparedSchema) - (*in).DeepCopyInto(*out) - } - (*out)[key] = outVal + (*out)[key] = *val.DeepCopy() } } if in.Extensions != nil { diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 8e17e56a0..42515a7c0 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -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 diff --git a/pkg/cluster/cluster_test.go b/pkg/cluster/cluster_test.go index ba1a64394..1f6510e65 100644 --- a/pkg/cluster/cluster_test.go +++ b/pkg/cluster/cluster_test.go @@ -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, }, diff --git a/pkg/cluster/sync.go b/pkg/cluster/sync.go index fcce438bc..dc54ae8ee 100644 --- a/pkg/cluster/sync.go +++ b/pkg/cluster/sync.go @@ -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()