-
Notifications
You must be signed in to change notification settings - Fork 2
feat: enhance debug session management with resource and network policy options #24
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
base: master
Are you sure you want to change the base?
Conversation
…cy options Added support for specifying CPU and memory requests/limits, custom environment variables, and network policies when creating debug pods. Introduced commands for listing, resuming, and terminating debug sessions, improving overall session management capabilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, we even got a session manager going! 👍
ruff check
/ruff format --check
picked up a few nits - we can probably add that in as a GHA workflow too.
"""kubectl-application-shell package""" | ||
|
||
import sys | ||
from typing import List |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unused
get_deployment_info, get_kubectl, get_kube_version, create_network_policy, | ||
delete_network_policy, get_user_identifier, list_debug_sessions, | ||
get_debug_session, terminate_debug_session, resume_debug_session | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the *_debug_session
functions seems unused here (they're all supposed to be in .cli
anyway)
console.print(f":memo: Logging session to {session_log}") | ||
|
||
try: | ||
exit_code = os.system(cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused exit_code
|
||
cmd = "".join( | ||
[ | ||
f"{kubectl} run -it --rm --restart=Never --namespace={namespace} ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we restore auto-pruning the debug session when done as an --rm
flag?
|
||
# Add NetworkPolicy targeting label if needed | ||
if network_policy: | ||
labels["debug-pod"] = pod_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this pod_name
is used ahead of being defined below in https://github.com/tablecheck/kubectl-application-shell/pull/24/files#diff-065b3beb658a1a078c181cd4cabdfc8218ff1a3426c15d736f4121e449c706d6R270
Added support for specifying CPU and memory requests/limits, custom environment variables, and network policies when creating debug pods. Introduced commands for listing, resuming, and terminating debug sessions, improving overall session management capabilities.