https://pulumi.com logo
Title
b

bland-lamp-16797

06/10/2020, 3:21 PM
also, after upgrading GCP cluster, I'm getting this error when trying to run helm
error: apiVersion "extensions/v1beta1/Deployment" was removed in Kubernetes 1.16. Use "apps/v1/Deployment" instead.
b

billowy-army-68599

06/10/2020, 3:42 PM
@bland-lamp-16797 that issues is related to ingress types, that API has been deprecated: https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/ You can either update your helm chart, or use a transformation to update it
b

bland-lamp-16797

06/10/2020, 3:51 PM
That is something that i don't understand, when i install Chart with
helm
it works fine
stable/nginx-ingress
But when i try same version with pulumi Chart it fails... I'm trying to figure out
transformations
, maybe that is easiest...
transformations does not work... i get
error: resource b81-system/b81-nginx-ingress-default-backend was not successfully created by the Kubernetes API server : Deployment.apps "b81-nginx-ingress-default-backend" is invalid: [spec.selector: Required value, spec.template.metadata.labels: Invalid value: map[string]string{"app":"nginx-ingress", "component":"default-backend", "release":"b81"}:
selector
does not match template
labels
]
b

billowy-army-68599

06/10/2020, 4:02 PM
can you post your transformation code?
b

bland-lamp-16797

06/10/2020, 4:03 PM
def remove_beta(obj):
        print(obj)
        if obj['kind'] == "Deployment" and obj['apiVersion'] == "extensions/v1beta1":
            obj['apiVersion'] = "apps/v1"
        return obj
b

billowy-army-68599

06/10/2020, 4:03 PM
which version of the chart are you using?
and which version of the kubernetes provider?
b

bland-lamp-16797

06/10/2020, 4:04 PM
from pulumi_kubernetes.helm.v2 import Chart, ChartOpts
so i guess v2 ?
b

billowy-army-68599

06/10/2020, 4:04 PM
what's in your
requirements.txt
?
b

bland-lamp-16797

06/10/2020, 4:05 PM
ohhh.... i've run pip freeze pulumi-docker==2.1.0 pulumi-gcp==3.3.0 pulumi-kubernetes==2.3.0
b

billowy-army-68599

06/10/2020, 4:06 PM
okay and how have you declared your chart?
b

bland-lamp-16797

06/10/2020, 4:06 PM
I've upgraded
pulumi-kubernetes
right now just to make sure it's up to date
def helm_chart(provider, name, chart, version, repo='stable', namespace=None):
    def remove_beta(obj):
        print(obj)
        if obj['kind'] == "Deployment" and obj['apiVersion'] == "extensions/v1beta1":
            obj['apiVersion'] = "apps/v1"
        return obj

    helm = Chart(name, config=ChartOpts(
        repo=repo,
        chart=chart,
        version=version,
        namespace=namespace,
        transformations=[remove_beta]
    ), opts=ResourceOptions(provider=provider))
    return helm
and calling like this:
nginx_ingress = gke.helm_chart(k8s_provider, 'b81', 'nginx-ingress', '0.30.0', namespace=b81_namespace.metadata['name'])
stable repo is:
helm repo add stable <https://kubernetes-charts.storage.googleapis.com>
b

billowy-army-68599

06/10/2020, 4:10 PM
okay, can you file an issue for this in pulumi-kubernetes? I'd can't see any reason it wouldn't be working
b

bland-lamp-16797

06/10/2020, 4:11 PM
yeah.... sure!
b

billowy-army-68599

06/10/2020, 4:13 PM
it should detect the version and render the chart with the right extensions: https://github.com/helm/charts/blob/master/stable/nginx-ingress/templates/_helpers.tpl#L95-L103
what version of
kubectl
do you have locally? which version of helm? can you include that info in the issue
b

bland-lamp-16797

06/10/2020, 4:14 PM
yes!
b

billowy-army-68599

06/10/2020, 4:16 PM
thanks! appreciate your patience
b

bland-lamp-16797

06/10/2020, 4:36 PM
c

creamy-potato-29402

06/10/2020, 7:53 PM
@bland-lamp-16797 the error you provided in the issue says exactly what the issue is. you’re missing
.spec.selector
.
b

bland-lamp-16797

06/10/2020, 7:55 PM
yeah but this is like chasing rabbit holes, helm should work more stable in pulumi and not inventing workarounds with transformations. I've create a issue at the end, my help does not work with 1.16 version. I wonder if i am only one
c

creamy-potato-29402

06/10/2020, 7:55 PM
this is not a pulumi bug. v1beta1 was deprecated several versions ago, and in recent versions, you can’t use it at all. so this is clearly a chart bug. further, you can’t just change the apiversion because v1beta2 and v1 both require
.spec.selector
to be present.
🙏 please look at the issue where I wrote more info https://github.com/pulumi/pulumi-kubernetes/issues/1154
c

creamy-potato-29402

06/10/2020, 7:56 PM
pulumi shells out to helm, so if it doesn’t work it is definitely helm’s problem.
b

bland-lamp-16797

06/10/2020, 7:57 PM
but when I run
helm
manually it works...
c

creamy-potato-29402

06/10/2020, 7:57 PM
I did, I’m telling you, this is a problem with helm and the chart.
b

bland-lamp-16797

06/10/2020, 7:57 PM
is there a way to see what command pulumi is executing? So I'll manually run it in my shell
c

creamy-potato-29402

06/10/2020, 7:58 PM
I can show you the command in source, one second.
b

bland-lamp-16797

06/10/2020, 8:02 PM
c

creamy-potato-29402

06/10/2020, 8:06 PM
one other thing I will say—in general pulumi is not complicated in the way it submits resource operations. the probability that there is a bug in that code path is very small.
if the error message says that the API server reports something bad happened, is is virtually certain that it is a bug in whatever generated the resource definition.
b

bland-lamp-16797

06/10/2020, 8:08 PM
yeah but it bothers me that in my shell i can install and remove helm charts without any problems. But when I run it with pulumi I get incompatibility error.
c

creamy-potato-29402

06/10/2020, 8:08 PM
the probability that pulumi somehow mangled the resource definition is incredibly small in general. the last time I contributed to the codebase, there were 0 places where we changed any resource definition at all.
b

bland-lamp-16797

06/10/2020, 8:09 PM
so
helm install -name b81 stable/nginx-ingress --namespace b81-system
works without problem, even uninstalling... but with pulumi it gets the error
c

creamy-potato-29402

06/10/2020, 8:09 PM
helm is also much more permissive. installing a helm chart has basically no guarantees.
pulumi will tell you when something goes wrong. helm does not.
b

bland-lamp-16797

06/10/2020, 8:17 PM
['helm', 'template', '/var/folders/9x/4kf833yx6dd8c0w1_dffkd0w0000gn/T/tmp0h4stlnp/nginx-ingress', '--name-template', 'b81', '--values', '/var/folders/9x/4kf833yx6dd8c0w1_dffkd0w0000gn/T/tmp0h4stlnp/nginx-ingress/values.yaml', '--values', '/var/folders/9x/4kf833yx6dd8c0w1_dffkd0w0000gn/T/tmpeyy32zn8', '--namespace', 'b81-system', '--include-crds']
ohhh it runs
helm template
.... nice...
i'm going reverse engineering on this LOL 🙂 but i'm curious now why it does not work
interesting, the only command that pulumi runs within shell is
helm template
then it does the magic like with k8s API
b

billowy-army-68599

06/10/2020, 8:50 PM
i think part of the issue is that the nginx template uses
Capabilities.KubeVersion
to detect which API version to use. I linked that here: https://github.com/helm/charts/blob/master/stable/nginx-ingress/templates/_helpers.tpl#L95-L103 @bland-lamp-16797 your setup, for whatever reason isn't detecting the version correctly which was why I asked for which
kubectl
version you have. I would try and use
helm template
to see what the chart that's generated is
b

bland-lamp-16797

06/10/2020, 9:11 PM
yeah... I've actually cd to one of the folders that pulumi did
helm fetch
and compared with master branch of the chart. The difference is, that i've pin it with version "_0.30.0_" and foolishly enough believing that is Chart version that i need. However ladies and gentlemen, that is not chart version, that is appversion. Appversion is... huh... I've just changed
0.30.0
version to
1.36.3
and magically started to work how it should 🤦‍♂️
it's too late here but i'll close the issue asap... thanks for the help all
it's good that i didn't use this on production yet