diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 7532b13b9..e752d9626 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -78,6 +78,7 @@ type Cluster struct { currentProcess spec.Process processMu sync.RWMutex // protects the current operation for reporting, no need to hold the master mutex specMu sync.RWMutex // protects the spec for reporting, no need to hold the master mutex + dryRunMode bool } type compareStatefulsetResult struct { @@ -114,6 +115,7 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec spec.Postgresql deleteOptions: &metav1.DeleteOptions{OrphanDependents: &orphanDependents}, podEventsQueue: podEventsQueue, KubeClient: kubeClient, + dryRunMode: false, } cluster.logger = logger.WithField("pkg", "cluster").WithField("cluster-name", cluster.clusterName()) cluster.teamsAPIClient = teams.NewTeamsAPI(cfg.OpConfig.TeamsAPIUrl, logger) diff --git a/pkg/cluster/sync.go b/pkg/cluster/sync.go index 327c6d0e6..452606b2b 100644 --- a/pkg/cluster/sync.go +++ b/pkg/cluster/sync.go @@ -127,6 +127,14 @@ func (c *Cluster) applyActions(actions []Action) (err error) { } } + for _, action := range uniqueActions { + c.logger.Infof("Applying action %s", action.Name()) + } + + if c.dryRunMode { + return nil + } + for _, action := range uniqueActions { if err := action.Process(); err != nil { c.logger.Errorf("Can't apply action %s: %v", action.Name(), err)