Skip to content

Commit

Permalink
fix(resources): handle deployments without envFrom
Browse files Browse the repository at this point in the history
Simpler deployments that don't use envFrom (or just set env directly) will cause
a `KeyError` exception otherwise.
  • Loading branch information
zakame committed Aug 6, 2024
1 parent eaedece commit 58c8c1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/kubectl-application-shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def main(namespace: str, deployment: str, size: Optional[str] = typer.Argument(N
deployment_info = subprocess.run(['kubectl', 'get', 'deployment', f"--namespace={namespace}", f"{deployment}", "-o", 'json'], capture_output=True, text=True).stdout
container_name = json.loads(deployment_info)['spec']['template']['spec']['containers'][0]['name']
image = image or json.loads(deployment_info)['spec']['template']['spec']['containers'][0]['image']
env_from = json.loads(deployment_info)['spec']['template']['spec']['containers'][0]['envFrom']
env_from = json.loads(deployment_info)['spec']['template']['spec']['containers'][0].get('envFrom', None)
annotations = json.loads(deployment_info)['metadata']['annotations']
kubectl_overrides = json.dumps({
"metadata": {
Expand Down

0 comments on commit 58c8c1b

Please sign in to comment.