Skip to content

Commit bf6d388

Browse files
authored
Add rollout namespaces (#18)
Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
1 parent 0aa9570 commit bf6d388

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

gather_gitops.sh

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -379,31 +379,6 @@ function main() {
379379
create_directory "${APPLICATION_DIR}"
380380
get_applications "${namespace}" "${APPLICATION_DIR}"
381381

382-
# rollouts
383-
echo "Creating directory for rollouts"
384-
ROLLOUTS_DIR="${RESOURCES_DIR}/rollouts"
385-
create_directory "${ROLLOUTS_DIR}"
386-
387-
ROLLOUTS_MANAGER_CR_DIR="${ROLLOUTS_DIR}/manager_cr"
388-
create_directory "${ROLLOUTS_MANAGER_CR_DIR}"
389-
get_rollouts_manager_cr "${namespace}" "${ROLLOUTS_MANAGER_CR_DIR}"
390-
391-
ROLLOUTS_CR_DIR="${ROLLOUTS_DIR}/cr"
392-
create_directory "${ROLLOUTS_CR_DIR}"
393-
get_rollouts_cr "${namespace}" "${ROLLOUTS_CR_DIR}"
394-
395-
ROLLOUTS_DEPLOYMENT_DIR="${ROLLOUTS_DIR}/rollout_deployment"
396-
create_directory "${ROLLOUTS_DEPLOYMENT_DIR}"
397-
get_rollout_deployments "${namespace}" "${ROLLOUTS_DEPLOYMENT_DIR}"
398-
399-
ROLLOUTS_REPLICASET_DIR="${ROLLOUTS_DIR}/rollout_replicaSet"
400-
create_directory "${ROLLOUTS_REPLICASET_DIR}"
401-
get_rollout_replicaSet "${namespace}" "${ROLLOUTS_REPLICASET_DIR}"
402-
403-
ROLLOUTS_SERVICES_DIR="${ROLLOUTS_DIR}/rollout_services"
404-
create_directory "${ROLLOUTS_SERVICES_DIR}"
405-
get_rollout_services "${namespace}" "${ROLLOUTS_SERVICES_DIR}"
406-
407382
echo " * Getting ArgoCD Source Namespaces in ${namespace}..."
408383
local sourceNamespaces
409384
run_and_log "oc get argocd -n ${namespace} -o jsonpath='{.items[*].spec.sourceNamespaces[*]}'" "${ARGOCD_DIR}/sourceNamespaces.txt"
@@ -433,11 +408,6 @@ function main() {
433408
run_and_log "oc logs deployment/${argoCDName}-repo-server -n ${namespace}" "${ARGOCD_LOG_DIR}/repo-server-logs.txt"
434409
run_and_log "oc logs deployment/${argoCDName}-redis -n ${namespace}" "${ARGOCD_LOG_DIR}/redis-logs.txt"
435410
run_and_log "oc logs deployment/${argoCDName}-dex-server -n ${namespace}" "${ARGOCD_LOG_DIR}/dex-server-logs.txt"
436-
437-
echo " * Getting Rollout logs in ${namespace}..."
438-
ROLLOUTS_LOG_DIR="${ROLLOUTS_DIR}/logs"
439-
create_directory "${ROLLOUTS_LOG_DIR}"
440-
run_and_log "oc logs deployment/argo-rollouts -n ${namespace}" "${ROLLOUTS_LOG_DIR}/rollout-logs.txt"
441411

442412
echo " * Getting ArgoCD Managed namespaces in ${namespace}..."
443413
run_and_log "oc get namespaces --selector=argocd.argoproj.io/managed-by=${namespace}" "${ARGOCD_DIR}/managed-namespaces.txt"
@@ -474,6 +444,40 @@ function main() {
474444
done
475445
done
476446

447+
local rolloutNamespaces
448+
rolloutNamespaces=$(oc get RolloutManager --all-namespaces -o jsonpath='{.items[*].metadata.namespace}')
449+
450+
for rolloutNamespace in ${rolloutNamespaces}; do
451+
echo "Creating directory for rollouts"
452+
ROLLOUTS_RESOURCES_DIR="${GITOPS_DIR}/rolloutsNamespace_${rolloutNamespace}_resources"
453+
create_directory "${ROLLOUTS_RESOURCES_DIR}"
454+
455+
ROLLOUTS_MANAGER_CR_DIR="${ROLLOUTS_RESOURCES_DIR}/manager_cr"
456+
create_directory "${ROLLOUTS_MANAGER_CR_DIR}"
457+
get_rollouts_manager_cr "${rolloutNamespace}" "${ROLLOUTS_MANAGER_CR_DIR}"
458+
459+
ROLLOUTS_CR_DIR="${ROLLOUTS_RESOURCES_DIR}/cr"
460+
create_directory "${ROLLOUTS_CR_DIR}"
461+
get_rollouts_cr "${rolloutNamespace}" "${ROLLOUTS_CR_DIR}"
462+
463+
ROLLOUTS_DEPLOYMENT_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_deployment"
464+
create_directory "${ROLLOUTS_DEPLOYMENT_DIR}"
465+
get_rollout_deployments "${rolloutNamespace}" "${ROLLOUTS_DEPLOYMENT_DIR}"
466+
467+
ROLLOUTS_REPLICASET_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_replicaSet"
468+
create_directory "${ROLLOUTS_REPLICASET_DIR}"
469+
get_rollout_replicaSet "${rolloutNamespace}" "${ROLLOUTS_REPLICASET_DIR}"
470+
471+
ROLLOUTS_SERVICES_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_services"
472+
create_directory "${ROLLOUTS_SERVICES_DIR}"
473+
get_rollout_services "${rolloutNamespace}" "${ROLLOUTS_SERVICES_DIR}"
474+
475+
echo " * Getting Rollout logs in ${rolloutNamespace}..."
476+
ROLLOUTS_LOG_DIR="${ROLLOUTS_RESOURCES_DIR}/logs"
477+
create_directory "${ROLLOUTS_LOG_DIR}"
478+
run_and_log "oc logs deployment/argo-rollouts -n ${rolloutNamespace}" "${ROLLOUTS_LOG_DIR}/rollout-logs.txt"
479+
done
480+
477481
echo " * Getting ArgoCD AppProjects from all Namespaces..."
478482
APPPROJECT_DIR="${ARGOCD_DIR}/appprojects"
479483
create_directory "${APPPROJECT_DIR}"

0 commit comments

Comments
 (0)