pydo icon indicating copy to clipboard operation
pydo copied to clipboard

Any plans to fix/change the get_kubeconfig call?

Open StanvanHoorn opened this issue 1 year ago • 1 comments

Hi All,

On Aug 30, 2022 the deserialize error was added to the known issues. https://github.com/digitalocean/pydo/blob/db20334589399d8d01bd34c52f9df358ef906fa7/README.md?plain=1#L216

I cannot seem to find any efforts to fix this issue here, or with the upstream package.

Do you have any plans to fix this issue somewhere in the future?

StanvanHoorn avatar Feb 14 '24 13:02 StanvanHoorn

This issue has been open for about 2 years, which is a pity. Workaround (with std lib httplib):

from http.client import HTTPSConnection

conn = HTTPSConnection('api.digitalocean.com')
conn.request(
    'GET',
    f'/v2/kubernetes/clusters/{cluster_id}/kubeconfig',
    headers={'Authorization': f'Bearer {os.environ["DIGITALOCEAN_TOKEN"]}'}
)
response = conn.getresponse()

if response.getcode() > 400:
    msg = 'Unable to get kubeconfig'
    raise RuntimeError(msg)

kube_config =  response.read().decode('utf-8')
conn.close()

This will return the kubeconfig in yaml format

reinvantveer avatar Apr 23 '24 13:04 reinvantveer