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

feat: enable must-gather for uwm #305

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

vprashar2929
Copy link
Collaborator

This PR adds support for capturing User-Workload-Monitoring related info in must-gather


get_rules() {
log "getting prometheus rules"
THANOS_RULER_ROUTE="$(oc get routes -n $UWM_NS thanos-ruler -o jsonpath='{.status.ingress[0].host}')"
Copy link
Collaborator

@sthaha sthaha Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general rule of thumb, all initialisations that is more complex than an variable assignment, is better placed in to an init function. Use UPPER_CASE for globals and snake_case for local (use local).

@vprashar2929 vprashar2929 force-pushed the mon-gather branch 2 times, most recently from af36248 to f6267ba Compare November 8, 2023 12:09

THANOS_RULER_ROUTE="$(oc get routes -n $UWM_NS thanos-ruler -o jsonpath='{.status.ingress[0].host}')"
SA_TOKEN="$(oc create token default)"
PROM_PODS="$(oc -n $UWM_NS get pods -l app.kubernetes.io/component=prometheus -oname 2>/dev/null || echo "")"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PROM_PODS="$(oc -n $UWM_NS get pods -l app.kubernetes.io/component=prometheus -oname 2>/dev/null || echo "")"
PROM_PODS="$(oc -n $UWM_NS get pods -l app.kubernetes.io/component=prometheus -oname)" || true
declare -r PROM_PODS THANOS_RULER_ROUTE SA_TOKEN

PROM_PODS="$(oc -n $UWM_NS get pods -l app.kubernetes.io/component=prometheus -oname 2>/dev/null || echo "")"
}

cleanup() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about trap cleanup EXIT ?


main() {
init

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should return 0 if PROM_PODS is empty
how about init || { warn "cannot gather UWM details"; return 0; }
init can return 0 or 1 depending on the vars could be initialised or not - right?

sthaha
sthaha previously approved these changes Nov 9, 2023
Copy link
Collaborator

@sthaha sthaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but do consider addressing the comments in this PR or as a follow up.

@sthaha sthaha merged commit d6abc5e into sustainable-computing-io:v1alpha1 Nov 10, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants