Skip to content
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

k8s_cluster_info.py Add warn for resorce missing kind field #795

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AnthonyWC
Copy link

SUMMARY

Add warn for resorce missing kind field

ISSUE TYPE

Currently k8s_cluster_info.py just assume kind field will always exists; this helps to warn/debug issue when resource is missing kind field

Copy link

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you found a particular case where there's an error? As far as I'm aware this shouldn't be necessary. The check should already be happening in https://github.com/kubernetes-client/python/blob/07fb11f2bc6a6356854e9dabcd7d65a62e849feb/kubernetes/base/dynamic/resource.py#L29

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes; specifically i ran into this while using kiali-operator: https://github.com/kiali/kiali-operator/blob/master/roles/default/kiali-deploy/tasks/main.yml#L23

But i imagine it's generally a good idea to check/warn for exception as it is used in many places. In general, cluster api should almost always have kind field but for whatever reason I have one k8 cluster where it failed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you reproduce the error? I'm not opposed to adding a check if it's necessary, but it doesn't look to me like your change would fix that problem.

Copy link
Author

@AnthonyWC AnthonyWC Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My change isn't meant to fix the error but to warn on which resource caused the error. The fix should be applied on kubernetes api side (on specific resource).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants