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

cert-manager helm chart returns type error when passing values while using python #1541

Closed
georgyo opened this issue Apr 23, 2021 · 3 comments · Fixed by pulumi/pulumi#6949
Closed
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@georgyo
Copy link

georgyo commented Apr 23, 2021

There are outstanding issues #1481 and #800 about extra status messages, but with a simple transform you can move past that and install most helm charts.

However cert-manager manages to make the values argument throw a AssertionError about the type not being a dict. This has not happened on other Helm charts thus far.

Expected behavior

pulumi_kubernetes.helm.v3 is able to keep the values dict a dict.

Current behavior

For some reason the this helm chart makes pulumi change the type of the passed values object, causing a type error later down the line.

Steps to reproduce

1. versions

  • pulumi @ 3.1.0
  • pulumi_kubernetes @ 3.0.0
  • cert-manager chart @ 1.3.1

2. Code

import pulumi_kubernetes as k8s
from pulumi_kubernetes.helm.v3 import Chart, LocalChartOpts

# Hack to resolve other issues #1481 and #800 
def remove_status(obj, opts):
    if obj["kind"] == "CustomResourceDefinition" and "status" in obj:
        del obj["status"]

cert_manager_ns = k8s.core.v1.Namespace("cert-manager", metadata={"name": "cert-manager"})

cert_manager_helm = Chart(
    "cert-manager",
    LocalChartOpts(
        path="./charts/cert-manager",
        namespace=cert_manager_ns._name,
        values={"installCRDs": True},
        transformations=[remove_status],
    )
)

3. Error

    AssertionError: Unexpected type. Expected 'dict' got 'typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any], typing.Awaitable[typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any]]], pulumi.output.Output[~T], NoneType

Note:

If you remove values={"installCRDs": True}, then there is no error.

Context (Environment)

I am experimenting with Pulumi and debating on transforming everything from terraform to pulumi. The real benefit is the state files are encrypted at rest.

Many vendor products, such as cert-manager are primarily installed via helm charts.

Interestingly, there is even an official example using cert-manager helm chart: https://github.com/pulumi/cert-manager-examples/blob/master/cert-manager/cert-manager.ts

It seems that example cannot work because of issues #1481 and #800.

@georgyo georgyo added the kind/bug Some behavior is incorrect or out of spec label Apr 23, 2021
@benesch
Copy link

benesch commented Apr 26, 2021

I've run into this too. It's new in Pulumi 3. If you downgrade to the Pulumi 2 ecosystem it'll work just fine.

@leezen leezen added this to the 0.56 milestone Apr 27, 2021
@iridian-ks
Copy link

The consul Helm chart from HashiCorp has the same problem as well as what's reported in #1481. The transformation hack fixes the status issue but there doesn't seem to be a workaround for the type issue.

I tried adding a recursive function to cast it all to dicts but it didn't seem to change anything.

@cbcmg
Copy link

cbcmg commented Apr 30, 2021

The same error happens applying cert-manager-v1.0.2.yaml via k8s.yaml.ConfigFile() (i.e. without helm) and happens without running the 'remove status transform'.

If you comment out yaml from the bottom up in that file you can find the part that pulumi 3 doesn't like, which is

spec.versions[3].schema.openAPIV3Schema.properties.spec.properties.usages.items.description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants