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

add k8s version strategy #1062

Merged
merged 2 commits into from May 11, 2024
Merged

Conversation

rgee0
Copy link
Contributor

@rgee0 rgee0 commented May 10, 2024

Description

Although there is a version strategy for github, whereby the latest version is resolved via the gh release pages something similar did not exist for k8s releases.

https://cdn.dl.k8s.io/release/stable.txt is made available to enable resolution of the latest version.

This change integrates functionality that interrogates this file and uses its contents to assert the version of kubectl to retrieve. This will negate the situation described in #1048 where the version is out of date until the arkade code is updated.

Misc updates to README including the table of tools.

Motivation and Context

How Has This Been Tested?

What does kubectl resolve to? Expecting v1.30.0

➜  arkade git:(k8sVersionStrategy) go build
➜  arkade git:(k8sVersionStrategy) ./arkade get kubectl
Downloading: kubectl
2024/05/10 15:18:09 Looking up version for kubectl
2024/05/10 15:18:09 Found: v1.30.0
Downloading: https://dl.k8s.io/release/v1.30.0/bin/darwin/amd64/kubectl
50.15 MiB / 50.15 MiB [---------------------------------------------------------------------------------------------] 100.00%
/var/folders/3w/tv6429v51kl_61rd1fr25sgm0000gq/T/arkade-2175459231/kubectl written.
2024/05/10 15:18:15 Looking up version for kubectl
2024/05/10 15:18:15 Found: v1.30.0
2024/05/10 15:18:15 Copying /var/folders/3w/tv6429v51kl_61rd1fr25sgm0000gq/T/arkade-2175459231/kubectl to /Users/rgee0/.arkade/bin/kubectl

Wrote: /Users/rgee0/.arkade/bin/kubectl (52.59MB)
...

test-tool for kubectl

➜  arkade git:(k8sVersionStrategy) go build && ./hack/test-tool.sh kubectl
+ ./arkade get kubectl --arch arm64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/kubectl
/Users/rgee0/.arkade/bin/kubectl: Mach-O 64-bit executable arm64
+ rm /Users/rgee0/.arkade/bin/kubectl
+ echo

+ ./arkade get kubectl --arch x86_64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/kubectl
/Users/rgee0/.arkade/bin/kubectl: Mach-O 64-bit executable x86_64
+ rm /Users/rgee0/.arkade/bin/kubectl
+ echo

+ ./arkade get kubectl --arch x86_64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/kubectl
/Users/rgee0/.arkade/bin/kubectl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=Nw07E9mRBf9nBJc5PSDy/6xGMIBOgLhG6lkjc0Xj7/hnMF0PNvcb9-wslPJ5nh/cwX9GQu1ZeSnUp4Y2iB-, stripped
+ rm /Users/rgee0/.arkade/bin/kubectl
+ echo

+ ./arkade get kubectl --arch aarch64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/kubectl
/Users/rgee0/.arkade/bin/kubectl: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=VzRAnGXpLlQctbNaLnKl/oZDpJF6tO440o8MZX2jG/RvCjxRr54MHOuPRJSrwS/dYEmNm_CirHEAgYUSdff, stripped
+ rm /Users/rgee0/.arkade/bin/kubectl
+ echo

+ ./arkade get kubectl --arch x86_64 --os mingw --quiet
+ file /Users/rgee0/.arkade/bin/kubectl.exe
/Users/rgee0/.arkade/bin/kubectl.exe: PE32+ executable (console) x86-64, for MS Windows
+ rm /Users/rgee0/.arkade/bin/kubectl.exe
+ echo

test-tool for helm since the const has been used on tools.go

➜  arkade git:(k8sVersionStrategy) go build && ./hack/test-tool.sh helm   
+ ./arkade get helm --arch arm64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/helm
/Users/rgee0/.arkade/bin/helm: Mach-O 64-bit executable arm64
+ rm /Users/rgee0/.arkade/bin/helm
+ echo

+ ./arkade get helm --arch x86_64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/helm
/Users/rgee0/.arkade/bin/helm: Mach-O 64-bit executable x86_64
+ rm /Users/rgee0/.arkade/bin/helm
+ echo

+ ./arkade get helm --arch x86_64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/helm
/Users/rgee0/.arkade/bin/helm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=PCzOZGnJOztKhLILw2Us/aeyDOEfwbyQa7Q7WnueN/BapdmPxG_MMNvLr4EYZe/wntKr3IhVA_px4Gr699h, stripped
+ rm /Users/rgee0/.arkade/bin/helm
+ echo

+ ./arkade get helm --arch aarch64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/helm
/Users/rgee0/.arkade/bin/helm: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=Pz8WCshnh-30smNSLpDA/tRTJheJ7pA5IjAu6Qdgx/-YulxpFB4droMM4QofnO/DiFmWPiAP15uBOLCq1iP, stripped
+ rm /Users/rgee0/.arkade/bin/helm
+ echo

+ ./arkade get helm --arch x86_64 --os mingw --quiet
+ file /Users/rgee0/.arkade/bin/helm.exe
/Users/rgee0/.arkade/bin/helm.exe: PE32+ executable (console) x86-64, for MS Windows
+ rm /Users/rgee0/.arkade/bin/helm.exe
+ echo➜  arkade git:(k8sVersionStrategy) go build && ./hack/test-tool.sh helm   
+ ./arkade get helm --arch arm64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/helm
/Users/rgee0/.arkade/bin/helm: Mach-O 64-bit executable arm64
+ rm /Users/rgee0/.arkade/bin/helm
+ echo

+ ./arkade get helm --arch x86_64 --os darwin --quiet
+ file /Users/rgee0/.arkade/bin/helm
/Users/rgee0/.arkade/bin/helm: Mach-O 64-bit executable x86_64
+ rm /Users/rgee0/.arkade/bin/helm
+ echo

+ ./arkade get helm --arch x86_64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/helm
/Users/rgee0/.arkade/bin/helm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=PCzOZGnJOztKhLILw2Us/aeyDOEfwbyQa7Q7WnueN/BapdmPxG_MMNvLr4EYZe/wntKr3IhVA_px4Gr699h, stripped
+ rm /Users/rgee0/.arkade/bin/helm
+ echo

+ ./arkade get helm --arch aarch64 --os linux --quiet
+ file /Users/rgee0/.arkade/bin/helm
/Users/rgee0/.arkade/bin/helm: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=Pz8WCshnh-30smNSLpDA/tRTJheJ7pA5IjAu6Qdgx/-YulxpFB4droMM4QofnO/DiFmWPiAP15uBOLCq1iP, stripped
+ rm /Users/rgee0/.arkade/bin/helm
+ echo

+ ./arkade get helm --arch x86_64 --os mingw --quiet
+ file /Users/rgee0/.arkade/bin/helm.exe
/Users/rgee0/.arkade/bin/helm.exe: PE32+ executable (console) x86-64, for MS Windows
+ rm /Users/rgee0/.arkade/bin/helm.exe
+ echo

make e2e

➜  arkade git:(k8sVersionStrategy) make e2e
...
PASS
coverage: 60.8% of statements
ok      github.com/alexellis/arkade/pkg/get     14.943s coverage: 60.8% of statements

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Documentation

  • I have updated the list of tools in README.md if (required) with ./arkade get --format markdown
  • I have updated the list of apps in README.md if (required) with ./arkade install --help

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have tested this on arm, or have added code to prevent deployment

Although there is a version strategy for github, whereby the latest version is resolved via the gh release pages something similar did not exist for k8s releases.

https://cdn.dl.k8s.io/release/stable.txt is made available to enable resolution of the latest version.

This change integrates functionality that interrogates this file and uses its contents to assert the version of `kubectl` to retrieve.  This will negate the situation described in alexellis#1048 where the version is out of date until the `arkade` code is updated.

Signed-off-by: Richard Gee <richard@technologee.co.uk>
@rgee0 rgee0 changed the title add k8s version strategy DRAFT: add k8s version strategy May 10, 2024
@rgee0 rgee0 force-pushed the k8sVersionStrategy branch 2 times, most recently from d7a6d0c to 707849a Compare May 10, 2024 14:57
Signed-off-by: Richard Gee <richard@technologee.co.uk>

f

Signed-off-by: Richard Gee <richard@technologee.co.uk>

f

Signed-off-by: Richard Gee <richard@technologee.co.uk>

f

Signed-off-by: Richard Gee <richard@technologee.co.uk>
@rgee0 rgee0 changed the title DRAFT: add k8s version strategy add k8s version strategy May 10, 2024
Copy link
Owner

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@alexellis alexellis merged commit d3bdc46 into alexellis:master May 11, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants