Skip to content

Commit

Permalink
resources loop
Browse files Browse the repository at this point in the history
  • Loading branch information
odra committed May 21, 2019
1 parent 0bf25b9 commit 4dee173
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions image/tools/lib/component/resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ function backup_resource {
echo '---' > /tmp/${type}.yaml
for obj in $(oc get ${type} -n ${ns} | tr -s ' ' | cut -d ' ' -f 1 | tail -n +2); do
echo '-' >> /tmp/${type}.yaml
echo "$(oc get ${type}/${obj} -n ${ns} -o yaml --export | sed 's/^/ /')" >> /tmp/${type}.yaml
cat /tmp/${type}.yaml | gzip > ${dest}/archives/${ns}-${type}.yaml.gz
rm -f /tmp/${type}.yaml
echo "$(oc get ${type}/${obj} -n ${ns} -o yaml --export)" > /tmp/${type}.${obj}.yaml
done
find /tmp -name "*.yaml" | tar -cvzf "${dest}/archives/${ns}-${type}.yaml.gz" -T -
rm -rf /tmp/*.yaml

else
oc get ${type} -n ${ns} -o yaml --export | gzip > ${dest}/archives/${ns}-${type}.yaml.gz
fi
Expand Down

0 comments on commit 4dee173

Please sign in to comment.