#!/bin/bash

stop::label() {
    echo "Stopping syndesis-server"
}

stop::doc() {
    cat <<EOT

The first step to perform is to stop all pods which can change the backend state of Syndesis so that there are no race conditions during the upgrade.
For the time being the only pod with access to backend state is syndesis-server and syndesis-meta, accessed by the UI.
Stopping should be performed by scaling down to 0 replicas for these pods and wait until they have been shut down in a controlled manner. Ideally, the UI will show a maintenance screen when in upgrade mode.
(But the UI should show a global error anyway when the backend syndesis-server is not available).

.Rollback

The compensation action for this step is to scale up syndesis-server to 1 and wait until it is entirely up.
EOT
}

DCS="syndesis-server syndesis-meta"

stop::run() {
  scale_deployments 0 "$DCS"
}

stop::rollback() {
  scale_deployments 1 "$DCS"
}
