add ability to select image
This commit is contained in:
parent
eb90496cbc
commit
5238ef5f6b
1 changed files with 10 additions and 4 deletions
14
krayt.py
14
krayt.py
|
|
@ -307,7 +307,7 @@ EOF"""
|
||||||
|
|
||||||
|
|
||||||
def create_inspector_job(
|
def create_inspector_job(
|
||||||
api, namespace: str, pod_name: str, volume_mounts: list, volumes: list
|
api, namespace: str, pod_name: str, volume_mounts: list, volumes: list, image: str = "alpine:latest"
|
||||||
):
|
):
|
||||||
"""Create a Krayt inspector job with the given mounts"""
|
"""Create a Krayt inspector job with the given mounts"""
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
|
|
@ -447,8 +447,8 @@ def create_inspector_job(
|
||||||
"spec": {
|
"spec": {
|
||||||
"containers": [
|
"containers": [
|
||||||
{
|
{
|
||||||
"name": "krayt",
|
"name": "inspector",
|
||||||
"image": "alpine:latest", # Use Alpine as base for package management
|
"image": image,
|
||||||
"command": [
|
"command": [
|
||||||
"sh",
|
"sh",
|
||||||
"-c",
|
"-c",
|
||||||
|
|
@ -694,6 +694,12 @@ def create(
|
||||||
None,
|
None,
|
||||||
help="Kubernetes namespace. If not specified, will search for pods across all namespaces.",
|
help="Kubernetes namespace. If not specified, will search for pods across all namespaces.",
|
||||||
),
|
),
|
||||||
|
image: str = typer.Option(
|
||||||
|
"alpine:latest",
|
||||||
|
"--image",
|
||||||
|
"-i",
|
||||||
|
help="Container image to use for the inspector pod",
|
||||||
|
),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Krack open a Krayt dragon! Create an inspector pod to explore what's inside your volumes.
|
Krack open a Krayt dragon! Create an inspector pod to explore what's inside your volumes.
|
||||||
|
|
@ -714,7 +720,7 @@ def create(
|
||||||
volume_mounts, volumes = get_pod_volumes_and_mounts(pod_spec)
|
volume_mounts, volumes = get_pod_volumes_and_mounts(pod_spec)
|
||||||
|
|
||||||
inspector_job = create_inspector_job(
|
inspector_job = create_inspector_job(
|
||||||
client.CoreV1Api(), selected_namespace, selected_pod, volume_mounts, volumes
|
client.CoreV1Api(), selected_namespace, selected_pod, volume_mounts, volumes, image=image
|
||||||
)
|
)
|
||||||
|
|
||||||
# Output the job manifest
|
# Output the job manifest
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue