do not use words like whitelisting

This commit is contained in:
Felix Kunde 2021-11-25 12:37:23 +01:00
parent d8040fe0ab
commit e378566da9
12 changed files with 19 additions and 20 deletions

View File

@ -131,7 +131,7 @@ spec:
major_version_upgrade_mode: major_version_upgrade_mode:
type: string type: string
default: "off" default: "off"
major_version_upgrade_team_whitelist: major_version_upgrade_team_allow_list:
type: array type: array
items: items:
type: string type: string

View File

@ -65,7 +65,7 @@ configMajorVersionUpgrade:
# "off": no upgrade, "manual": manifest triggers action, "full": minimal version violation triggers too # "off": no upgrade, "manual": manifest triggers action, "full": minimal version violation triggers too
major_version_upgrade_mode: "off" major_version_upgrade_mode: "off"
# upgrades will only be carried out for clusters of listed teams # upgrades will only be carried out for clusters of listed teams
# major_version_upgrade_team_whitelist: # major_version_upgrade_team_allow_list:
# - acid # - acid
# minimal Postgres major version that will not automatically be upgraded # minimal Postgres major version that will not automatically be upgraded

View File

@ -184,7 +184,7 @@ CRD-configuration, they are grouped under the `major_version_upgrade` key.
Note, that with all three modes increasing the version in the manifest will Note, that with all three modes increasing the version in the manifest will
trigger a rolling update of the pods. The default is `"off"`. trigger a rolling update of the pods. The default is `"off"`.
* **major_version_upgrade_team_whitelist** * **major_version_upgrade_team_allow_list**
Upgrades will only be carried out for clusters of listed teams. The default Upgrades will only be carried out for clusters of listed teams. The default
is empty which means a team filter is not applied. is empty which means a team filter is not applied.

View File

@ -603,10 +603,9 @@ spec:
``` ```
Some extensions require SUPERUSER rights on creation unless they are not Some extensions require SUPERUSER rights on creation unless they are not
whitelisted by the [pgextwlist](https://github.com/dimitri/pgextwlist) allowed by the [pgextwlist](https://github.com/dimitri/pgextwlist) extension,
extension, that is shipped with the Spilo image. To see which extensions are that is shipped with the Spilo image. To see which extensions are on the list
on the list check the `extwlist.extension` parameter in the postgresql.conf check the `extwlist.extension` parameter in the postgresql.conf file.
file.
```bash ```bash
SHOW extwlist.extensions; SHOW extwlist.extensions;

View File

@ -77,7 +77,7 @@ data:
logical_backup_s3_sse: "AES256" logical_backup_s3_sse: "AES256"
logical_backup_schedule: "30 00 * * *" logical_backup_schedule: "30 00 * * *"
major_version_upgrade_mode: "manual" major_version_upgrade_mode: "manual"
# major_version_upgrade_team_whitelist: "" # major_version_upgrade_team_allow_list: ""
master_dns_name_format: "{cluster}.{team}.{hostedzone}" master_dns_name_format: "{cluster}.{team}.{hostedzone}"
# master_pod_move_timeout: 20m # master_pod_move_timeout: 20m
# max_instances: "-1" # max_instances: "-1"

View File

@ -129,7 +129,7 @@ spec:
major_version_upgrade_mode: major_version_upgrade_mode:
type: string type: string
default: "off" default: "off"
major_version_upgrade_team_whitelist: major_version_upgrade_team_allow_list:
type: array type: array
items: items:
type: string type: string

View File

@ -28,7 +28,7 @@ configuration:
super_username: postgres super_username: postgres
major_version_upgrade: major_version_upgrade:
major_version_upgrade_mode: "off" major_version_upgrade_mode: "off"
# major_version_upgrade_team_whitelist: # major_version_upgrade_team_allow_list:
# - acid # - acid
minimal_major_version: "9.6" minimal_major_version: "9.6"
target_major_version: "14" target_major_version: "14"

View File

@ -1019,7 +1019,7 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
"major_version_upgrade_mode": { "major_version_upgrade_mode": {
Type: "string", Type: "string",
}, },
"major_version_upgrade_team_whitelist": { "major_version_upgrade_team_allow_list": {
Type: "array", Type: "array",
Items: &apiextv1.JSONSchemaPropsOrArray{ Items: &apiextv1.JSONSchemaPropsOrArray{
Schema: &apiextv1.JSONSchemaProps{ Schema: &apiextv1.JSONSchemaProps{

View File

@ -44,7 +44,7 @@ type PostgresUsersConfiguration struct {
// MajorVersionUpgradeConfiguration defines how to execute major version upgrades of Postgres. // MajorVersionUpgradeConfiguration defines how to execute major version upgrades of Postgres.
type MajorVersionUpgradeConfiguration struct { type MajorVersionUpgradeConfiguration struct {
MajorVersionUpgradeMode string `json:"major_version_upgrade_mode" default:"off"` // off - no actions, manual - manifest triggers action, full - manifest and minimal version violation trigger upgrade MajorVersionUpgradeMode string `json:"major_version_upgrade_mode" default:"off"` // off - no actions, manual - manifest triggers action, full - manifest and minimal version violation trigger upgrade
MajorVersionUpgradeTeamWhitelist []string `json:"major_version_upgrade_team_whitelist,omitempty"` MajorVersionUpgradeTeamAllowList []string `json:"major_version_upgrade_team_allow_list,omitempty"`
MinimalMajorVersion string `json:"minimal_major_version" default:"9.6"` MinimalMajorVersion string `json:"minimal_major_version" default:"9.6"`
TargetMajorVersion string `json:"target_major_version" default:"14"` TargetMajorVersion string `json:"target_major_version" default:"14"`
} }

View File

@ -45,25 +45,25 @@ func (c *Cluster) GetDesiredMajorVersion() string {
return c.Spec.PgVersion return c.Spec.PgVersion
} }
func (c *Cluster) isTeamWhitelisted(owningTeam string) bool { func (c *Cluster) isUpgradeAllowedForTeam(owningTeam string) bool {
whitelistedTeams := c.OpConfig.MajorVersionUpgradeTeamWhitelist allowedTeams := c.OpConfig.MajorVersionUpgradeTeamAllowList
if len(whitelistedTeams) == 0 { if len(allowedTeams) == 0 {
return false return false
} }
return util.SliceContains(whitelistedTeams, owningTeam) return util.SliceContains(allowedTeams, owningTeam)
} }
/* /*
Execute upgrade when mode is set to manual or full or when the owning team is whitelisted for upgrade. Execute upgrade when mode is set to manual or full or when the owning team is allowed for upgrade.
Manual upgrade means, it is triggered by the user via manifest version change Manual upgrade means, it is triggered by the user via manifest version change
Full upgrade means, operator also determines the minimal version used accross all clusters and upgrades violators. Full upgrade means, operator also determines the minimal version used accross all clusters and upgrades violators.
*/ */
func (c *Cluster) majorVersionUpgrade() error { func (c *Cluster) majorVersionUpgrade() error {
if c.OpConfig.MajorVersionUpgradeMode == "off" && !c.isTeamWhitelisted(c.Spec.TeamID) { if c.OpConfig.MajorVersionUpgradeMode == "off" && !c.isUpgradeAllowedForTeam(c.Spec.TeamID) {
return nil return nil
} }

View File

@ -56,7 +56,7 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur
// major version upgrade config // major version upgrade config
result.MajorVersionUpgradeMode = util.Coalesce(fromCRD.MajorVersionUpgrade.MajorVersionUpgradeMode, "off") result.MajorVersionUpgradeMode = util.Coalesce(fromCRD.MajorVersionUpgrade.MajorVersionUpgradeMode, "off")
result.MajorVersionUpgradeTeamWhitelist = fromCRD.MajorVersionUpgrade.MajorVersionUpgradeTeamWhitelist result.MajorVersionUpgradeTeamAllowList = fromCRD.MajorVersionUpgrade.MajorVersionUpgradeTeamAllowList
result.MinimalMajorVersion = util.Coalesce(fromCRD.MajorVersionUpgrade.MinimalMajorVersion, "9.6") result.MinimalMajorVersion = util.Coalesce(fromCRD.MajorVersionUpgrade.MinimalMajorVersion, "9.6")
result.TargetMajorVersion = util.Coalesce(fromCRD.MajorVersionUpgrade.TargetMajorVersion, "14") result.TargetMajorVersion = util.Coalesce(fromCRD.MajorVersionUpgrade.TargetMajorVersion, "14")

View File

@ -212,7 +212,7 @@ type Config struct {
EnablePgVersionEnvVar bool `name:"enable_pgversion_env_var" default:"true"` EnablePgVersionEnvVar bool `name:"enable_pgversion_env_var" default:"true"`
EnableSpiloWalPathCompat bool `name:"enable_spilo_wal_path_compat" default:"false"` EnableSpiloWalPathCompat bool `name:"enable_spilo_wal_path_compat" default:"false"`
MajorVersionUpgradeMode string `name:"major_version_upgrade_mode" default:"off"` MajorVersionUpgradeMode string `name:"major_version_upgrade_mode" default:"off"`
MajorVersionUpgradeTeamWhitelist []string `name:"major_version_upgrade_team_whitelist" default:""` MajorVersionUpgradeTeamAllowList []string `name:"major_version_upgrade_team_allow_list" default:""`
MinimalMajorVersion string `name:"minimal_major_version" default:"9.6"` MinimalMajorVersion string `name:"minimal_major_version" default:"9.6"`
TargetMajorVersion string `name:"target_major_version" default:"14"` TargetMajorVersion string `name:"target_major_version" default:"14"`
} }