Skip to content

Commit 3e275d1

Browse files
Jan-MFxKu
andauthored
Allow individual teams to do auto upgrade via operator. (zalando#1699)
* Allow whitelisting of teams to do auto upgrade upgrade via operator. Co-authored-by: Felix Kunde <[email protected]>
1 parent fbd980a commit 3e275d1

File tree

13 files changed

+60
-9
lines changed

13 files changed

+60
-9
lines changed

charts/postgres-operator/crds/operatorconfigurations.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ spec:
131131
major_version_upgrade_mode:
132132
type: string
133133
default: "off"
134+
major_version_upgrade_team_allow_list:
135+
type: array
136+
items:
137+
type: string
134138
minimal_major_version:
135139
type: string
136140
default: "9.6"

charts/postgres-operator/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ configUsers:
6464
configMajorVersionUpgrade:
6565
# "off": no upgrade, "manual": manifest triggers action, "full": minimal version violation triggers too
6666
major_version_upgrade_mode: "off"
67+
# upgrades will only be carried out for clusters of listed teams when mode is "off"
68+
# major_version_upgrade_team_allow_list:
69+
# - acid
70+
6771
# minimal Postgres major version that will not automatically be upgraded
6872
minimal_major_version: "9.6"
6973
# target Postgres major version when upgrading clusters automatically

docs/reference/operator_parameters.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ CRD-configuration, they are grouped under the `major_version_upgrade` key.
184184
Note, that with all three modes increasing the version in the manifest will
185185
trigger a rolling update of the pods. The default is `"off"`.
186186

187+
* **major_version_upgrade_team_allow_list**
188+
Upgrades will only be carried out for clusters of listed teams when mode is
189+
set to "off". The default is empty.
190+
187191
* **minimal_major_version**
188192
The minimal Postgres major version that will not automatically be upgraded
189193
when `major_version_upgrade_mode` is set to `"full"`. The default is `"9.6"`.

docs/user.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,10 +603,9 @@ spec:
603603
```
604604

605605
Some extensions require SUPERUSER rights on creation unless they are not
606-
whitelisted by the [pgextwlist](https://github.com/dimitri/pgextwlist)
607-
extension, that is shipped with the Spilo image. To see which extensions are
608-
on the list check the `extwlist.extension` parameter in the postgresql.conf
609-
file.
606+
allowed by the [pgextwlist](https://github.com/dimitri/pgextwlist) extension,
607+
that is shipped with the Spilo image. To see which extensions are on the list
608+
check the `extwlist.extension` parameter in the postgresql.conf file.
610609

611610
```bash
612611
SHOW extwlist.extensions;

manifests/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ data:
7777
logical_backup_s3_sse: "AES256"
7878
logical_backup_schedule: "30 00 * * *"
7979
major_version_upgrade_mode: "manual"
80+
# major_version_upgrade_team_allow_list: ""
8081
master_dns_name_format: "{cluster}.{team}.{hostedzone}"
8182
# master_pod_move_timeout: 20m
8283
# max_instances: "-1"

manifests/operatorconfiguration.crd.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ spec:
129129
major_version_upgrade_mode:
130130
type: string
131131
default: "off"
132+
major_version_upgrade_team_allow_list:
133+
type: array
134+
items:
135+
type: string
132136
minimal_major_version:
133137
type: string
134138
default: "9.6"

manifests/postgresql-operator-default-configuration.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ configuration:
2828
super_username: postgres
2929
major_version_upgrade:
3030
major_version_upgrade_mode: "off"
31+
# major_version_upgrade_team_allow_list:
32+
# - acid
3133
minimal_major_version: "9.6"
3234
target_major_version: "14"
3335
kubernetes:

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,14 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
10191019
"major_version_upgrade_mode": {
10201020
Type: "string",
10211021
},
1022+
"major_version_upgrade_team_allow_list": {
1023+
Type: "array",
1024+
Items: &apiextv1.JSONSchemaPropsOrArray{
1025+
Schema: &apiextv1.JSONSchemaProps{
1026+
Type: "string",
1027+
},
1028+
},
1029+
},
10221030
"minimal_major_version": {
10231031
Type: "string",
10241032
},

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ type PostgresUsersConfiguration struct {
4343

4444
// MajorVersionUpgradeConfiguration defines how to execute major version upgrades of Postgres.
4545
type MajorVersionUpgradeConfiguration struct {
46-
MajorVersionUpgradeMode string `json:"major_version_upgrade_mode" default:"off"` // off - no actions, manual - manifest triggers action, full - manifest and minimal version violation trigger upgrade
47-
MinimalMajorVersion string `json:"minimal_major_version" default:"9.6"`
48-
TargetMajorVersion string `json:"target_major_version" default:"14"`
46+
MajorVersionUpgradeMode string `json:"major_version_upgrade_mode" default:"off"` // off - no actions, manual - manifest triggers action, full - manifest and minimal version violation trigger upgrade
47+
MajorVersionUpgradeTeamAllowList []string `json:"major_version_upgrade_team_allow_list,omitempty"`
48+
MinimalMajorVersion string `json:"minimal_major_version" default:"9.6"`
49+
TargetMajorVersion string `json:"target_major_version" default:"14"`
4950
}
5051

5152
// KubernetesMetaConfiguration defines k8s conf required for all Postgres clusters and the operator itself

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

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)