also, after upgrading GCP cluster, I'm getting thi...
# kubernetes
b
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
@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
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
can you post your transformation code?
b
Copy code
def remove_beta(obj):
        print(obj)
        if obj['kind'] == "Deployment" and obj['apiVersion'] == "extensions/v1beta1":
            obj['apiVersion'] = "apps/v1"
        return obj
b
which version of the chart are you using?
and which version of the kubernetes provider?
b
from pulumi_kubernetes.helm.v2 import Chart, ChartOpts
so i guess v2 ?
b
what's in your
requirements.txt
?
b
ohhh.... i've run pip freeze pulumi-docker==2.1.0 pulumi-gcp==3.3.0 pulumi-kubernetes==2.3.0
b
okay and how have you declared your chart?
b
I've upgraded
pulumi-kubernetes
right now just to make sure it's up to date
Copy code
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
okay, can you file an issue for this in pulumi-kubernetes? I'd can't see any reason it wouldn't be working
b
yeah.... sure!
b
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
yes!
b
thanks! appreciate your patience
b
c
@bland-lamp-16797 the error you provided in the issue says exactly what the issue is. you’re missing
.spec.selector
.
b
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
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
pulumi shells out to helm, so if it doesn’t work it is definitely helm’s problem.
b
but when I run
helm
manually it works...
c
I did, I’m telling you, this is a problem with helm and the chart.
b
is there a way to see what command pulumi is executing? So I'll manually run it in my shell
c
I can show you the command in source, one second.
b
c
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
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
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
so
helm install -name b81 stable/nginx-ingress --namespace b81-system
works without problem, even uninstalling... but with pulumi it gets the error
c
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
Copy code
['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
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
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