-
Notifications
You must be signed in to change notification settings - Fork 28
Debugging tools #125
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
Merged
Merged
Debugging tools #125
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
68d3a3e
Debugging scripts
961cce2
Hack so can do 'j' commands against cicd repo.
eb690d4
Update joshua_remote_cli.sh
saintstack 9776ecc
Update joshua_remote_cli.sh
saintstack 356c767
Better pod selection and improve documentation
0611b8d
Remove overcommit
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #!/bin/bash | ||
| # joshua_in_scaler.sh - Run joshua commands against EKS cluster | ||
| # | ||
| # This script enables Joshua CLI access when Joshua is not installed locally on remote pod. | ||
| # It uses the agent-scaler pod as a proxy: copies your local joshua.py source | ||
| # to the pod (which has database access) and executes commands there, remotely. | ||
| # | ||
| # Usage: joshua_remote_cli.sh --context <context> [--joshua-dir <dir>] [--rhel9] <command> [args...] | ||
|
|
||
| # Environment variables with expected values: | ||
| # JOSHUA_CONTEXT: kubectl context name or EKS ARN (e.g., "arn:aws:eks:us-west-2:123456789:cluster/my-cluster") | ||
| # JOSHUA_SCALER: scaler type - "regular" (default) or "rhel9" | ||
| CONTEXT="${JOSHUA_CONTEXT:-}" | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| JOSHUA_CHECKOUT="${JOSHUA_DIR:-$SCRIPT_DIR}" | ||
| SCALER_TYPE="${JOSHUA_SCALER:-regular}" | ||
|
|
||
| # Parse named arguments | ||
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --context|-c) | ||
| CONTEXT="$2" | ||
| shift 2 | ||
| ;; | ||
| --rhel9) | ||
| SCALER_TYPE="rhel9" | ||
| shift | ||
| ;; | ||
| *) | ||
| break | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if [ -z "$CONTEXT" ]; then | ||
| echo "Error: --context is required (or set JOSHUA_CONTEXT env var)" | ||
| echo "Usage: $0 --context <k8s-context> [--rhel9] <command> [args...]" | ||
| exit 1 | ||
| fi | ||
|
|
||
| JOSHUA_PY=$(find ${JOSHUA_CHECKOUT} -name "joshua.py" -print) | ||
| if [ -z "$JOSHUA_PY" ]; then | ||
| echo "Error: Could not find joshua.py in ${JOSHUA_CHECKOUT}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$SCALER_TYPE" = "rhel9" ]; then | ||
| SCALER_POD=$(kubectl --context "${CONTEXT}" get pods -l app=agent-scaler-rhel9 -o jsonpath='{.items[0].metadata.name}') | ||
| else | ||
| SCALER_POD=$(kubectl --context "${CONTEXT}" get pods -l app=agent-scaler -o jsonpath='{.items[0].metadata.name}') | ||
| fi | ||
|
|
||
| if [ -z "$SCALER_POD" ]; then | ||
| echo "Error: Could not find agent-scaler pod (type: $SCALER_TYPE)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Copy joshua.py with patched imports (remove lxml dependency, fix relative imports for pod environment) | ||
| sed -e 's/import lxml.etree as le/le = None/' \ | ||
| -e 's/from \. import joshua_model/import joshua_model/' \ | ||
| "$JOSHUA_PY" | \ | ||
| kubectl --context "$CONTEXT" exec -i "$SCALER_POD" -- tee /tmp/joshua.py > /dev/null | ||
|
|
||
| kubectl --context "$CONTEXT" exec -it "$SCALER_POD" -- env PYTHONPATH=/tools python3 /tmp/joshua.py -C /etc/foundationdb/fdb.cluster "$@" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.