Skip to content

Conversation

stang
Copy link
Contributor

@stang stang commented Mar 6, 2019

This PR is fixing #447 and #501

Note: for the update path, when deploying this new version of postgres-operator, it will automatically re-apply patroni config that are set in the current cluster spec, without restarting the pods.

@stang stang force-pushed the fix-patroni-config-updates branch 2 times, most recently from fe4176b to 2452cd5 Compare March 6, 2019 22:33
Signed-off-by: Stephane Tang <hi@stang.sh>
@stang stang force-pushed the fix-patroni-config-updates branch from 2452cd5 to 066c669 Compare March 7, 2019 13:39
@stang stang changed the title Fix patroni config updates WIP: Fix patroni config updates Mar 7, 2019
stang added 2 commits March 7, 2019 18:47
  Fixes zalando#501

Signed-off-by: Stephane Tang <hi@stang.sh>
  Fixes zalando#447

Signed-off-by: Stephane Tang <hi@stang.sh>
@stang stang force-pushed the fix-patroni-config-updates branch from 066c669 to d4faf3f Compare March 7, 2019 18:48
@stang stang changed the title WIP: Fix patroni config updates Fix patroni config updates Mar 7, 2019
@stang stang changed the title Fix patroni config updates WIP: Fix patroni config updates Mar 19, 2019
@FxKu FxKu added this to the v1.2 milestone May 20, 2019
@stang stang changed the title WIP: Fix patroni config updates Fix patroni config updates Jun 13, 2019
@stang
Copy link
Contributor Author

stang commented Jun 13, 2019

@FxKu - sorry I wasn't more active on this.

I've just merged-back current master branch in order to resolve conflicts. Hope this will make it to v1.2 :)

@stang stang force-pushed the fix-patroni-config-updates branch from 9b8f387 to 7f5ca22 Compare June 13, 2019 09:36
@FxKu
Copy link
Member

FxKu commented Jun 14, 2019

@stang, thanks and welcome back :)
We just had a discussion on how this can be handled (see #501). It def. needs some more thinking about what to put in the statefulSet.

// patroni configuration is not always reflected on the StatefulSet as they have
// different lifecycle (due to SPILO's implementation - see: issues#501) but they
// still need to be updated via the Patroni REST API.
if err := c.applyPatroniConfig(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the intention here to update Patroni config in DCS on every Update event even if the actual config did not change ?

}
}

config.Bootstrap.DCS.Slots = oldestKnownPatroniCfg.Slots
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but at this point the cluster already exists and bootstrap options have no effect. why are we resetting it again ? to get the same stateful set spec ?

}

func generateSpiloJSONConfiguration(pg *acidv1.PostgresqlParam, patroni *acidv1.Patroni, pamRoleName string, logger *logrus.Entry) (string, error) {
func generateSpiloJSONConfiguration(pg *acidv1.PostgresqlParam, patroni *acidv1.Patroni, pamRoleName string, logger *logrus.Entry, isNewCluster bool, initialPatroniConfig string) (string, error) {
Copy link
Member

@sdudoladov sdudoladov Jun 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests also need to be updated

pkg/cluster/k8sres_test.go:76:48: not enough arguments in call to generateSpiloJSONConfiguration
        have (*"github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1".PostgresqlParam, *"github.com/zala
ndo/postgres-operator/pkg/apis/acid.zalan.do/v1".Patroni, string, *logrus.Entry)
        want (*"github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1".PostgresqlParam, *"github.com/zala
ndo/postgres-operator/pkg/apis/acid.zalan.do/v1".Patroni, string, *logrus.Entry, bool, string)

@FxKu FxKu removed this from the v1.2 milestone Jul 5, 2019
@FxKu FxKu added this to the 1.7 milestone Feb 22, 2021
@FxKu FxKu removed this from the 1.7 milestone Mar 26, 2021
@FxKu FxKu added this to the 1.8 milestone Mar 26, 2021
@FxKu
Copy link
Member

FxKu commented Aug 23, 2021

Happy to conclude that with #1103 and #1535 merged, we have reached the same goal that was proposed here. Changes under Patroni are reflected and pods are not rotated if single parameters under postrgesql section change that only require a restart. Thanks again @stang for bringing it up.

@FxKu FxKu closed this Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants