Skip to content

Commit

Permalink
Merge pull request #17 from keefien/kgeipel.issue#15&#16
Browse files Browse the repository at this point in the history
fixed tls verify parameter and kube api authorization
  • Loading branch information
WoozyMasta authored Apr 6, 2021
2 parents ed478e7 + 91fa2d2 commit 98dc6a2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kube-dump
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ require tar bzip2
[ -n "$kube_context" ] && k_args+=("--context=$kube_context")
[ -n "$kube_cluster" ] && k_args+=("--cluster=$kube_cluster")
[ "$kube_insecure_tls" == 'true' ] && \
k_args+=("--insecure-skip-tls-verify=false")
k_args+=("--insecure-skip-tls-verify=true")

# Use serviceaccount
if [ -n "$KUBERNETES_SERVICE_HOST" ] && \
Expand All @@ -239,10 +239,11 @@ then
kube_api_token=$(</var/run/secrets/kubernetes.io/serviceaccount/token)
kube_api_ca=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt

if _api_code=$(
curl --fail --location --output /dev/null --write-out '%{http_code}\n' \
--cacert $kube_api_ca --silent "https://$kube_api/livez"
)
_api_code=$(
curl --fail --location --output /dev/null --write-out '%{http_code}\n' --cacert $kube_api_ca \
-H "Authorization: Bearer $kube_api_token" --silent "https://$kube_api/livez"
)
if [ "$_api_code" == "200" ]
then
kubectl config set-cluster "${kube_context:-k8s}" \
--server="https://$kube_api" \
Expand Down

0 comments on commit 98dc6a2

Please sign in to comment.