Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gitops-must-gather for rollout events and crs #22

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions gather_gitops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,48 @@ get_rollout_configMap(){
run_and_log "oc -n $1 get configmap/${rolloutConfigMap} -o json" "$2/rollout-configMap.json"
}

# get_rollout_events; takes namespace and directory as parameter
get_rollout_events(){
echo " * Getting warning events in $1..."
run_and_log "oc get events -n $1 --field-selector type=Warning" "$2/warning-events.txt"
echo " * Getting error events in $1..."
run_and_log "oc get events -n $1 --field-selector type=Error" "$2/error-events.txt"
echo " * Getting all events in $1..."
run_and_log "oc get events -n $1" "$2/all-events.txt"
}

# get_rollout_analysisruns; takes namespace and directory as argument
get_rollout_analysisruns(){
echo " * Getting rollout analysisrun in $1..."
run_and_log "oc -n $1 get analysisruns" "$2/rollout-analysisrun.txt"
run_and_log "oc -n $1 get analysisruns -o yaml" "$2/rollout-analysisrun.yaml"
run_and_log "oc -n $1 get analysisruns -o json" "$2/rollout-analysisrun.json"
}

# get_rollout_analysistemplates; takes namespace and directory as argument
get_rollout_analysistemplates(){
echo " * Getting rollout analysisrun in $1..."
run_and_log "oc -n $1 get analysistemplates" "$2/rollout-analysistemplate.txt"
run_and_log "oc -n $1 get analysistemplates -o yaml" "$2/rollout-analysistemplate.yaml"
run_and_log "oc -n $1 get analysistemplates -o json" "$2/rollout-analysistemplate.json"
}

# get_rollout_clusteranalysistemplates; takes namespace and directory as argument
get_rollout_clusteranalysistemplates(){
echo " * Getting rollout analysisrun in $1..."
run_and_log "oc -n $1 get clusteranalysistemplates" "$2/rollout-clusteranalysistemplate.txt"
run_and_log "oc -n $1 get clusteranalysistemplates -o yaml" "$2/rollout-clusteranalysistemplate.yaml"
run_and_log "oc -n $1 get clusteranalysistemplates -o json" "$2/rollout-clusteranalysistemplate.json"
}

# get_rollout_experiments; takes namespace and directory as argument
get_rollout_experiments(){
echo " * Getting rollout analysisrun in $1..."
run_and_log "oc -n $1 get experiments" "$2/rollout-experiment.txt"
run_and_log "oc -n $1 get experiments -o yaml" "$2/rollout-experiment.yaml"
run_and_log "oc -n $1 get experiments -o json" "$2/rollout-experiment.json"
}

function main() {

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

ROLLOUTS_EVENTS_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_events"
create_directory "${ROLLOUTS_EVENTS_DIR}"
get_rollout_events "${rolloutNamespace}" "${ROLLOUTS_EVENTS_DIR}"

ROLLOUTS_ANALYSISRUN_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_analysisruns"
create_directory "${ROLLOUTS_ANALYSISRUN_DIR}"
get_rollout_analysisruns "${rolloutNamespace}" "${ROLLOUTS_ANALYSISRUN_DIR}"

ROLLOUTS_ANALYSISTEMPLATES_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_analysistemplates"
create_directory "${ROLLOUTS_ANALYSISTEMPLATES_DIR}"
get_rollout_analysistemplates "${rolloutNamespace}" "${ROLLOUTS_ANALYSISTEMPLATES_DIR}"

ROLLOUTS_CLUSTERANALYSISTEMPLATES_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_clusteranalysistemplates"
create_directory "${ROLLOUTS_CLUSTERANALYSISTEMPLATES_DIR}"
get_rollout_analysistemplates "${rolloutNamespace}" "${ROLLOUTS_CLUSTERANALYSISTEMPLATES_DIR}"

ROLLOUTS_EXPERIMENTS_DIR="${ROLLOUTS_RESOURCES_DIR}/rollout_experiments"
create_directory "${ROLLOUTS_EXPERIMENTS_DIR}"
get_rollout_experiments "${rolloutNamespace}" "${ROLLOUTS_EXPERIMENTS_DIR}"

echo " * Getting Rollout logs in ${rolloutNamespace}..."
ROLLOUTS_LOG_DIR="${ROLLOUTS_RESOURCES_DIR}/logs"
create_directory "${ROLLOUTS_LOG_DIR}"
Expand Down