mnubo / kubernetes-py

A python module for Kubernetes.
Apache License 2.0
123 stars 46 forks source link

Filter labels without name #105

Closed lphuberdeau closed 6 years ago

lphuberdeau commented 7 years ago

I've come across an issue trying to get a list of pods by label other than name. The query building logic expected the name to be present.

The primary change is essentially to replace labels["name"] for "", which works just fine on minikube as well as our own kubernetes cluster. Having to set the name argument even when it is not required is a general annoyance in the API.

I've also reduced the get_by_name implementation to call get_by_labels instead, as the implementation is more general. Validation portion is left as-is.

As a general note, I have found running the unit tests harder than it would seem necessary. All tests pass if k8s is not running at all, random failures occur when running with minikube. Seems like tests that need connectivity should skip if k8s is unavailable, same for those that require specific features.

sebastienc commented 7 years ago

Thanks for the feedback. I'll have a closer look at this merge request in the next few days. Sorry for the delay. I need to make sure I don't break anything in our own production environment before accepting it. I might have to tweak a few things.

lphuberdeau commented 6 years ago

Merci.

sebastienc commented 6 years ago

Pour info, c'est disponible dans la version 1.5.6.29

On Mon, Dec 18, 2017 at 4:21 PM Louis-Philippe Huberdeau < notifications@github.com> wrote:

Merci.

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/mnubo/kubernetes-py/pull/105#issuecomment-352561067, or mute the thread https://github.com/notifications/unsubscribe-auth/ABe086Yc2c4bICps_qNKFEASRi2caTltks5tBtdVgaJpZM4O2y0S .

--

CONFIDENTIALITY: This e-mail message (including attachments, if any) is confidential and is intended only for the addressee. Any unauthorized use or disclosure is strictly prohibited. Disclosure of this e-mail to anyone other than the intended addressee does not constitute waiver of privilege. If you have received this communication in error, please notify us immediately and delete this. Thank you for your cooperation. This message has not been encrypted. Special arrangements can be made for encryption upon request.

CONFIDENTIALITÉ: Ce message courriel (y compris les pièces jointes, le cas échéant) est confidentiel et destiné uniquement à la personne ou à l'entité à qui il est adressé. Toute utilisation ou divulgation non permise est strictement interdite. L'obligation de confidentialité et de secret professionnel demeure malgré toute divulgation. Si vous avez reçu le présent courriel et ses annexes par erreur, veuillez nous en informer immédiatement et le détruire. Nous vous remercions de votre collaboration. Le présent message n'a pas été crypté. Le cryptage est possible sur demande spéciale.