mirror of
https://github.com/krkn-chaos/krkn.git
synced 2026-04-15 06:57:28 +00:00
Use jsonpath to retrieve pod nodename (#129)
This commit is contained in:
@@ -3,7 +3,6 @@ from kubernetes.stream import stream
|
||||
from kubernetes.client.rest import ApiException
|
||||
import logging
|
||||
import kraken.invoke.command as runcommand
|
||||
import json
|
||||
import sys
|
||||
import re
|
||||
|
||||
@@ -247,9 +246,9 @@ def find_kraken_node():
|
||||
# get kraken-deployment pod, find node name
|
||||
try:
|
||||
runcommand.invoke("kubectl config set-context --current --namespace=" + str(kraken_project))
|
||||
pod_json_str = runcommand.invoke("kubectl get pods/" + str(kraken_pod_name) + " -o json")
|
||||
pod_json = json.loads(pod_json_str)
|
||||
node_name = pod_json["spec"]["nodeName"]
|
||||
node_name = runcommand.invoke(
|
||||
"kubectl get pods/" + str(kraken_pod_name) + ' -o jsonpath="{.spec.nodeName}"'
|
||||
)
|
||||
|
||||
# Reset to the default project
|
||||
runcommand.invoke("kubectl config set-context --current --namespace=default")
|
||||
|
||||
Reference in New Issue
Block a user