make parameter name more descriptive

This commit is contained in:
Sergey Dudoladov 2020-03-10 13:29:31 +01:00
parent 507c79357f
commit f782181fd4
10 changed files with 17 additions and 17 deletions

View File

@ -62,7 +62,7 @@ spec:
type: string type: string
enable_crd_validation: enable_crd_validation:
type: boolean type: boolean
enable_lazy_image_upgrade: enable_lazy_spilo_upgrade:
type: boolean type: boolean
enable_shm_volume: enable_shm_volume:
type: boolean type: boolean

View File

@ -431,7 +431,7 @@ used internally in K8s.
The operator also support lazy updates of the Spilo image. That means the pod template of a The operator also support lazy updates of the Spilo image. That means the pod template of a
PG cluster's stateful set is updated immediately with the new image, but no rolling update follows. This feature saves you PG cluster's stateful set is updated immediately with the new image, but no rolling update follows. This feature saves you
a switchover - and hence downtime - when you know pods are re-started later anyway, for instance due to the node rotation. To force a rolling update, disable this mode by setting the `enable_lazy_image_upgrade` to `false` in the operator configuration and restart the operator pod. With the standard eager rolling updates the operator checks during Sync all pods run images specified in their respective statefulsets. The operator triggers a rolling upgrade fo PG clusters that violate this condition. a switchover - and hence downtime - when you know pods are re-started later anyway, for instance due to the node rotation. To force a rolling update, disable this mode by setting the `enable_lazy_spilo_upgrade` to `false` in the operator configuration and restart the operator pod. With the standard eager rolling updates the operator checks during Sync all pods run images specified in their respective statefulsets. The operator triggers a rolling upgrade fo PG clusters that violate this condition.
## Logical backups ## Logical backups

View File

@ -75,7 +75,7 @@ Those are top-level keys, containing both leaf keys and groups.
[OpenAPI v3 schema validation](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#validation) [OpenAPI v3 schema validation](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#validation)
The default is `true`. The default is `true`.
* **enable_lazy_image_upgrade** * **enable_lazy_spilo_upgrade**
Instruct operator to update only the statefulsets with the new image without immediately doing the rolling update. The assumption is pods will be re-started later with the new image, for example due to the node rotation. Instruct operator to update only the statefulsets with the new image without immediately doing the rolling update. The assumption is pods will be re-started later with the new image, for example due to the node rotation.
The default is `false`. The default is `false`.

View File

@ -109,7 +109,7 @@ class EndToEndTestCase(unittest.TestCase):
"Expected ClusterIP service type for replica, found {}".format(repl_svc_type)) "Expected ClusterIP service type for replica, found {}".format(repl_svc_type))
@timeout_decorator.timeout(TEST_TIMEOUT_SEC) @timeout_decorator.timeout(TEST_TIMEOUT_SEC)
def test_lazy_image_update(self): def test_lazy_spilo_update(self):
''' '''
Test lazy update for the Spilo image: operator changes a stateful set but lets pods run with the old image Test lazy update for the Spilo image: operator changes a stateful set but lets pods run with the old image
until they are recreated for reasons other than operator's activity. That works because the operator uses until they are recreated for reasons other than operator's activity. That works because the operator uses
@ -125,13 +125,13 @@ class EndToEndTestCase(unittest.TestCase):
pod1 = "acid-minimal-cluster-1" pod1 = "acid-minimal-cluster-1"
# enable lazy update # enable lazy update
patch_lazy_image_upgrade = { patch_lazy_spilo_upgrade = {
"data": { "data": {
"enable_lazy_image_upgrade": "true", "enable_lazy_spilo_upgrade": "true",
"docker_image": "registry.opensource.zalan.do/acid/spilo-cdp-12:1.6-p16" "docker_image": "registry.opensource.zalan.do/acid/spilo-cdp-12:1.6-p16"
} }
} }
k8s.update_config(patch_lazy_image_upgrade) k8s.update_config(patch_lazy_spilo_upgrade)
# wait for sts update # wait for sts update
time.sleep(60) time.sleep(60)
@ -147,12 +147,12 @@ class EndToEndTestCase(unittest.TestCase):
self.assertNotEqual(old_image, new_image, "Lazy updated failed: pods have the same image {}".format(new_image)) self.assertNotEqual(old_image, new_image, "Lazy updated failed: pods have the same image {}".format(new_image))
# clean up # clean up
unpatch_lazy_image_upgrade = { unpatch_lazy_spilo_upgrade = {
"data": { "data": {
"enable_lazy_image_upgrade": "false", "enable_lazy_spilo_upgrade": "false",
} }
} }
k8s.update_config(unpatch_lazy_image_upgrade) k8s.update_config(unpatch_lazy_spilo_upgrade)
# at this point operator will complete the normal rolling update # at this point operator will complete the normal rolling update
# so we additonally test if disabling the lazy update (forcing the normal rolling update) works # so we additonally test if disabling the lazy update (forcing the normal rolling update) works

View File

@ -24,7 +24,7 @@ data:
# enable_crd_validation: "true" # enable_crd_validation: "true"
# enable_database_access: "true" # enable_database_access: "true"
# enable_init_containers: "true" # enable_init_containers: "true"
# enable_lazy_image_upgrade: "true" # enable_lazy_spilo_upgrade: "true"
enable_master_load_balancer: "false" enable_master_load_balancer: "false"
# enable_pod_antiaffinity: "false" # enable_pod_antiaffinity: "false"
# enable_pod_disruption_budget: "true" # enable_pod_disruption_budget: "true"

View File

@ -38,7 +38,7 @@ spec:
type: string type: string
enable_crd_validation: enable_crd_validation:
type: boolean type: boolean
enable_lazy_image_upgrade: enable_lazy_spilo_upgrade:
type: boolean type: boolean
enable_shm_volume: enable_shm_volume:
type: boolean type: boolean

View File

@ -4,7 +4,7 @@ metadata:
name: postgresql-operator-default-configuration name: postgresql-operator-default-configuration
configuration: configuration:
# enable_crd_validation: true # enable_crd_validation: true
# enable_lazy_image_upgrade: true # enable_lazy_spilo_upgrade: true
etcd_host: "" etcd_host: ""
docker_image: registry.opensource.zalan.do/acid/spilo-12:1.6-p2 docker_image: registry.opensource.zalan.do/acid/spilo-12:1.6-p2
# enable_shm_volume: true # enable_shm_volume: true

View File

@ -411,7 +411,7 @@ func (c *Cluster) compareStatefulSetWith(statefulSet *appsv1.StatefulSet) *compa
// lazy Spilo update: modify the image in the statefulset itself but let its pods run with the old image // lazy Spilo update: modify the image in the statefulset itself but let its pods run with the old image
// until they are re-created for other reasons, for example node rotation // until they are re-created for other reasons, for example node rotation
if c.OpConfig.EnableLazyImageUpgrade && !reflect.DeepEqual(c.Statefulset.Spec.Template.Spec.Containers[0].Image, statefulSet.Spec.Template.Spec.Containers[0].Image) { if c.OpConfig.EnableLazySpiloUpgrade && !reflect.DeepEqual(c.Statefulset.Spec.Template.Spec.Containers[0].Image, statefulSet.Spec.Template.Spec.Containers[0].Image) {
needsReplace = true needsReplace = true
needsRollUpdate = false needsRollUpdate = false
reasons = append(reasons, "lazy Spilo update: new statefulset's pod image doesn't match the current one") reasons = append(reasons, "lazy Spilo update: new statefulset's pod image doesn't match the current one")
@ -458,7 +458,7 @@ func (c *Cluster) compareContainers(description string, setA, setB []v1.Containe
func(a, b v1.Container) bool { return !reflect.DeepEqual(a.EnvFrom, b.EnvFrom) }), func(a, b v1.Container) bool { return !reflect.DeepEqual(a.EnvFrom, b.EnvFrom) }),
} }
if !c.OpConfig.EnableLazyImageUpgrade { if !c.OpConfig.EnableLazySpiloUpgrade {
checks = append(checks, newCheck("new statefulset %s's %s (index %d) image doesn't match the current one", checks = append(checks, newCheck("new statefulset %s's %s (index %d) image doesn't match the current one",
func(a, b v1.Container) bool { return a.Image != b.Image })) func(a, b v1.Container) bool { return a.Image != b.Image }))
} }

View File

@ -246,7 +246,7 @@ func (c *Cluster) syncPodDisruptionBudget(isUpdate bool) error {
func (c *Cluster) mustUpdatePodsAfterLazyUpdate(desiredSset *appsv1.StatefulSet) (bool, error) { func (c *Cluster) mustUpdatePodsAfterLazyUpdate(desiredSset *appsv1.StatefulSet) (bool, error) {
if c.OpConfig.EnableLazyImageUpgrade { if c.OpConfig.EnableLazySpiloUpgrade {
return false, nil return false, nil
} }

View File

@ -137,7 +137,7 @@ type Config struct {
ProtectedRoles []string `name:"protected_role_names" default:"admin"` ProtectedRoles []string `name:"protected_role_names" default:"admin"`
PostgresSuperuserTeams []string `name:"postgres_superuser_teams" default:""` PostgresSuperuserTeams []string `name:"postgres_superuser_teams" default:""`
SetMemoryRequestToLimit bool `name:"set_memory_request_to_limit" default:"false"` SetMemoryRequestToLimit bool `name:"set_memory_request_to_limit" default:"false"`
EnableLazyImageUpgrade bool `name:"enable_lazy_image_upgrade" default:"false"` EnableLazySpiloUpgrade bool `name:"enable_lazy_spilo_upgrade" default:"false"`
} }
// MustMarshal marshals the config or panics // MustMarshal marshals the config or panics