Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
fix k8s config user both 'token' and 'client-certificate' (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
wph95 authored and hjacobs committed Oct 2, 2019
1 parent 40b1eb4 commit a569478
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pykube/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ def send(self, request, **kwargs):
# @@@ support token refresh
if "id-token" in auth_config:
request.headers["Authorization"] = "Bearer {}".format(auth_config["id-token"])
elif "client-certificate" in config.user:
elif config.user.get("username") and config.user.get("password"):
request.prepare_auth((config.user["username"], config.user["password"]))

if "client-certificate" in config.user:
kwargs["cert"] = (
config.user["client-certificate"].filename(),
config.user["client-key"].filename(),
)
elif config.user.get("username") and config.user.get("password"):
request.prepare_auth((config.user["username"], config.user["password"]))

# setup certificate verification

Expand Down

0 comments on commit a569478

Please sign in to comment.