https://pulumi.com logo
b

boundless-angle-56560

09/06/2021, 3:34 PM
Hi, I am trying to apply some Kubernetes CRDs via Pulumi but it seems Pulumi doesnt like my CRD definition, I am getting following error
Is this some known Pulumi issue ? It seems that the CRD itself looks fine
p

prehistoric-activity-61023

09/06/2021, 5:02 PM
Can you share some code? As far as I remember I didn’t have any issues with CRDs in pulumi but it was some time ago.
b

billowy-army-68599

09/06/2021, 5:10 PM
@boundless-angle-56560 does your crd have an Empty status map at the end of it ?
p

prehistoric-activity-61023

09/06/2021, 5:22 PM
@billowy-army-68599 I guess you’re thinking about:
Copy code
# Workaround: <https://github.com/pulumi/pulumi-kubernetes/issues/800>
def remove_status(obj, _):
    if obj["kind"] == "CustomResourceDefinition":
        del obj["status"]
(that’s a copy&paste from one of my projects) If so, I was thinking about it but the message doesn’t seem to fit that case.
b

billowy-army-68599

09/06/2021, 5:25 PM
Yes that’s the one
b

boundless-angle-56560

09/06/2021, 8:35 PM
the CRD looks like this:
apiVersion: <http://apiextensions.k8s.io/v1|apiextensions.k8s.io/v1>
kind: CustomResourceDefinition
metadata:
name: manifests.akash.network
spec:
group: akash.network
scope: Namespaced
names:
plural: manifests
singular: manifest
kind: Manifest
shortNames:
- mani
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
lease_id:
type: object
properties:
owner:
type: string
dseq:
type: string
format: uint64
gseq:
type: integer
oseq:
type: integer
provider:
type: string
group:
type: object
properties:
name:
type: string
services:
type: array
items:
type: object
properties:
name:
type: string
image:
type: string
args:
type: array
items:
type: string
env:
type: array
items:
type: string
unit:
type: object
properties:
cpu:
type: number
format: uint32
memory:
type: string
format: uint64
storage:
type: string
format: uint64
count:
type: number
format: uint64
expose:
type: array
items:
type: object
properties:
port:
type: integer
format: uint16
external_port:
type: integer
format: uint16
proto:
type: string
service:
type: string
global:
type: boolean
hosts:
type: array
items:
type: string
@billowy-army-68599 @prehistoric-activity-61023 ^
b

billowy-army-68599

09/06/2021, 9:02 PM
how are you applying it? can you share your python code
p

prehistoric-activity-61023

09/07/2021, 7:18 AM
python code would be nice; plus attach it as a snippet so it’s more readable and easier to download (shortcuts/lighting icon -> “Create a text snippet”)
b

boundless-angle-56560

09/07/2021, 12:24 PM
here, @billowy-army-68599 @prehistoric-activity-61023 sorry for late reply
p

prehistoric-activity-61023

09/07/2021, 12:59 PM
I tried that on my cluster and it worked just fine (and created appropriate CRD).
Copy code
❯ pip freeze | grep pulumi-
pulumi-cloudflare==3.3.0
pulumi-gcp==5.11.0
pulumi-kubernetes==3.5.0
pulumi-random==4.2.0
just in case it’s an issue with some particular
pulumi-kubernetes
version
tested on pulumi 3.7.0
b

boundless-angle-56560

09/07/2021, 1:10 PM
I'll check my versions
p

prehistoric-activity-61023

09/07/2021, 1:11 PM
same with latest versions (pulumi 3.11.0 and kubernetes 3.7.0)
b

boundless-angle-56560

09/07/2021, 1:13 PM
I'll try to update pulumi-kubernete
now on 3.7.0 but the issue persist 😕
p

prehistoric-activity-61023

09/07/2021, 1:21 PM
how about
pip freeze | grep pulumi
?
I can see you’re using python39 (I tested on python38) but I don’t think that should be the issue
+ can you share the full error stacktrace as a snippet?
b

boundless-angle-56560

09/07/2021, 1:22 PM
p

prehistoric-activity-61023

09/07/2021, 1:23 PM
Copy code
pip install --upgrade pulumi
b

boundless-angle-56560

09/07/2021, 1:24 PM
ok issue is gone
🙂
for some reason I though that when I am upgrading pulumi I just run the sh installer and I am done
p

prehistoric-activity-61023

09/07/2021, 1:25 PM
the thing is that, you have an additional python dependency there as well
b

boundless-angle-56560

09/07/2021, 1:25 PM
and the installer is not triggering upgrades of pip dependencies ?
p

prehistoric-activity-61023

09/07/2021, 1:25 PM
I don’t have any pieces of advice yet regarding how to deal with that
It does not. You have to manually upgrade that.
b

boundless-angle-56560

09/07/2021, 1:26 PM
ok, at least I know now for the next time 🙂
p

prehistoric-activity-61023

09/07/2021, 1:26 PM
I assume you’re already using some
requirements.txt
file so just make sure you use pinned versions there.
although now I’m thinking we should ensure that these versions match 🤔
b

boundless-angle-56560

09/07/2021, 1:27 PM
I think this is a common problem in the python world
p

prehistoric-activity-61023

09/07/2021, 1:27 PM
If that assumption is true, it would be nice to compare pulumi version with python lib version while doing
pulumi up
for example
b

boundless-angle-56560

09/07/2021, 1:28 PM
yeah, I mean, any kind of intelligent check that would intelligently point user that he should check his versions would be helpful
p

prehistoric-activity-61023

09/07/2021, 1:28 PM
I think this is a common problem in the python world
I wouldn’t say so. There’s an interesting approach here used in pulumi where you have CLI tool (pulumi binary) as well as some programming lang environment (e.g. python but it might be js as well) and these two pieces must communicate with each other.
in other words: pulumi cli runs python environment that uses pulumi python module
b

boundless-angle-56560

09/07/2021, 1:30 PM
understood
p

prehistoric-activity-61023

09/07/2021, 1:31 PM
I’d need to read more on the low-level pulumi architecture to give you some more details but basically I assume that’s how it must be designed 😉
Pulumi cli can use different languages (python, golang, javascript and c# if I remember well) so there must be some communication-bridge between pulumi-cli and your python project (that’s why you need
pulumi
as python dependency). If it’s possible to have “version conflicts”, we should have some warning/error while trying to run it 🤔 . If you take a look at the traceback, it’s quite hard for an inexperienced person to understand anything from it. @billowy-army-68599 Maybe you can follow up? Did I get it right and if so, are there any plans to add some additional version assertions?
b

billowy-army-68599

09/07/2021, 6:33 PM
No that’s absolutely right!
2 Views