Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-11089

Document a command to export the 3scale CR as a backup

XMLWordPrintable

    • 3
    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started

      Currently the backup and restore documentation only covers the backup of the databases. However when using the Operator capabilities to provision 3scale Customers may need to export all the objects from time to time or before some activity in the cluster (for example, an upgrade).

      The request is to document a command that allows users to export all 3scale related CR as a backup in case there is any issue. 

      Example of command to copy the objects ONLY from the current namespace: 

      dir="$(mktemp -d)";pushd "${dir}" >/dev/null;echo "Dumping 3scale CRs:";for type in $(oc get crd -o NAME | egrep "(capabilities|apimanager|apicast)" | cut -d'/' -f2- | cut -d'.' -f1); do for name in $(oc get "${type}" -o custom-columns=POD:.metadata.name --no-headers); do echo -n "${type}/${name}: "; oc get "${type}/${name}" -o yaml > "${type}-${name}.yaml"; echo "OK"; done; done;echo;echo -n "Generating configuration file: ";tar cfJ 3scale-yamls.tar.xz *.yaml;echo "3scale-yamls.tar.xz";mv 3scale-yamls.tar.xz /tmp;rm -f *.yaml;popd >/dev/null;rmdir "${dir}";echo;echo "Done. Configuration file available at /tmp/3scale-yamls.tar.xz"
       

      Example of command to copy the objects from the entire cluster: 

      dir="$(mktemp -d)"; pushd "${dir}" >/dev/null; mkdir "3scale-cr-yamls"; echo "Dumping 3scale CRs:"; for type in $(oc get crd -o name -A | grep ".3scale.net$" | cut -d'/' -f2 | cut -d'.' -f1); do for name in $(oc get "${type}" -A -o go-template='{{range .items}}{{.metadata.namespace}},{{.metadata.name}}{{"\n"}}{{end}}'); do echo "${name%,*}: ${type}/${name#*,}"; if [ ! -d "3scale-cr-yamls/${name%,*}" ]; then mkdir "3scale-cr-yamls/${name%,*}"; fi; oc get "${type}/${name#*,}" -n "${name%,*}" -o yaml > "3scale-cr-yamls/${name%,*}/${type}-${name#*,}.yaml"; done; done; echo; echo -n "Generating configuration file: "; tar cfJ 3scale-cr-yamls.tar.xz 3scale-cr-yamls; echo "3scale-cr-yamls.tar.xz"; popd >/dev/null; mv "${dir}/3scale-cr-yamls.tar.xz" .; rm -rf "${dir}"; echo; echo "Done. Configuration file available at 3scale-cr-yamls.tar.xz"
      

            rhn-support-lcavalle Lluis Cavalle
            rhn-support-avilatus Anna Vila Tusell
            Lluis Cavalle Lluis Cavalle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: