alexellis / arkade

Open Source Marketplace For Developer Tools

Home Page:https://blog.alexellis.io/kubernetes-marketplace-two-year-update/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong architecture installed for helm on Apple M2

alextercete opened this issue · comments

Expected Behaviour

When installing helm on Apple silicon, the arm64 architecture should be used.

Current Behaviour

The amd64 architecture is used instead, which results in a "bad CPU type in executable" error when arkade tries to call helm.

Possible Solution

I suspect this test case is incorrect. If that's the case, this logic would need to change.

This seems to have been reported before in #409 and fixed in #412. The test case in question was introduced later in this commit, and from the commit message it seems as though x86 was a deliberate choice. I checked and there's currently an arm64 version of helm available for download (maybe there wasn't one at the time?).

Steps to Reproduce

On an Apple M2:

$ arch
arm64

$ arkade get helm
Downloading: helm
2023/06/17 17:22:02 Looking up version for helm
2023/06/17 17:22:02 Found: v3.12.1
Downloading: https://get.helm.sh/helm-v3.12.1-darwin-amd64.tar.gz
16.05 MiB / 16.05 MiB [--------------------------------------------] 100.00%
/var/folders/86/fffpdxy91136jws5hk25tmkr0000gp/T/arkade-1128661154/helm-v3.12.1-darwin-amd64.tar.gz written.
2023/06/17 17:22:04 Looking up version for helm
2023/06/17 17:22:04 Found: v3.12.1
2023/06/17 17:22:04 Extracted: /var/folders/86/fffpdxy91136jws5hk25tmkr0000gp/T/arkade-1128661154/helm
2023/06/17 17:22:04 Copying /var/folders/86/fffpdxy91136jws5hk25tmkr0000gp/T/arkade-1128661154/helm to /Users/alextercete/.arkade/bin/helm

Wrote: /Users/alextercete/.arkade/bin/helm (56.65MB)

# Add arkade binary directory to your PATH variable
export PATH=$PATH:$HOME/.arkade/bin/

# Test the binary:
/Users/alextercete/.arkade/bin/helm

# Or install with:
sudo mv /Users/alextercete/.arkade/bin/helm /usr/local/bin/

$ arkade install openfaas
Using Kubeconfig: /Users/alextercete/.kube/config
[Warning] unable to create secret basic-auth, may already exist: error: failed to create secret secrets "basic-auth" already exists
Client: arm64, Darwin
2023/06/17 17:28:10 User dir established as: /Users/alextercete/.arkade/
Error: fork/exec /Users/alextercete/.arkade/bin/helm: bad CPU type in executable

Your Environment

  • What Kubernetes distribution are you using?
$ kubectl version --output yaml
clientVersion:
  buildDate: "2023-06-14T09:47:38Z"
  compiler: gc
  gitCommit: 25b4e43193bcda6c7328a6d147b1fb73a33f1598
  gitTreeState: clean
  gitVersion: v1.27.3
  goVersion: go1.20.5
  major: "1"
  minor: "27"
  platform: darwin/arm64
kustomizeVersion: v5.0.1
serverVersion:
  buildDate: "2023-06-15T00:38:14Z"
  compiler: gc
  gitCommit: 25b4e43193bcda6c7328a6d147b1fb73a33f1598
  gitTreeState: clean
  gitVersion: v1.27.3
  goVersion: go1.20.5
  major: "1"
  minor: "27"
  platform: linux/arm64
  • Operating System and version (e.g. Linux, Windows, MacOS):
$ uname -a
Darwin Alexs-Mac-mini.fritz.box 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:19 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6020 arm64
  • What arkade version is this?
$ arkade version
            _             _
  __ _ _ __| | ____ _  __| | ___
 / _` | '__| |/ / _` |/ _` |/ _ \
| (_| | |  |   < (_| | (_| |  __/
 \__,_|_|  |_|\_\__,_|\__,_|\___|

Open Source Marketplace For Developer Tools

Version: 0.9.22
Git Commit: ab3f8aa2a12aa2f3407e8150b5bdea97fd582a6e

Okay, I just realised that #409 was reported in the context of Linux. As such, it does feel that the test case for macOS is incorrect. I'll create a PR soon with a proposed fix.

Thanks @alextercete - when do you expect to be able to do that?

cc @Jasstkn who has done some work around Apple Silicon.

I have an M1 and haven't run into issues with Helm yet.

I checked and there's currently an arm64 version of helm available for download (maybe there wasn't one at the time?).

That's likely. Many projects are still getting to grips with arm64, and Rosetta meant that they could put it off even longer.

@alexellis hey. I have some free time. Apart of planning to finish with contributing Harbor, can I submit PR for this issue? It seems to be easily fixable.