mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-05 07:57:40 +02:00
Log command.
This commit is contained in:
@@ -58,6 +58,7 @@ func (c *Cluster) majorVersionUpgrade() error {
|
||||
|
||||
if ps.State != "running" {
|
||||
allRunning = false
|
||||
c.logger.Infof("identified non running pod, potentially skipping major version upgrade")
|
||||
}
|
||||
|
||||
if ps.Role == "master" {
|
||||
@@ -69,11 +70,13 @@ func (c *Cluster) majorVersionUpgrade() error {
|
||||
numberOfPods := len(pods)
|
||||
if allRunning && masterPod != nil {
|
||||
desiredVersion := c.GetDesiredMajorVersionAsInt()
|
||||
c.logger.Infof("cluster healthy with version: %d desired: %d", c.currentMajorVersion, desiredVersion)
|
||||
c.logger.Infof("healthy cluster, version: %d desired: %d", c.currentMajorVersion, desiredVersion)
|
||||
if c.currentMajorVersion < desiredVersion {
|
||||
podName := &spec.NamespacedName{Namespace: masterPod.Namespace, Name: masterPod.Name}
|
||||
c.logger.Infof("triggering major version upgrade on pod %s", masterPod.Name)
|
||||
_, err := c.ExecCommand(podName, fmt.Sprintf("su postgres -c \"python3 /scripts/inplace_upgrade.py %d 2>&1 | tee last_upgrade.log\"", numberOfPods))
|
||||
command := fmt.Sprintf("su postgres -c \"python3 /scripts/inplace_upgrade.py %d 2>&1 | tee last_upgrade.log\"", numberOfPods)
|
||||
c.logger.Info("executing: %s", command)
|
||||
_, err := c.ExecCommand(podName, command)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user