apiVersion: v1
data:
  wait-for-backends.sh: |-
    #!/bin/bash

    set -o errexit
    set -o pipefail
    set -o nounset

    # Auxiliary functions
    k8s_wait_for_statefulset() {
        namespace=${1:?namespace is missing}
        statefulset=${2:?statefulset name is missing}
        local -i return_code=0

        echo "Waiting for statefulset ${statefulset} to be successfully rolled out..."
        kubectl rollout status --namespace "$namespace" statefulset "$statefulset" >/dev/null 2>&1 || return_code=$?
        echo "Rollout exit code: '${return_code}'"
        return $return_code
    }
    k8s_wait_for_statefulset default RELEASE-NAME-mariadb
    k8s_wait_for_statefulset default RELEASE-NAME-rabbitmq
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/instance: RELEASE-NAME
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: spring-cloud-dataflow
    helm.sh/chart: spring-cloud-dataflow-5.0.5
  name: RELEASE-NAME-spring-cloud-dataflow-scripts
  namespace: default
