mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-09 16:25:50 +02:00
finish up introducing MajorVersionUpgradeTeamWhitelist option
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/zalando/postgres-operator/pkg/spec"
|
||||
"github.com/zalando/postgres-operator/pkg/util"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
@@ -44,20 +45,14 @@ func (c *Cluster) GetDesiredMajorVersion() string {
|
||||
return c.Spec.PgVersion
|
||||
}
|
||||
|
||||
func isTeamWhitelisted(c *Cluster) bool {
|
||||
func (c *Cluster) isTeamWhitelisted(owningTeam string) bool {
|
||||
whitelistedTeams := c.OpConfig.MajorVersionUpgradeTeamWhitelist
|
||||
owningTeam := c.Spec.TeamID
|
||||
|
||||
if len(whitelistedTeams) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, t := range whitelistedTeams {
|
||||
if t == owningTeam {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return util.SliceContains(whitelistedTeams, owningTeam)
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -68,7 +63,7 @@ func isTeamWhitelisted(c *Cluster) bool {
|
||||
*/
|
||||
func (c *Cluster) majorVersionUpgrade() error {
|
||||
|
||||
if c.OpConfig.MajorVersionUpgradeMode == "off" && !isTeamWhitelisted(c) {
|
||||
if c.OpConfig.MajorVersionUpgradeMode == "off" && !c.isTeamWhitelisted(c.Spec.TeamID) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user