pulumi / pulumi-digitalocean

A DigitalOcean Pulumi resource package, providing multi-language access to DigitalOcean
Apache License 2.0
83 stars 13 forks source link

intermittent "invalid version slug" error digitalocean.KubernetesCluster #437

Open orcutt989 opened 1 year ago

orcutt989 commented 1 year ago

What happened?

I can stand up a new cluster with the following code (note version: "latest")

const cluster = new digitalocean.KubernetesCluster("do-cluster", {
  region: digitalocean.Region.NYC1,
  version: "latest",
  autoUpgrade: true,
  nodePool: {
      name: "default",
      size: "s-2vcpu-2gb",
      autoScale: true,
      minNodes: 1,
      maxNodes: 3
  },
});

but when I try to process updates on the cluster I get "invalid version slug" and have to change latest to an actual DO k8s version slug

Expected Behavior

I would hope i could leave latest and it might somehow keep the version it was stood up with, or pin it to latest.

Steps to reproduce

see above

Output of pulumi about

pulumi about
CLI
Version      3.68.0
Go Version   go1.20.4
Go Compiler  gc

Plugins
NAME          VERSION
aws           5.41.0
aws           5.31.0
aws           4.38.1
awsx          1.0.2
digitalocean  4.19.3
docker        3.6.1
eks           1.0.2
eks           0.41.2
eks           0.33.0
kubernetes    3.28.1
nodejs        unknown

Host
OS       darwin
Version  13.3.1
Arch     x86_64

This project is written in nodejs: executable='/usr/local/bin/node' version='v18.11.0'

Dependencies:
NAME                       VERSION
@pulumi/eks                1.0.2
@pulumi/kubernetes         3.28.1
@pulumi/pulumi             3.68.0
@types/node                20.2.3
latest-version             7.0.0
tezos-pulumi               2.0.0
@pulumi/awsx               1.0.2
@pulumi/aws                5.41.0
@pulumi/digitalocean       4.19.3
dotenv                     16.0.3
yaml                       2.3.0
@oxheadalpha/tezos-pulumi  1.1.1

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

AaronFriel commented 1 year ago

Hey @orcutt989, thanks for reporting this. I have a workaround for the API error, but it looks like the upstream provider we use doesn't handle the version property well, as you'll see below. Let me know if this workaround helps unblock your program though.

Using the ignoreChanges resource option will prevent you from seeing the API error and keep the resource using the latest version returned by their API:

const cluster = new digitalocean.KubernetesCluster("do-cluster", {
  region: digitalocean.Region.NYC1,
  version: "latest",
  autoUpgrade: true,
  nodePool: {
      name: "default",
      size: "s-2vcpu-2gb",
      autoScale: true,
      minNodes: 1,
      maxNodes: 3
  },
}, {
  ignoreChanges: ["version"]
});

However, it looks like per this issue, changing the input version does not update the cluster:

For the API error and not supporting "latest", I've opened this issue as well:

AaronFriel commented 1 year ago

@orcutt989 per the issue filed upstream (#997) this may be intended behavior of the provider.

orcutt989 commented 1 year ago

If that's true then I feel like "latest" should not work on first run and should be disabled. This violates idempotency and immutable practices.