dhoeric / features

MIT License
14 stars 11 forks source link

Google Cloud CLI does not install gke-gcloud-auth-plugin #22

Open nicky-lenaers opened 1 year ago

nicky-lenaers commented 1 year ago

I have the following devcontainer.json:

{
  "name": "devcontainer",
  "image": "mcr.microsoft.com/devcontainers/typescript-node:0-18",
  "features": {
    "ghcr.io/devcontainers/features/git:1": {
      "version": "2.39.1"
    },
    "ghcr.io/devcontainers-contrib/features/pre-commit:2": {
      "version": "v3.3.3"
    },
    "ghcr.io/devcontainers/features/terraform:1": {
      "version": "1.5.1",
      "tflint": "0.47.0"
    },
    "ghcr.io/devcontainers-contrib/features/infracost:1": {
      "version": "v0.10.22"
    },
    "ghcr.io/devcontainers-contrib/features/kubectl-asdf:2": {
      "version": "1.27.3"
    },
    "ghcr.io/dhoeric/features/google-cloud-cli:1": {
      "version": "436.0.0",
      "installGkeGcloudAuthPlugin": true
    },
    "ghcr.io/devcontainers/features/python:1": {
      "version": "3.10"
    },
    "ghcr.io/devcontainers-contrib/features/poetry:2": {
      "version": "1.4.2"
    }
  },
  "forwardPorts": [4200, 8265, 8000],
  "postCreateCommand": "npm install"
}

As you can see I set installGkeGcloudAuthPlugin to true. Then I execute:

$ gke-gcloud-auth-plugin --version

which yields:

bash: gke-gcloud-auth-plugin: command not found

When installing manually through gcloud components install gke-gcloud-auth-plugin I get:

ERROR: (gcloud.components.install) 
You cannot perform this action because the Google Cloud CLI component manager 
is disabled for this installation. You can run the following command 
to achieve the same result for this installation: 

sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin

And subsequently sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin which yields:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package google-cloud-sdk-gke-gcloud-auth-plugin

Then I also tried "remoteUser": "root" in devcontainer.json but no luck.

pauldowman commented 1 year ago

Same issue for me. But sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin did work for me after doing sudo apt-get update -y

siyath123 commented 1 year ago

``{ "name": "devcontainer", "image": "mcr.microsoft.com/devcontainers/typescript-node:0-18", "features": { "ghcr.io/devcontainers/features/git:1": { "version": "2.39.1" }, "ghcr.io/devcontainers-contrib/features/pre-commit:2": { "version": "v3.3.3" }, "ghcr.io/devcontainers/features/terraform:1": { "version": "1.5.1", "tflint": "0.47.0" }, "ghcr.io/devcontainers-contrib/features/infracost:1": { "version": "v0.10.22" }, "ghcr.io/devcontainers-contrib/features/kubectl-asdf:2": { "version": "1.27.3" }, "ghcr.io/dhoeric/features/google-cloud-cli:1": { "version": "436.0.0", "installGkeGcloudAuthPlugin": true }, "ghcr.io/devcontainers/features/python:1": { "version": "3.10" }, "ghcr.io/devcontainers-contrib/features/poetry:2": { "version": "1.4.2" } }, "forwardPorts": [4200, 8265, 8000], "postCreateCommand": "npm install" }

nicky-lenaers commented 1 year ago

@siyath123 Not sure what your comment is supposed to say. Can you elaborate?

raz-amir commented 1 year ago

Workaround: If you will write INSTALL_GKEGCLOUDAUTH_PLUGIN instead of installGkeGcloudAuthPlugin it will work :)

drehelis commented 1 year ago

@ramir-savvy suggestion will work, https://github.com/dhoeric/features/pull/21 fix is here, hopefully will get merged soon.

garnertb commented 9 months ago

I just ran into this as well, and can confirm this workaround fixed it. @dhoeric, can #21 be merged?

"ghcr.io/dhoeric/features/google-cloud-cli:1": {
      "INSTALL_GKEGCLOUDAUTH_PLUGIN": true
    }