mnubo / kubernetes-py

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

Crash when trying to get deployment #154

Open danielzre opened 4 years ago

danielzre commented 4 years ago

Hi, I'm facing a crash when trying to get a deployment, have a more detailed info about the problem:

If your ~/.kube/config file does not have the fields client-certificate-data and client-key-data under user, the program crash everytime we try to call the method request in K8sObject.py since our config will not have cert_data field.

Steps to reproduce: cfg_default = kubernetes_py.K8sConfig() deployment = kubernetes_py.K8sDeployment(config=cfg_default, name='test') deployment.get()

Proposed fix: In K8sConfig.py add the following line in K8sConfig class constructor:

         self.namespace = None
         self.token = None
         self.version = None
+        self.cert_data = None
+        self.client_key_data = None
+        self.client_certificate_data = None

Thanks.

sebastienc commented 4 years ago

Thanks for reporting this, I'll review and make some changes soon on this topic.

hariclx commented 4 years ago

@sebastienc Any update on this?