What determines which version of a Pulumi plugin i...
# general
b
What determines which version of a Pulumi plugin is used, and when it is upgraded? I've got a whole load of TypeScript projects all using the
kubernetes
plugin version 4.23.0 in my
package.json
, but for some reason at least one of the state files is referencing version 4.18.0, so every time I try and run
pulumi preview
or
pulumi up
it wants to install version 4.18.0 of the plugin to the Pulumi homedir...
e
If there's any resources in your state file that were last updated by the 4.18 plugin then the engine will want to download it so that if those resources are deleted it can use the old plugin to delete them with.
b
OK, so is there any way I can say "refresh all resources to use the latest plugin version"? Will
pulumi refresh
help with that?
(Like, it didn't seem to help, but maybe I was just using it incorrectly)
e
I think
pulumi refresh --run-program
will do that
refresh without --run-program just goes by whats already in the state file, --run-program will actually run the program and see the latest provider version being used
b
Ahha! Thank you, will give that a go
Didn't work 😞 I tried doing that and then removing the 4.18.0 version of the plugin and running it again, and I got the error again 😞
Hmm, the main thing seems to be the provider in the stack. Everything's being associated with the default provider, and that's still 4.18. Can I force that to upgrade?
I am so confused. Did the stack export > manually edit > stack import. I've even re-exported to verify. No references to 4.18.0 anywhere, but Pulumi is still insistent that I need one:
Copy code
Previewing update (build-uk1):
     Type                            Name                Plan     Info
     pulumi:pulumi:Stack             k8s-core-build-uk1
     └─ pulumi:providers:kubernetes  default_4_18_0               1 error

Diagnostics:
  pulumi:providers:kubernetes (default_4_18_0):
    error: no resource plugin 'pulumi-resource-kubernetes' found in the workspace at version v4.18.0 or on your $PATH
Oh God dammit
It's in the
crds2pulumi
output. It's been generated and picked 4.18.0 as the version...
Sigh. Fun new output. I'll need to talk to the engineer who did tihs last time and fine out how he worked around it:
Copy code
➜ crd2pulumi --nodejsPath ./external-secrets --nodejsName external-secrets-crds --force external-secrets-0.19.2.yaml
panic: fatal: error An assertion has failed: could not parse Pulumi package. source error: could not import spec: error binding resource kubernetes:<http://external-secrets.io/v1:ClusterSecretStore|external-secrets.io/v1:ClusterSecretStore>: failed to bind properties for kubernetes:<http://external-secrets.io/v1:ClusterSecretStore|external-secrets.io/v1:ClusterSecretStore>: error binding type for property "spec": error binding type for property "provider": invalid property names

goroutine 1 [running]:
<http://github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...)|github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...)>
	/Users/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.188.0/go/common/util/contract/failfast.go:23
<http://github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.AssertNoErrorf({0x1073e89b8|github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.AssertNoErrorf({0x1073e89b8>, 0x14001553920}, {0x1068944f9?, 0x7?}, {0x0?, 0x1?, 0x1400055f4a0?})
	/Users/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.188.0/go/common/util/contract/assert.go:51 +0x10c
<http://github.com/pulumi/crd2pulumi/pkg/codegen.(*PackageGenerator).SchemaPackageWithObjectMetaType(0x140003a50a0)|github.com/pulumi/crd2pulumi/pkg/codegen.(*PackageGenerator).SchemaPackageWithObjectMetaType(0x140003a50a0)>
	/Users/runner/work/crd2pulumi/crd2pulumi/pkg/codegen/packagegenerator.go:121 +0x6c
<http://github.com/pulumi/crd2pulumi/pkg/codegen.GenerateNodeJS(0x10685b9cd|github.com/pulumi/crd2pulumi/pkg/codegen.GenerateNodeJS(0x10685b9cd>?, 0x14000a805a0)
	/Users/runner/work/crd2pulumi/crd2pulumi/pkg/codegen/nodejs.go:33 +0x28
<http://github.com/pulumi/crd2pulumi/pkg/codegen.Generate(0x14000a805a0|github.com/pulumi/crd2pulumi/pkg/codegen.Generate(0x14000a805a0>, {0x14000d090b0, 0x1, 0x1})
	/Users/runner/work/crd2pulumi/crd2pulumi/pkg/codegen/codegen.go:62 +0x1c4
<http://github.com/pulumi/crd2pulumi/pkg/codegen.GenerateFromFiles(0x14000a805a0|github.com/pulumi/crd2pulumi/pkg/codegen.GenerateFromFiles(0x14000a805a0>, {0x14000a806c0, 0x1, 0x0?})
	/Users/runner/work/crd2pulumi/crd2pulumi/pkg/codegen/codegen.go:39 +0x23c
<http://github.com/pulumi/crd2pulumi/cmd.New.func3(0x140009b0600|github.com/pulumi/crd2pulumi/cmd.New.func3(0x140009b0600>?, {0x14000a806c0, 0x1, 0x6})
	/Users/runner/work/crd2pulumi/crd2pulumi/cmd/root.go:97 +0x1a0
<http://github.com/spf13/cobra.(*Command).execute(0x14000479508|github.com/spf13/cobra.(*Command).execute(0x14000479508>, {0x140001da1d0, 0x6, 0x6})
	/Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1015 +0x844
<http://github.com/spf13/cobra.(*Command).ExecuteC(0x14000479508)|github.com/spf13/cobra.(*Command).ExecuteC(0x14000479508)>
	/Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x384
<http://github.com/spf13/cobra.(*Command).Execute(0x0?)|github.com/spf13/cobra.(*Command).Execute(0x0?)>
	/Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1071 +0x1c
main.main()
	/Users/runner/work/crd2pulumi/crd2pulumi/main.go:25 +0x20
e
oh someone was having issues with names from crd2pulumi the other day, might be worth checking the repo see if there's a new release or at least an issue about this
b
This is with the latest release (1.6.0), which only came out a month or so ago. Looks like my colleague was on the previous one, which is about a year old. He must have installed it just before the new version dropped. Interestingly downgrading to the previous release, from Nov 2024, works fine. But generates using the old K8s plugin version. I was expecting it to use the version in my
~/.pulumi/plugins
or something, rather than be hardcoded, but 🤷‍♂️. I can see various old issues about similar things, but they all predate this release so it must be something that got added in the last year. I'll raise an issue.