Skip to content

Commit 39cc09c

Browse files
authored
feature toggle for using maintenance windows (#3074)
* feature toggle for using maintenance windows
1 parent e947889 commit 39cc09c

15 files changed

Lines changed: 73 additions & 16 deletions

charts/postgres-operator/crds/operatorconfigurations.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ spec:
7979
enable_lazy_spilo_upgrade:
8080
type: boolean
8181
default: false
82+
enable_maintenance_windows:
83+
type: boolean
84+
default: true
8285
enable_pgversion_env_var:
8386
type: boolean
8487
default: true

charts/postgres-operator/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ configGeneral:
2727
- "all"
2828
# update only the statefulsets without immediately doing the rolling update
2929
enable_lazy_spilo_upgrade: false
30+
# toogle to use maintenance windows feature
31+
enable_maintenance_windows: true
3032
# set the PGVERSION env var instead of providing the version via postgresql.bin_dir in SPILO_CONFIGURATION
3133
enable_pgversion_env_var: true
3234
# start any new database pod without limitations on shm memory

docs/administrator.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ Thus, the `full` mode can create drift between desired and actual state.
9595

9696
### Upgrade during maintenance windows
9797

98-
When `maintenanceWindows` are defined in the Postgres manifest the operator
99-
will trigger major-version-related pod rotation and the major version upgrade
100-
only during these periods. Make sure they are at least twice as long as your
101-
configured `resync_period` to guarantee
102-
that operator actions can be triggered.
98+
When `maintenanceWindows` are defined in the Postgres manifest or in the global
99+
config the operator will trigger major-version-related pod rotation and the
100+
major version upgrade only during these periods. Make sure they are at least
101+
twice as long as your configured `resync_period` to guarantee that operator
102+
actions can be triggered.
103103

104104
### Upgrade annotations
105105

docs/reference/cluster_manifest.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ These parameters are grouped directly under the `spec` key in the manifest.
118118
a list which defines specific time frames when certain maintenance operations
119119
such as automatic major upgrades or master pod migration are allowed to happen.
120120
Accepted formats are "01:00-06:00" for daily maintenance windows or
121-
"Sat:00:00-04:00" for specific days, with all times in UTC.
121+
"Sat:00:00-04:00" for specific days, with all times in UTC. Note, when the
122+
global config option `enable_maintenance_windows` is false, the specified
123+
windows will be ignored.
122124

123125
* **users**
124126
a map of usernames to user flags for the users that should be created in the

docs/reference/operator_parameters.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ Those are top-level keys, containing both leaf keys and groups.
173173
the thresholds. The value must be `"true"` to be effective. The default is empty
174174
which means the feature is disabled.
175175

176+
* **enable_maintenance_windows**
177+
toggle for using the maintenance windows feature. Default is `"true"`.
178+
176179
* **maintenance_windows**
177180
a list which defines specific time frames when certain maintenance
178181
operations such as automatic major upgrades or master pod migration are

manifests/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ data:
4646
enable_ebs_gp3_migration_max_size: "1000"
4747
enable_init_containers: "true"
4848
enable_lazy_spilo_upgrade: "false"
49+
enable_maintenance_windows: "true"
4950
enable_master_load_balancer: "false"
5051
enable_master_pooler_load_balancer: "false"
5152
enable_password_rotation: "false"

manifests/operatorconfiguration.crd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ spec:
7777
enable_lazy_spilo_upgrade:
7878
type: boolean
7979
default: false
80+
enable_maintenance_windows:
81+
type: boolean
82+
default: true
8083
enable_pgversion_env_var:
8184
type: boolean
8285
default: true

manifests/postgresql-operator-default-configuration.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ configuration:
88
# crd_categories:
99
# - all
1010
# enable_lazy_spilo_upgrade: false
11+
enable_maintenance_windows: true
1112
enable_pgversion_env_var: true
1213
# enable_shm_volume: true
1314
enable_spilo_wal_path_compat: false

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{
105105
"enable_lazy_spilo_upgrade": {
106106
Type: "boolean",
107107
},
108+
"enable_maintenance_windows": {
109+
Type: "boolean",
110+
},
108111
"enable_shm_volume": {
109112
Type: "boolean",
110113
},

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ type OperatorConfigurationData struct {
266266
Workers uint32 `json:"workers,omitempty"`
267267
ResyncPeriod Duration `json:"resync_period,omitempty"`
268268
RepairPeriod Duration `json:"repair_period,omitempty"`
269+
EnableMaintenanceWindows *bool `json:"enable_maintenance_windows,omitempty"`
269270
MaintenanceWindows []MaintenanceWindow `json:"maintenance_windows,omitempty"`
270271
SetMemoryRequestToLimit bool `json:"set_memory_request_to_limit,omitempty"`
271272
ShmVolume *bool `json:"enable_shm_volume,omitempty"`

0 commit comments

Comments
 (0)