Skip to content

Commit

Permalink
Add parameter for namespace prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
matskiv committed Mar 26, 2019
1 parent d51e926 commit ef9ca69
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions image/tools/lib/component/3scale-redis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ function component_dump_data {
dump_rdb_path="/var/lib/redis/data/dump.rdb"

oc projects
redis_pod_name=$(oc get pods -l deploymentConfig=backend-redis -o name -n 3scale | sed -e 's/^pod\///')
cp_pod_data "3scale/${redis_pod_name}:${dump_rdb_path}" "${dest_file}"
redis_pod_name=$(oc get pods -l deploymentConfig=backend-redis -o name -n ${PRODUCT_NAMESPACE_PREFIX}3scale | sed -e 's/^pod\///')
cp_pod_data "${PRODUCT_NAMESPACE_PREFIX}3scale/${redis_pod_name}:${dump_rdb_path}" "${dest_file}"
}
4 changes: 2 additions & 2 deletions image/tools/lib/component/codeready_pv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ function dump_pod_data {
workspace_pod_name=$1
dump_dest=$2
workspace_id=$(echo ${workspace_pod_name} | awk -F"." '{ print $1}')
cp_pod_data "codeready/${workspace_pod_name}:/projects" "${dump_dest}/${workspace_id}"
cp_pod_data "${PRODUCT_NAMESPACE_PREFIX}codeready/${workspace_pod_name}:/projects" "${dump_dest}/${workspace_id}"
}

function component_dump_data {
workspace_pods=$(oc get pods -n codeready | grep workspace | awk '{print $1}')
workspace_pods=$(oc get pods -n ${PRODUCT_NAMESPACE_PREFIX}codeready | grep workspace | awk '{print $1}')

if [ ${#workspace_pods} = 0 ]
then
Expand Down
4 changes: 2 additions & 2 deletions image/tools/lib/component/enmasse_pv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Brokered pods have a storage PV attached. They are labelled with role=broker
function get_broker_pods {
echo "`oc get pods --selector='role=broker' -n enmasse -o jsonpath='{.items[*].metadata.name}'`"
echo "`oc get pods --selector='role=broker' -n ${PRODUCT_NAMESPACE_PREFIX}enmasse -o jsonpath='{.items[*].metadata.name}'`"
}

function dump_pod_data {
Expand All @@ -12,7 +12,7 @@ function dump_pod_data {

# Create a backup directory for every pod with the same name
# as the pod
cp_pod_data "enmasse/${pod}:${data_dir}" "${dest}/${pod}"
cp_pod_data "${PRODUCT_NAMESPACE_PREFIX}enmasse/${pod}:${data_dir}" "${dest}/${pod}"
}
function component_dump_data {
local archive_path="$1/archives"
Expand Down
5 changes: 5 additions & 0 deletions templates/openshift/backup-cronjob-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ objects:
value: "${COMPONENT_SECRET_NAMESPACE}"
- name: PRODUCT_NAME
value: "${PRODUCT_NAME}"
- name: PRODUCT_NAMESPACE_PREFIX
value: "${PRODUCT_NAMESPACE_PREFIX}"
restartPolicy: Never
parameters:
- name: NAME
Expand All @@ -65,6 +67,9 @@ parameters:
- name: COMPONENT
description: Component name to run the backup
required: true
- name: PRODUCT_NAMESPACE_PREFIX
description: Namespace prefix for individual product namespaces. Empty by default. Planned to be 'openshift-' for RHMI.
value: ''
- name: BACKEND
description: Backend engine to upload the component archive
value: s3
Expand Down
5 changes: 5 additions & 0 deletions templates/openshift/backup-job-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ objects:
value: "${COMPONENT_SECRET_NAMESPACE}"
- name: PRODUCT_NAME
value: "${PRODUCT_NAME}"
- name: PRODUCT_NAMESPACE_PREFIX
value: "${PRODUCT_NAMESPACE_PREFIX}"
restartPolicy: Never
parameters:
- name: NAME
Expand All @@ -62,6 +64,9 @@ parameters:
- name: COMPONENT
description: Component name to run the backup
required: true
- name: PRODUCT_NAMESPACE_PREFIX
description: Namespace prefix for individual product namespaces. Empty by default. Planned to be 'openshift-' for RHMI.
value: ''
- name: BACKEND
description: Backend engine to upload the component archive
value: s3
Expand Down

0 comments on commit ef9ca69

Please sign in to comment.