working now

This commit is contained in:
Felix Kunde 2021-02-09 14:15:52 +01:00
parent cf67d610dd
commit db568c0ef5
3 changed files with 5 additions and 6 deletions

View File

@ -37,7 +37,7 @@ import (
type Controller struct { type Controller struct {
config spec.ControllerConfig config spec.ControllerConfig
opConfig *config.Config opConfig *config.Config
pgTeamMap *teams.PostgresTeamMap pgTeamMap teams.PostgresTeamMap
logger *logrus.Entry logger *logrus.Entry
KubeClient k8sutil.KubernetesClient KubeClient k8sutil.KubernetesClient

View File

@ -15,6 +15,7 @@ import (
acidv1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1" acidv1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
"github.com/zalando/postgres-operator/pkg/cluster" "github.com/zalando/postgres-operator/pkg/cluster"
"github.com/zalando/postgres-operator/pkg/spec" "github.com/zalando/postgres-operator/pkg/spec"
"github.com/zalando/postgres-operator/pkg/teams"
"github.com/zalando/postgres-operator/pkg/util" "github.com/zalando/postgres-operator/pkg/util"
"github.com/zalando/postgres-operator/pkg/util/config" "github.com/zalando/postgres-operator/pkg/util/config"
"github.com/zalando/postgres-operator/pkg/util/k8sutil" "github.com/zalando/postgres-operator/pkg/util/k8sutil"
@ -30,7 +31,7 @@ func (c *Controller) makeClusterConfig() cluster.Config {
return cluster.Config{ return cluster.Config{
RestConfig: c.config.RestConfig, RestConfig: c.config.RestConfig,
OpConfig: config.Copy(c.opConfig), OpConfig: config.Copy(c.opConfig),
PgTeamMap: c.pgTeamMap, PgTeamMap: &c.pgTeamMap,
InfrastructureRoles: infrastructureRoles, InfrastructureRoles: infrastructureRoles,
PodServiceAccount: c.PodServiceAccount, PodServiceAccount: c.PodServiceAccount,
} }
@ -395,7 +396,7 @@ func (c *Controller) getInfrastructureRole(
func (c *Controller) loadPostgresTeams() { func (c *Controller) loadPostgresTeams() {
// reset team map // reset team map
c.pgTeamMap.Reset() c.pgTeamMap = teams.PostgresTeamMap{}
pgTeams, err := c.KubeClient.PostgresTeamsGetter.PostgresTeams(c.opConfig.WatchedNamespace).List(context.TODO(), metav1.ListOptions{}) pgTeams, err := c.KubeClient.PostgresTeamsGetter.PostgresTeams(c.opConfig.WatchedNamespace).List(context.TODO(), metav1.ListOptions{})
if err != nil { if err != nil {

View File

@ -125,7 +125,5 @@ func (ptm *PostgresTeamMap) Load(pgTeams *acidv1.PostgresTeamList) {
// Reset a PostgresTeamMap // Reset a PostgresTeamMap
func (ptm *PostgresTeamMap) Reset() { func (ptm *PostgresTeamMap) Reset() {
if ptm != nil { *ptm = emptyTeamMap
*ptm = emptyTeamMap
}
} }