ResourceQuotas are kubernetes resources that can be applied from the source cluster to the target cluster. No changes are necessary.
You can use this section if you are handling one resourcequota at a time.
To list ResourceQuotas in a project, run
PROJECT_NAME=<<projectname>>
oc get resourcequota -n $PROJECT_NAME
To get a specific ResourceQuota within an OpenShift project
PROJECT_NAME=<<projectname>>
RQ_NAME=<<resourcequotaname>>
oc get resourcequota $RQ_NAME -n $PROJECT_NAME -o yaml \
| yq e 'del(.metadata.creationTimestamp)' - \
| yq e 'del(.metadata.resourceVersion)' - \
| yq e 'del(.metadata.selfLink)' - \
| yq e 'del(.metadata.uid)' - \
| yq e 'del(.status)' - \
| yq e 'del(.metadata.managedFields)' - \
| yq e 'del(.metadata.annotations)' - \
| yq e 'del(.metadata.manager)' - \
| yq e 'del(.metadata.operation)' - \
| yq e 'del(.metadata.time)' -
To export ResourceQuotas across all the selected set of namespaces in the clusterconfigs/namespaces
folder , run the following script. This will save the ResourceQuotas in clusterconfigs/namespaces/NAMESPACE
folder, each with a unique name.
for ns in $(ls clusterconfigs/namespaces); do
for i in $(oc get resourcequotas -n $ns -o jsonpath='{.items[*].metadata.name}'); do
echo "Exporting resource quotas" $i "for namespace" $ns; \
mkdir -p clusterconfigs/namespaces/$ns
oc get resourcequota $i -n $ns -o yaml \
| yq e 'del(.metadata.creationTimestamp)' - \
| yq e 'del(.metadata.resourceVersion)' - \
| yq e 'del(.metadata.selfLink)' - \
| yq e 'del(.metadata.uid)' - \
| yq e 'del(.status)' - \
| yq e 'del(.metadata.managedFields)' - \
| yq e 'del(.metadata.annotations)' - \
| yq e 'del(.metadata.manager)' - \
| yq e 'del(.metadata.operation)' - \
| yq e 'del(.metadata.time)' - > clusterconfigs/namespaces/$ns/$i-quota.yaml
done;
done