Skip to content

Commit 9a11e85

Browse files
authored
disable PostgresTeam by default (zalando#1186)
* disable PostgresTeam by default * fix version in chart
1 parent e10e0fe commit 9a11e85

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

charts/postgres-operator/values-crd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ configTeamsApi:
257257
# enable_admin_role_for_users: true
258258

259259
# operator watches for PostgresTeam CRs to assign additional teams and members to clusters
260-
enable_postgres_team_crd: true
260+
enable_postgres_team_crd: false
261261
# toogle to create additional superuser teams from PostgresTeam CRs
262262
# enable_postgres_team_crd_superusers: "false"
263263

charts/postgres-operator/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
image:
22
registry: registry.opensource.zalan.do
33
repository: acid/postgres-operator
4-
tag: v1.5.0-61-ged2b3239-dirty
4+
tag: v1.5.0
55
pullPolicy: "IfNotPresent"
66

77
# Optionally specify an array of imagePullSecrets.
@@ -249,7 +249,7 @@ configTeamsApi:
249249
# enable_admin_role_for_users: "true"
250250

251251
# operator watches for PostgresTeam CRs to assign additional teams and members to clusters
252-
enable_postgres_team_crd: "true"
252+
enable_postgres_team_crd: "false"
253253
# toogle to create additional superuser teams from PostgresTeam CRs
254254
# enable_postgres_team_crd_superusers: "false"
255255

docs/reference/operator_parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ key.
635635
* **enable_postgres_team_crd**
636636
toggle to make the operator watch for created or updated `PostgresTeam` CRDs
637637
and create roles for specified additional teams and members.
638-
The default is `true`.
638+
The default is `false`.
639639

640640
* **enable_postgres_team_crd_superusers**
641641
in a `PostgresTeam` CRD additional superuser teams can assigned to teams that

docs/user.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ spec:
330330
- "foo"
331331
```
332332

333+
Note, by default the `PostgresTeam` support is disabled in the configuration.
334+
Switch `enable_postgres_team_crd` flag to `true` and the operator will start to
335+
watch for this CRD. Make sure, the cluster role is up to date and contains a
336+
section for [PostgresTeam](../manifests/operator-service-account-rbac.yaml#L30).
337+
333338
## Prepared databases with roles and default privileges
334339

335340
The `users` section in the manifests only allows for creating database roles

manifests/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ data:
4141
enable_master_load_balancer: "false"
4242
# enable_pod_antiaffinity: "false"
4343
# enable_pod_disruption_budget: "true"
44-
# enable_postgres_team_crd: "true"
44+
# enable_postgres_team_crd: "false"
4545
# enable_postgres_team_crd_superusers: "false"
4646
enable_replica_load_balancer: "false"
4747
# enable_shm_volume: "true"

manifests/postgresql-operator-default-configuration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ configuration:
122122
enable_database_access: true
123123
teams_api:
124124
# enable_admin_role_for_users: true
125-
# enable_postgres_team_crd: true
125+
# enable_postgres_team_crd: false
126126
# enable_postgres_team_crd_superusers: false
127127
enable_team_superuser: false
128128
enable_teams_api: false

pkg/apis/acid.zalan.do/v1/operator_configuration_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ type TeamsAPIConfiguration struct {
145145
PamConfiguration string `json:"pam_configuration,omitempty"`
146146
ProtectedRoles []string `json:"protected_role_names,omitempty"`
147147
PostgresSuperuserTeams []string `json:"postgres_superuser_teams,omitempty"`
148-
EnablePostgresTeamCRD *bool `json:"enable_postgres_team_crd,omitempty"`
148+
EnablePostgresTeamCRD bool `json:"enable_postgres_team_crd,omitempty"`
149149
EnablePostgresTeamCRDSuperusers bool `json:"enable_postgres_team_crd_superusers,omitempty"`
150150
}
151151

pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/controller/controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func (c *Controller) initController() {
329329

330330
c.initSharedInformers()
331331

332-
if c.opConfig.EnablePostgresTeamCRD != nil && *c.opConfig.EnablePostgresTeamCRD {
332+
if c.opConfig.EnablePostgresTeamCRD {
333333
c.loadPostgresTeams()
334334
} else {
335335
c.pgTeamMap = teams.PostgresTeamMap{}
@@ -380,7 +380,7 @@ func (c *Controller) initSharedInformers() {
380380
})
381381

382382
// PostgresTeams
383-
if c.opConfig.EnablePostgresTeamCRD != nil && *c.opConfig.EnablePostgresTeamCRD {
383+
if c.opConfig.EnablePostgresTeamCRD {
384384
c.postgresTeamInformer = acidv1informer.NewPostgresTeamInformer(
385385
c.KubeClient.AcidV1ClientSet,
386386
c.opConfig.WatchedNamespace,
@@ -453,7 +453,7 @@ func (c *Controller) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {
453453
go c.apiserver.Run(stopCh, wg)
454454
go c.kubeNodesInformer(stopCh, wg)
455455

456-
if c.opConfig.EnablePostgresTeamCRD != nil && *c.opConfig.EnablePostgresTeamCRD {
456+
if c.opConfig.EnablePostgresTeamCRD {
457457
go c.runPostgresTeamInformer(stopCh, wg)
458458
}
459459

pkg/controller/operator_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur
163163
result.PamConfiguration = util.Coalesce(fromCRD.TeamsAPI.PamConfiguration, "https://info.example.com/oauth2/tokeninfo?access_token= uid realm=/employees")
164164
result.ProtectedRoles = util.CoalesceStrArr(fromCRD.TeamsAPI.ProtectedRoles, []string{"admin"})
165165
result.PostgresSuperuserTeams = fromCRD.TeamsAPI.PostgresSuperuserTeams
166-
result.EnablePostgresTeamCRD = util.CoalesceBool(fromCRD.TeamsAPI.EnablePostgresTeamCRD, util.True())
166+
result.EnablePostgresTeamCRD = fromCRD.TeamsAPI.EnablePostgresTeamCRD
167167
result.EnablePostgresTeamCRDSuperusers = fromCRD.TeamsAPI.EnablePostgresTeamCRDSuperusers
168168

169169
// logging REST API config

pkg/util/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ type Config struct {
169169
EnableTeamSuperuser bool `name:"enable_team_superuser" default:"false"`
170170
TeamAdminRole string `name:"team_admin_role" default:"admin"`
171171
EnableAdminRoleForUsers bool `name:"enable_admin_role_for_users" default:"true"`
172-
EnablePostgresTeamCRD *bool `name:"enable_postgres_team_crd" default:"true"`
172+
EnablePostgresTeamCRD bool `name:"enable_postgres_team_crd" default:"false"`
173173
EnablePostgresTeamCRDSuperusers bool `name:"enable_postgres_team_crd_superusers" default:"false"`
174174
EnableMasterLoadBalancer bool `name:"enable_master_load_balancer" default:"true"`
175175
EnableReplicaLoadBalancer bool `name:"enable_replica_load_balancer" default:"false"`

0 commit comments

Comments
 (0)