haxsaw/hikaru

PodStatus's podIP and hostIP attributes are not set on readNamespacedPod(...)

anthonyyangdev opened this issue · 3 comments

I am using hikaru.model.rel_1_26.v1

The values pod.status.podIP and pod.status.hostIP returned by pod = Pod.readNamespacedPod() or pod.read() are always None when the pod is actively running in a cluster.

I believe the issue occurs here:

hikaru/hikaru/meta.py

Lines 988 to 992 in d1a00be

for f in fields(self.__class__):
k8s_name = f.name.strip("_")
k8s_name = (h2kc_translate(self.__class__, k8s_name)
if translate
else k8s_name)

The pod status JSON from underlying Kubernetes call has the keys pod_ip and host_ip, while the field names in PodStatus are podIP and hostIP. It looks like the code in the link tries to find the key camel_to_pep8(class_field_name) in the JSON response, but camel_to_pep8(podIP) and camel_to_pep8(hostIP) return pod_i_p and host_i_p

haxsaw commented

Arg; I'm pretty sure I know where this is happening; I'll have a look. Thanks so much for the detailed ticket.

haxsaw commented

Yeah, the issue is where I thought & you tracked down; thanks again for that. Putting together fixes and new tests for this case, then I'll be starting the full set of tests across all versions of K8s/Python prior to releaes.

haxsaw commented

OK, v1.0.1 just went out on all the channels. Tests added to ensure we don't regress. Closing this one out.