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

Any plans to fix/change the get_kubeconfig call? #264

Open
StanvanHoorn opened this issue Feb 14, 2024 · 1 comment
Open

Any plans to fix/change the get_kubeconfig call? #264

StanvanHoorn opened this issue Feb 14, 2024 · 1 comment

Comments

@StanvanHoorn
Copy link

Hi All,

On Aug 30, 2022 the deserialize error was added to the known issues.

pydo/README.md

Line 216 in db20334

#### `kubernetes.get_kubeconfig` Does not serialize response content

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?

@reinvantveer
Copy link

reinvantveer commented Apr 23, 2024

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

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

No branches or pull requests

2 participants