Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization error when using helm to install a chart with Java #629

Open
Tracked by #598
t0yv0 opened this issue May 26, 2022 · 14 comments · Fixed by #759
Open
Tracked by #598

Serialization error when using helm to install a chart with Java #629

t0yv0 opened this issue May 26, 2022 · 14 comments · Fixed by #759
Labels
area/sdks impact/breaking Fixing this issue will require a breaking change kind/bug Some behavior is incorrect or out of spec language/java

Comments

@t0yv0
Copy link
Member

t0yv0 commented May 26, 2022

What happened?

Error when using helm to install a chart with Java.

Steps to reproduce

return new Release("nginx",
                ReleaseArgs.builder()
                        .chart("nginx-ingress")
                        .version("1.24.4")
                        .repositoryOpts(RepositoryOptsArgs.builder().repo("https://charts.helm.sh/stable").build())
                        .valueYamlFiles(new FileAsset("./values.yaml"))
                        .build(),
                CustomResourceOptions.builder()
                        .provider(provider)
                        .build());

Expected Behavior

Working code.

Actual Behavior

java.lang.UnsupportedOperationException: Convert [com.pulumi.kubernetes.helm.sh_v3.Release.resourceNames]: Error converting 'com.google.common.collect.RegularImmutableMap' to 'TypeShape{type=interface java.util.Map, parameters=[TypeShape{type=class java.lang.String, parameters=[]}, TypeShape{type=interface java.util.List, parameters=[]}]}'. Expected a parameter type for the List, got none

Versions used

No response

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).

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels May 26, 2022
@AaronFriel
Copy link
Member

@t0yv0 do you want to keep this on the triage queue until you get to it?

@t0yv0
Copy link
Member Author

t0yv0 commented May 27, 2022

Ah sorry about that, I just want to get it on @pawelprazak radar. I logged the issue from Community Slack. This does need fixing when possible so I can remove the label.

@t0yv0 t0yv0 removed the needs-triage Needs attention from the triage team label May 27, 2022
@t0yv0 t0yv0 mentioned this issue May 31, 2022
40 tasks
@mikhailshilkov mikhailshilkov added this to the 0.74 milestone Jun 7, 2022
@pawelprazak
Copy link
Contributor

This is the cause for the error, the annotation for exports does not support nested generic types, so List is raw/untyped.
And the Converter validation is strict in this case currently.

@Export(name="resourceNames", type=Map.class, parameters={String.class, List.class})
private Output</* @Nullable */ Map<String,List<String>>> resourceNames;

The easiest solution would be to relax the converter validation, but I'm not sure about the second order consequences.

I don't expect that overcoming java annotations limits would be easy or readable, as discussed here https://stackoverflow.com/a/35776898/539481

@t0yv0
Copy link
Member Author

t0yv0 commented Jul 19, 2022

Since breaking changes to providers are becoming quite painful now, we should try to avoid that (e.g. make SDK work with "old codegen + new codegen") here. Thank you!

@t0yv0 t0yv0 added the impact/breaking Fixing this issue will require a breaking change label Jul 19, 2022
pawelprazak added a commit that referenced this issue Jul 20, 2022
pawelprazak added a commit that referenced this issue Jul 21, 2022
pawelprazak added a commit that referenced this issue Jul 21, 2022
pawelprazak added a commit that referenced this issue Jul 21, 2022
pawelprazak added a commit that referenced this issue Jul 21, 2022
@t0yv0 t0yv0 modified the milestones: 0.75, 0.76 Jul 21, 2022
pawelprazak added a commit that referenced this issue Jul 22, 2022
pawelprazak added a commit that referenced this issue Jul 22, 2022
pawelprazak added a commit that referenced this issue Jul 22, 2022
pawelprazak added a commit that referenced this issue Jul 22, 2022
pawelprazak added a commit that referenced this issue Aug 25, 2022
pawelprazak added a commit that referenced this issue Aug 25, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
pawelprazak added a commit that referenced this issue Aug 29, 2022
@t0yv0 t0yv0 closed this as completed in e3d0731 Aug 31, 2022
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Aug 31, 2022
@hnicke
Copy link

hnicke commented Oct 21, 2022

I am still experiencing this problem.

Here is a complete stack definitition:

import com.pulumi.Context
import com.pulumi.Pulumi
import com.pulumi.kubernetes.helm.v3.Release
import com.pulumi.kubernetes.helm.v3.ReleaseArgs
import com.pulumi.kubernetes.helm.v3.inputs.RepositoryOptsArgs
import com.pulumi.resources.CustomResourceOptions

object App {
    @JvmStatic
    fun main(args: Array<String>) {
        Pulumi.run { pulumiContext: Context ->
            Release("nginx",
                ReleaseArgs.builder()
                    .chart("nginx-ingress")
                    .version("1.24.4")
                    .repositoryOpts(RepositoryOptsArgs.builder().repo("https://charts.helm.sh/stable").build())
                    .build(),
                CustomResourceOptions.builder()
                    .build());
        }
    }
}

pulumi up fails with the following exception:
java.lang.UnsupportedOperationException: Convert [com.pulumi.kubernetes.helm.v3.Release.resourceNames]: Error converting 'com.google.common.collect.RegularImmutableMap' to 'TypeShape{type=interface java.util.Map, parameters=[TypeShape{type=class java.lang.String, parameters=[]}, TypeShape{type=interface java.util.List, parameters=[]}]}'. Expected a parameter type for the List, got none

Using pulumi 3.43.1 with pulumi-java 0.6.0.
The changelog suggests this was fixed with 0.6.0 which seems to be false.

This issue should get reopened.

@pawelprazak
Copy link
Contributor

pawelprazak commented Oct 24, 2022

@hnicke I'm speculating here, but there is a possibility that an old kubernetes provider is used and this may re-surface the problem.

It is possible to remove all kubernetes provider versions from local cache using this command:

pulumi plugin rm resource kubernetes

Afterwards, a new version would be downloaded automatically when doing pulumi up and will be visible in the output of pulumi plugin ls.

@hnicke
Copy link

hnicke commented Oct 24, 2022

Btw, in the build.gradle.kts, I'm using pulumi-kubernetes v3.21.4.

Output of pulumi plugin ls (before removing the plugin):

NAME           KIND      VERSION  SIZE    INSTALLED      LAST USED
azure          resource  4.11.0   235 MB  11 months ago  15 seconds ago
azure          resource  4.6.0    229 MB  1 year ago     15 seconds ago
azure          resource  4.1.0    225 MB  1 year ago     15 seconds ago
azure          resource  3.53.0   219 MB  2 years ago    15 seconds ago
azure          resource  3.50.0   216 MB  2 years ago    15 seconds ago
azure          resource  3.48.0   222 MB  2 years ago    15 seconds ago
azure          resource  3.4.0    177 MB  2 years ago    15 seconds ago
azure          resource  1.9.0    156 MB  2 years ago    15 seconds ago
azure-native   resource  1.19.0   42 MB   11 months ago  15 seconds ago
azure-native   resource  1.9.0    42 MB   1 year ago     15 seconds ago
azure-native   resource  1.4.0    41 MB   1 year ago     15 seconds ago
azure-native   resource  0.7.1    43 MB   2 years ago    15 seconds ago
azure-nextgen  resource  0.6.1    42 MB   2 years ago    15 seconds ago
azuread        resource  4.3.0    41 MB   11 months ago  15 seconds ago
azuread        resource  4.2.0    41 MB   1 year ago     15 seconds ago
azuread        resource  4.0.0    40 MB   1 year ago     15 seconds ago
azuread        resource  3.5.1    38 MB   2 years ago    15 seconds ago
azuread        resource  3.4.0    44 MB   2 years ago    15 seconds ago
azuread        resource  2.1.0    41 MB   2 years ago    15 seconds ago
azuread        resource  1.4.0    40 MB   2 years ago    15 seconds ago
gcp            resource  6.41.0   125 MB  3 days ago     15 seconds ago
gcp            resource  6.37.0   124 MB  1 month ago    15 seconds ago
gcp            resource  6.36.0   124 MB  1 month ago    15 seconds ago
gcp            resource  6.23.0   122 MB  4 months ago   15 seconds ago
kubernetes     resource  3.21.4   83 MB   3 days ago     15 seconds ago
kubernetes     resource  3.21.2   83 MB   1 month ago    15 seconds ago
kubernetes     resource  3.21.1   83 MB   1 month ago    15 seconds ago
kubernetes     resource  3.19.1   77 MB   4 months ago   15 seconds ago
kubernetes     resource  3.5.1    67 MB   11 months ago  15 seconds ago
kubernetes     resource  3.3.0    78 MB   1 year ago     15 seconds ago
kubernetes     resource  3.1.1    78 MB   1 year ago     15 seconds ago
kubernetes     resource  2.8.4    77 MB   2 years ago    15 seconds ago
kubernetes     resource  2.8.2    77 MB   2 years ago    15 seconds ago
kubernetes     resource  2.8.1    77 MB   2 years ago    15 seconds ago
kubernetes     resource  2.0.0    52 MB   2 years ago    15 seconds ago
kubernetes     resource  1.4.1    50 MB   2 years ago    15 seconds ago
random         resource  4.8.2    34 MB   1 month ago    15 seconds ago
random         resource  4.6.0    32 MB   4 months ago   15 seconds ago
random         resource  4.2.0    31 MB   1 year ago     15 seconds ago
random         resource  4.0.0    31 MB   1 year ago     15 seconds ago
random         resource  3.1.1    30 MB   2 years ago    15 seconds ago
random         resource  3.1.0    30 MB   2 years ago    15 seconds ago

TOTAL plugin cache size: 3.8 GB

I removed the cached kubernetes plugins:


This will remove 12 plugins from the cache:
    resource kubernetes-1.4.1
    resource kubernetes-2.0.0
    resource kubernetes-2.8.1
    resource kubernetes-2.8.2
    resource kubernetes-2.8.4
    resource kubernetes-3.1.1
    resource kubernetes-3.19.1
    resource kubernetes-3.21.1
    resource kubernetes-3.21.2
    resource kubernetes-3.21.4
    resource kubernetes-3.3.0
    resource kubernetes-3.5.1
Please confirm that this is what you'd like to do by typing `yes`: yes

I've removed all the other plugins from the cache as well.

During execution of the next pulumi up, it downloaded the kubernetes plugin again:

Downloading plugin kubernetes v3.21.4: 34.29 MiB / 34.29 MiB [======] 100.00% 3s

However, I'm still experiencing the same error (Expected a parameter type for the List, got none).

Output of pulumi about:

CLI          
Version      3.43.1
Go Version   go1.19.1
Go Compiler  gc

Plugins
NAME        VERSION
gcp         6.41.0
java        unknown
kubernetes  3.21.4
random      4.8.2

Host     
OS       arch
Version  
Arch     x86_64

This project is written in java: executable='/usr/bin/java' version='openjdk 19.0.1 2022-10-18
OpenJDK Runtime Environment (build 19.0.1+10)
OpenJDK 64-Bit Server VM (build 19.0.1+10, mixed mode)' java='/usr/bin/java' javac='19.0.1'

@pawelprazak
Copy link
Contributor

Thank you for trying and for detailed response, it was worth a try ;)

It's unfortunate that the problem persists, we'll need to take a closer look.

@ringgi
Copy link

ringgi commented Oct 28, 2022

Unfortunately I run into the same problem trying to deploy a helm chart to GKE with java (using Kotlin). As in the pulumi helm package for java only the com.pulumi.kubernetes.helm.v3.Release class is available, I cannot test other strategies. Following my stacktrace, implementation and versions. Please tell me if I do something wrong here, as I need to deploy several different helm charts.

java.lang.UnsupportedOperationException: Convert [com.pulumi.kubernetes.helm.v3.Release.resourceNames]: Error converting 'com.google.common.collect.RegularImmutableMap' to 'TypeShape{type=interface java.util.Map, parameters=[TypeShape{type=class java.lang.String, parameters=[]}, TypeShape{type=interface java.util.List, parameters=[]}]}'. Expected a parameter type for the List, got none
    	at com.pulumi.serialization.internal.Converter.convertObjectUntyped(Converter.java:119)
    	at com.pulumi.serialization.internal.Converter.convertValue(Converter.java:86)
    	at com.pulumi.core.internal.OutputCompletionSource.setValue(OutputCompletionSource.java:95)
    	at
com.pulumi.deployment.internal.DeploymentImpl$ReadOrRegisterResourceInternal.lambda$completeResourceAsync$0(DeploymentImpl.java:1193)
    	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
    	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
    	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
    Caused by: java.lang.IllegalArgumentException: Expected a parameter type for the List, got none
    	at com.pulumi.serialization.internal.Converter.lambda$tryConvertList$10(Converter.java:638)
    	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
    	at com.pulumi.serialization.internal.Converter.tryConvertList(Converter.java:638)
    	at com.pulumi.serialization.internal.Converter.tryConvertObjectInner(Converter.java:277)
    	at com.pulumi.serialization.internal.Converter.tryConvertMap(Converter.java:665)
    	at com.pulumi.serialization.internal.Converter.tryConvertObjectInner(Converter.java:281)
    	at com.pulumi.serialization.internal.Converter.convertObjectUntyped(Converter.java:115)
    	... 10 more

Failing implementation:

val certManager = Release(
      "cert-manager",
      ReleaseArgs.builder()
          .chart("cert-manager")
          .version("1.10.0")
          .repositoryOpts(
              RepositoryOptsArgs.builder()
                  .repo("https://charts.jetstack.io")
                  .build()
          )
          .build(),
      CustomResourceOptions.builder()
          .provider(provider)
          .build()
  )
  ctx.export("certManagerName", certManager.name())

Pulumi Java 0.6.0
Pulumi CLI 3.44.1
Pulumi Kubernetes Provider 3.22.1
Java version 17.0.4.1
OS Mac Monterey (intel)

@jensbarthel
Copy link

We are experiencing this problem using kotlin as well, when:

  • trying to set site config args for a function web app
  • trying to list namespace keys of service bus

@jensbarthel
Copy link

jensbarthel commented Nov 11, 2022

Update:
We found out that this seems to have been fixed in v0.6.0 and updated accordingly.
Thanks guys 👍

@benediktarnold
Copy link

I can confirm that this issue still exists with pulumi-java 0.6.0. Even tried the latest kubernetes alpha plugin and it didn't make a difference.

@mikhailshilkov mikhailshilkov removed this from the 0.77 milestone Jan 27, 2023
@mikhailshilkov mikhailshilkov removed the resolution/fixed This issue was fixed label Jan 27, 2023
@hnicke
Copy link

hnicke commented Feb 22, 2023

Can confirm that unfortunately the issue still persists with all pulumi dependencies being up-to-date.

@hnicke
Copy link

hnicke commented Apr 25, 2023

As of now, all helm chart installations are working fine for me! 🥳
I'm using the latest version of all plugins and pulumi itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sdks impact/breaking Fixing this issue will require a breaking change kind/bug Some behavior is incorrect or out of spec language/java
Projects
None yet
9 participants