Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Commit

Permalink
Fixed kubectl install #1
Browse files Browse the repository at this point in the history
  • Loading branch information
nutellinoit committed Jan 10, 2020
1 parent a130d7f commit 17b57f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
17 changes: 2 additions & 15 deletions commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ def download_program(args, program, version):
\nYou can check right available versions by running 'kubenvz kubectl/kustomize list remote'.\
\nFor more informaion, Please refer kubenvz document https://github.com/aaratn/kubenvz#kubenvz-kubectlkustomize-list-remote.\n")
sys.exit(1)

#
if program == "kubectl":
url = "https://github.com/kubernetes/kubectl/releases/download/v" + \
version + "/kustomize_" + operating_sys + "_amd64"
url = "https://storage.googleapis.com/kubernetes-release/release/v"+version+"/bin/"+operating_sys+"/amd64/kubectl"

elif program == "kustomize":
url = "https://github.com/kubernetes-sigs/kustomize/releases/download/v" + \
Expand All @@ -44,18 +43,6 @@ def download_program(args, program, version):

open(dest_path, 'wb').write(binary.content)

if program == "kubectl":

with ZipFile(dest_path, 'r') as zip:
zip.extract('kubectl', path=DOWNLOAD_PATH)

if os.path.exists(DOWNLOAD_PATH + '/' + program) and os.path.exists(dest_path):
os.remove(dest_path)
os.rename(DOWNLOAD_PATH + '/' + program, dest_path)

else:
raise Exception("Issue extracting kubectl !!")

os.chmod(dest_path, 0o755)
else:
print (program, version, "already downloaded")
Expand Down
2 changes: 1 addition & 1 deletion commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def list_remote(args):
available_versions = ['']

for version in parsed_json:
available_versions.append(version['name'].lstrip('v'))
available_versions.append(version['name'].lstrip('v').lstrip('kubernetes-'))
available_versions.remove('')
# available_versions.sort(key=StrictVersion)

Expand Down

0 comments on commit 17b57f1

Please sign in to comment.