kptdev / kpt

Automate Kubernetes Configuration Editing
https://kpt.dev
Apache License 2.0
1.71k stars 227 forks source link

create-kpt-functions does not work on M1 #2775

Open fsommar opened 2 years ago

fsommar commented 2 years ago

Hi 👋 I wasn't sure whether to mark this as a bug or a feature request, but given the increasing prevalence of M1 I opted for bug.

Expected behavior

The npm module create-kpt-functions should be usable on macOS arm64 architecture.

Actual behavior

The npm module create-kpt-functions isn't usable on macOS arm64 architecture (M1) because the precompiled typegen binary is not available for darwin_arm64.

Information

https://storage.googleapis.com/kpt-functions/v0.17.0/typegen_darwin_amd64.tar.gz is available, https://storage.googleapis.com/kpt-functions/v0.17.0/typegen_darwin_arm64.tar.gz is not. This leads to the following output when trying to run npm install in a project that has "create-kpt-functions": "^0.19.0" as a dependency:

npm ERR! code 1
npm ERR! path [..]/node_modules/create-kpt-functions
npm ERR! command failed
npm ERR! command sh -c go-npm install
npm ERR! Installation is not supported for this architecture: arm64
npm ERR! Invalid inputs

Since we're only using it as a dev dependency I can at least run npm install after removing the dev dependency – but I'm still locked out of any workflows relying on the binary.

Steps to reproduce the behavior

  1. Use an M1 Mac
  2. Run npm install in a folder with this package.json:
    {
      "name": "test",
      "version": "1.0.0",
      "devDependencies": {
        "create-kpt-functions": "^0.19.0"
      }
    }
droot commented 2 years ago

/cc @mengqiy @yuwenma

mengqiy commented 2 years ago

This is part of efforts in https://github.com/GoogleContainerTools/kpt/issues/2874

mengqiy commented 2 years ago

This issue requires us to release npm modules for arm64 in the SDK repo. I will try to figure out how to fix it. @yuwenma Just FYI

mengqiy commented 2 years ago

I took a look at it. We need to restore something we removed in https://github.com/GoogleContainerTools/kpt-functions-sdk/pull/514. To be more concrete, we need to: