pulumi / pulumi-kubernetes-cert-manager

A Pulumi Kubernetes CertManager component
Apache License 2.0
16 stars 7 forks source link

When providing image args with pulumi.Output throws an exception #133

Open yenoromm opened 3 months ago

yenoromm commented 3 months ago

What happened?

When creating the resource with pulumi outputs, it fails with the following: "Exception: setting args: copying input "cainjector": expected destination type to implement pulumi.Input or pulumi.Output, got string"

It happens for any image args not just cainjector

$ pulumi version

v3.124.0
$ pip show pulumi-kubernetes-cert-manager      

Name: pulumi_kubernetes_cert_manager
Version: 0.0.6
Summary: Strongly-typed Cert Manager installation
Home-page: https://pulumi.io
Author: 
Author-email: 
License: Apache-2.0
Location: /opt/homebrew/lib/python3.11/site-packages
Requires: parver, pulumi, pulumi-kubernetes, semver
Required-by:

Example

The example below is what it should look like but the repository in each image arg is a pulumi output and that causes a failure

kubernetes_cert_manager.CertManager(
    "certManagerResource",
    install_crds = True,
    image = kubernetes_cert_manager.CertManagerImageArgs(
        repository = "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/cert-manager/controller",
        tag = "1.15.1"
    ),
    cainjector = kubernetes_cert_manager.CertManagerImageArgs(
        repository = "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/cert-manager/cainjector"
        tag = "1.15.1"
    ),
    startupapicheck = kubernetes_cert_manager.CertManagerImageArgs(
        repository = "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/cert-manager/startupapicheck"
        tag = "1.15.1"
    ),
    webhook = kubernetes_cert_manager.CertManagerImageArgs(
        repository = "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/cert-manager/webhook"
        tag = "1.15.1"
    )
)

Output of pulumi about

$ pulumi about

CLI          
Version      3.124.0
Go Version   go1.22.5
Go Compiler  gc

Host     
OS       darwin
Version  14.4
Arch     arm64

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/xxxxx
User           xxxxxx
Organizations  xxxxx
Token type     personal

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

aureq commented 3 months ago

@yenoromm and for anyone else who might be in a similar situation... As a temporary workaround, it's possible to use a Helm Release.

cert_manager_release = k8s.helm.v3.Release("cert-manager-release", k8s.helm.v3.ReleaseArgs(
    chart="cert-manager",
    version="v1.15.2",
    repository_opts=k8s.helm.v3.RepositoryOptsArgs(
        repo="https://charts.jetstack.io",
    ),
    namespace=cert_manager_namespace.metadata.name,
    values={
        "installCRDs": True,
        "image": {
            "repository": "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/cert-manager/controller",
            "tag": "1.15.2"
        },
        "cainjector": {
            "image": {
                "repository": "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/cert-manager/cainjector",
                "tag": "1.15.2"
            },
        },
        "startupapicheck": {
            "image": {
                "repository": "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/cert-manager/startupapicheck",
                "tag": "1.15.2"
            },
        },
        "webhook": {
            "image": {
                "repository": "123456789.dkr.ecr.ap-southeast-2.amazonaws.com/cert-manager/webhook",
                "tag": "1.15.2"
            },
        }
    })
)
EronWright commented 3 months ago

@aureq thanks for the report and the workaround.