Skip to content

Commit 08a54c1

Browse files
authored
Add gitops-must-gather for rollout events and crs (#22)
* Fix merge conflicts Signed-off-by: Rizwana777 <[email protected]> * Fix merge conflicts Signed-off-by: Rizwana777 <[email protected]> * Add gitops-must-gather for rollout events and crs Signed-off-by: Rizwana777 <[email protected]> --------- Signed-off-by: Rizwana777 <[email protected]>
1 parent 6e32b82 commit 08a54c1

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

gather_gitops.sh

+62
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,48 @@ get_rollout_configMap(){
319319
run_and_log "oc -n $1 get configmap/${rolloutConfigMap} -o json" "$2/rollout-configMap.json"
320320
}
321321

322+
# get_rollout_events; takes namespace and directory as parameter
323+
get_rollout_events(){
324+
echo " * Getting warning events in $1..."
325+
run_and_log "oc get events -n $1 --field-selector type=Warning" "$2/warning-events.txt"
326+
echo " * Getting error events in $1..."
327+
run_and_log "oc get events -n $1 --field-selector type=Error" "$2/error-events.txt"
328+
echo " * Getting all events in $1..."
329+
run_and_log "oc get events -n $1" "$2/all-events.txt"
330+
}
331+
332+
# get_rollout_analysisruns; takes namespace and directory as argument
333+
get_rollout_analysisruns(){
334+
echo " * Getting rollout analysisrun in $1..."
335+
run_and_log "oc -n $1 get analysisruns" "$2/rollout-analysisrun.txt"
336+
run_and_log "oc -n $1 get analysisruns -o yaml" "$2/rollout-analysisrun.yaml"
337+
run_and_log "oc -n $1 get analysisruns -o json" "$2/rollout-analysisrun.json"
338+
}
339+
340+
# get_rollout_analysistemplates; takes namespace and directory as argument
341+
get_rollout_analysistemplates(){
342+
echo " * Getting rollout analysisrun in $1..."
343+
run_and_log "oc -n $1 get analysistemplates" "$2/rollout-analysistemplate.txt"
344+
run_and_log "oc -n $1 get analysistemplates -o yaml" "$2/rollout-analysistemplate.yaml"
345+
run_and_log "oc -n $1 get analysistemplates -o json" "$2/rollout-analysistemplate.json"
346+
}
347+
348+
# get_rollout_clusteranalysistemplates; takes namespace and directory as argument
349+
get_rollout_clusteranalysistemplates(){
350+
echo " * Getting rollout analysisrun in $1..."
351+
run_and_log "oc -n $1 get clusteranalysistemplates" "$2/rollout-clusteranalysistemplate.txt"
352+
run_and_log "oc -n $1 get clusteranalysistemplates -o yaml" "$2/rollout-clusteranalysistemplate.yaml"
353+
run_and_log "oc -n $1 get clusteranalysistemplates -o json" "$2/rollout-clusteranalysistemplate.json"
354+
}
355+
356+
# get_rollout_experiments; takes namespace and directory as argument
357+
get_rollout_experiments(){
358+
echo " * Getting rollout analysisrun in $1..."
359+
run_and_log "oc -n $1 get experiments" "$2/rollout-experiment.txt"
360+
run_and_log "oc -n $1 get experiments -o yaml" "$2/rollout-experiment.yaml"
361+
run_and_log "oc -n $1 get experiments -o json" "$2/rollout-experiment.json"
362+
}
363+
322364
function main() {
323365

324366
# Initialize the directory where the must-gather data will be stored and the error log file
@@ -486,6 +528,26 @@ function main() {
486528
create_directory "${ROLLOUTS_CONFIGMAP_DIR}"
487529
get_rollout_configMap "${rolloutNamespace}" "${ROLLOUTS_CONFIGMAP_DIR}"
488530

531+
ROLLOUTS_EVENTS_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_events"
532+
create_directory "${ROLLOUTS_EVENTS_DIR}"
533+
get_rollout_events "${rolloutNamespace}" "${ROLLOUTS_EVENTS_DIR}"
534+
535+
ROLLOUTS_ANALYSISRUN_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_analysisruns"
536+
create_directory "${ROLLOUTS_ANALYSISRUN_DIR}"
537+
get_rollout_analysisruns "${rolloutNamespace}" "${ROLLOUTS_ANALYSISRUN_DIR}"
538+
539+
ROLLOUTS_ANALYSISTEMPLATES_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_analysistemplates"
540+
create_directory "${ROLLOUTS_ANALYSISTEMPLATES_DIR}"
541+
get_rollout_analysistemplates "${rolloutNamespace}" "${ROLLOUTS_ANALYSISTEMPLATES_DIR}"
542+
543+
ROLLOUTS_CLUSTERANALYSISTEMPLATES_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_clusteranalysistemplates"
544+
create_directory "${ROLLOUTS_CLUSTERANALYSISTEMPLATES_DIR}"
545+
get_rollout_analysistemplates "${rolloutNamespace}" "${ROLLOUTS_CLUSTERANALYSISTEMPLATES_DIR}"
546+
547+
ROLLOUTS_EXPERIMENTS_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_experiments"
548+
create_directory "${ROLLOUTS_EXPERIMENTS_DIR}"
549+
get_rollout_experiments "${rolloutNamespace}" "${ROLLOUTS_EXPERIMENTS_DIR}"
550+
489551
echo " * Getting Rollout logs in ${rolloutNamespace}..."
490552
ROLLOUTS_LOG_DIR="${ROLLOUTS_RESOURCES_DIR}/logs"
491553
create_directory "${ROLLOUTS_LOG_DIR}"

0 commit comments

Comments
 (0)