Hello there! I'm trying to give Pulumi a go for s...
# getting-started
r
Hello there! I'm trying to give Pulumi a go for some kubernetes stuff using yaml, but I can't seem to get it properly installed on a MacOS Sonoma 14.5 (M1). To be more accurate, I don't get any log warning during the install, and `pulumi version`does work afterwards, but `pulumi about`actually reveals its fair share of go trouble which I will share in a thread to avoid flooding the channel - which `pulumi up`confirms by failing with the same behaviour. If someone could point me in the right direction to fix it, I'd be most grateful.
So the relevant parts of the log seems to be the following two:
Copy code
panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x103221bb8]
and
Copy code
warning: Failed to get information about the plugin: failed to discover plugin requirements: error reading from server: EOF
warning: Failed to get information about the project runtime: connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:65406: connect: connection refused"
warning: Failed to get information about the Pulumi program's dependencies: connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:65406: connect: connection refused"
I tried the `brew install pulumi/tap/pulumi`way, the `curl -fsSL https://get.pulumi.com | sh`way, the manual download and unpack way... All consistently seem to install pulumi and lead me to this issue.
The full stack for `pulumi about`is the following:
Copy code
panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x103221bb8]

goroutine 70 [running]:

<http://github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.topologicallySortedResources.func3(0x1400038fe60)|github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.topologicallySortedResources.func3(0x1400038fe60)>

        /Users/runner/work/pulumi-yaml/pulumi-yaml/pkg/pulumiyaml/sort.go:169 +0xe8

<http://github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.topologicallySortedResources.func3(0x1400038e520)|github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.topologicallySortedResources.func3(0x1400038e520)>

        /Users/runner/work/pulumi-yaml/pulumi-yaml/pkg/pulumiyaml/sort.go:192 +0x488

<http://github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.topologicallySortedResources(0x14000300d00|github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.topologicallySortedResources(0x14000300d00>, {0x103f3d100, 0x0, 0x1033fe548?})

        /Users/runner/work/pulumi-yaml/pulumi-yaml/pkg/pulumiyaml/sort.go:209 +0xdd0

<http://github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.(*Runner).setIntermediates(0x140002c7b80|github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.(*Runner).setIntermediates(0x140002c7b80>, {0x0?, 0x20?}, 0x14000072d80?, 0x0, 0x0)

        /Users/runner/work/pulumi-yaml/pulumi-yaml/pkg/pulumiyaml/run.go:792 +0x220

<http://github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.(*Runner).ensureSetup(0x140002c7b80|github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.(*Runner).ensureSetup(0x140002c7b80>, 0x0)

        /Users/runner/work/pulumi-yaml/pulumi-yaml/pkg/pulumiyaml/run.go:805 +0x3c

<http://github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.(*Runner).Run(0x140002c7b80|github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.(*Runner).Run(0x140002c7b80>, {0x1036df370?, 0x140001fc5d0})

        /Users/runner/work/pulumi-yaml/pulumi-yaml/pkg/pulumiyaml/run.go:833 +0x64

<http://github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.GetReferencedPlugins(0x14000300d00)|github.com/pulumi/pulumi-yaml/pkg/pulumiyaml.GetReferencedPlugins(0x14000300d00)>

        /Users/runner/work/pulumi-yaml/pulumi-yaml/pkg/pulumiyaml/packages.go:146 +0x1c8

<http://github.com/pulumi/pulumi-yaml/pkg/server.(*yamlLanguageHost).GetRequiredPlugins(0x14000427708|github.com/pulumi/pulumi-yaml/pkg/server.(*yamlLanguageHost).GetRequiredPlugins(0x14000427708>?, {0x102f45104?, 0x40?}, 0x1034e11e0?)

        /Users/runner/work/pulumi-yaml/pulumi-yaml/pkg/server/server.go:94 +0xac

<http://github.com/pulumi/pulumi/sdk/v3/proto/go._LanguageRuntime_GetRequiredPlugins_Handler.func1({0x1036dc9e8|github.com/pulumi/pulumi/sdk/v3/proto/go._LanguageRuntime_GetRequiredPlugins_Handler.func1({0x1036dc9e8>, 0x1400048fa70}, {0x10361acc0?, 0x140005aa1e0})

/Users/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.123.1-0.20240711160144-b8226b705890/proto/go/language_grpc.pb.go:311 +0x74

<http://github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x1036dc9e8|github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x1036dc9e8>, 0x1400048e810}, {0x10361acc0, 0x140005aa1e0}, 0x140003064c0, 0x140002f4b10)

/Users/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x2e8

<http://github.com/pulumi/pulumi/sdk/v3/proto/go._LanguageRuntime_GetRequiredPlugins_Handler({0x1036541c0|github.com/pulumi/pulumi/sdk/v3/proto/go._LanguageRuntime_GetRequiredPlugins_Handler({0x1036541c0>?, 0x14000558000}, {0x1036dc9e8, 0x1400048e810}, 0x140002c6200, 0x14000306300)

/Users/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.123.1-0.20240711160144-b8226b705890/proto/go/language_grpc.pb.go:313 +0x12c

<http://google.golang.org/grpc.(*Server).processUnaryRPC(0x14000552000|google.golang.org/grpc.(*Server).processUnaryRPC(0x14000552000>, {0x1036dc9e8, 0x1400048e750}, {0x1036e8440, 0x140001da000}, 0x1400002c000, 0x1400051c240, 0x103ef6d00, 0x0)
        /Users/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1369 +0xba0

<http://google.golang.org/grpc.(*Server).handleStream(0x14000552000|google.golang.org/grpc.(*Server).handleStream(0x14000552000>, {0x1036e8440, 0x140001da000}, 0x1400002c000)
        /Users/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1780 +0xc80

<http://google.golang.org/grpc.(*Server).serveStreams.func2.1()|google.golang.org/grpc.(*Server).serveStreams.func2.1()>
        /Users/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1019 +0x8c

created by <http://google.golang.org/grpc.(*Server).serveStreams.func2|google.golang.org/grpc.(*Server).serveStreams.func2> in goroutine 14

/Users/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1030 +0x150
I'm pretty much go illiterate, unfortunately, so I couldn't check on my own whether I was missing a go toolchain or whatnot. I expected pulumi to work out-of-the-box, to be honest.
f
1st thought - you're on apple silicon right? M1? how did you install pulumi
r
M1 indeed, and I tried three ways as stated up there! brew, curl and tar download. Same behaviour for each.
f
oh dang, ok hm. because there has been a bit of a faq of people installing from the website and it's the x86 binary
i do see now where you mentioned brew, sorry
r
You are making me realise that I failed to provide the only "working" part of the `pulumi about`results:
Copy code
CLI          
Version      3.128.0
Go Version   go1.22.5
Go Compiler  gc

Host     
OS       darwin
Version  14.4
Arch     arm64

Backend        
Name           ***********
URL            file://~
User           ************
Organizations  
Token type     personal
❤️ 1
No trouble, I appreciate the speed with which you answered and the intent to help already!
f
would you share your pulumi program? can you successfully run a different Pulumi program? e,g. one of the tutorials?
either way, it'd be great if you could put in [an issue] in
pulumi-yaml
? example: https://github.com/pulumi/pulumi-yaml/issues/465
r
Good point. I haven’t tried the tutorials but will right away. If it fails, I’ll open an issue as you’re suggesting, sure!
f
sure np! and if you do put in an issue feel free to put it here and i'll see if I can get you a quick(-ish, end of day here in US) answer
r
Thank you already for your quick and welcoming answers!
high five 1
Well this tutorial https://github.com/pulumi/examples/blob/master/kubernetes-yaml/Pulumi.yaml succeeded despite the error of
pulumi about
, so my code must be faulty. That’s progress already - I know where to look. I’ll keep digging a few hours before opening an issue. Once again, thank you for that.
f
Nice! No problem. That is a bit more pinpointed issue at least 😄
high five 1
r
The main difference with what I’m doing relies in the following part of the
Pulumi.yaml
file:
Copy code
name: pulumi-tryout-k8s
description: pulumi tryout
runtime:
  name: yaml
  options:
    compiler: "sh ./bin/merge_yaml.sh"
As you can see, I’m not actually using a yaml file straight-away, but rather using a posix-shell script to generate one by merging several yaml files. And by doing so, for some reason I don’t get yet, my mistakes do not raise proper logs anymore, though it does with the tutorial’s way. For instance, I had the following spawn after I manually generated an updated
Pulumi.yaml
file to avoid the compiler part:
Copy code
error: an unhandled error occurred: 1 error occurred:
        * Pulumi.yaml:105,21-82: resource, variable, or config value "some--var" not found;
f
that tracks with the stack trace you were getting before too
r
It does? I admit that I fail to see the link! This one looks way more understandable to my tiny brain 😄
f
you said you weren't a golang gopher, but the stack trace was a few lines up from https://github.com/pulumi/pulumi-yaml/blob/1332be6dae1a81810cd6c1500a3b5eca098ca368/pkg/pulumiyaml/sort.go#L172
👍 1
seems suspicious code-wise; without seeing your yamls i can't be sure why the merged version would be segfaulting and the manual one giving the nicer message though
r
Aah, I will trust you blindly on that one! I believe that it comes from my code relying on custom CRDs, especially from traefik. Is that usable with
pulumi-yaml
? It looks like this currently, in the
resources
field of the
Pulumi.yaml
file:
Copy code
resources:
  traefikTlsOption:
    type: kubernetes:<http://traefik.containo.us/v1alpha1:TLSOption|traefik.containo.us/v1alpha1:TLSOption>
    properties: ...
  whoamiHttpIngressRoute:
    type: kubernetes:<http://traefik.containo.us/v1alpha1:IngressRoute|traefik.containo.us/v1alpha1:IngressRoute>
    properties: ...
  traefikDeployment:
    type: kubernetes:apps/v1:Deployment
    properties: ...
and so on. The CRDs are already installed on my cluster, but I guess they must not be part of `pulumi-yaml`’s packages (or whatever it’s called, I still have to master the vocabulary!).
The merged yaml looks as follows (before the merge, it’s mainly split into as many parts as there are manifests, plus a couple values.yaml containing the
config
part - one base and its environment-related override):
Copy code
name: debug-merged-yaml
runtime: yaml

resources:
  whoamiDeployment:
    type: kubernetes:apps/v1:Deployment
    properties:
      metadata:
        namespace: ${namespace}
        name: whoami
        labels:
          app: whoami
      spec:
        replicas: 2
        selector:
          matchLabels:
            app: whoami
        template:
          metadata:
            labels:
              app: whoami
          spec:
            containers:
              - name: whoami
                image: ${images--whoami}
                ports:
                  - name: http
                    containerPort: 80
  whoamiService:
    type: kubernetes:core/v1:Service
    properties:
      metadata:
        namespace: ${namespace}
        name: whoami
      spec:
        ports:
          - protocol: TCP
            name: web
            port: 80
        selector:
          app: whoami
  whoamiHttpIngressRoute:
    type: kubernetes:<http://traefik.containo.us/v1alpha1:IngressRoute|traefik.containo.us/v1alpha1:IngressRoute>
    properties:
      metadata:
        namespace: ${namespace}
        name: http--who-am-i
      spec:
        entryPoints:
          - http
        routes:
          - match: Host(`who-am-i.infraberry.ovh`) && PathPrefix(`/notls`)
            kind: Rule
            services:
              - name: whoami
                port: 80
  whoamiHttpsIngressRoute:
    type: kubernetes:<http://traefik.containo.us/v1alpha1:IngressRoute|traefik.containo.us/v1alpha1:IngressRoute>
    properties:
      metadata:
        namespace: ${namespace}
        name: https--who-am-i
      spec:
        entryPoints:
          - https
        routes:
          - match: Host(`who-am-i.infraberry.ovh`) && PathPrefix(`/tls`)
            kind: Rule
            services:
              - name: whoami
                port: 80
        tls:
          certResolver: letsencrypt
  traefikDeployment:
    type: kubernetes:apps/v1:Deployment
    properties:
      metadata:
        namespace: ${namespace}
        name: traefik
        labels:
          app: traefik
      spec:
        replicas: 1
        selector:
          matchLabels:
            app: traefik
        template:
          metadata:
            labels:
              app: traefik
          spec:
            serviceAccountName: traefik-ingress-controller
            containers:
              - name: traefik
                image: ${images--traefik}
                args:
                  - --providers.kubernetescrd
                  - --api.insecure
                  # logging
                  - --log.level=${traefik--logging--level}
                  - --log.format=${traefik--logging--format}
                  - --accesslog
                  # letsencrypt resolver
                  - --certificatesresolvers.letsencrypt.acme.tlschallenge
                  - --certificatesresolvers.letsencrypt.acme.email=${acme--email}
                  - --certificatesresolvers.letsencrypt.acme.storage=${acme--storage}
                  - --certificatesresolvers.letsencrypt.acme.caserver=${acme--endpoint}
                  # entrypoints
                  - --entryPoints.http.address=:80
                  - --entryPoints.https.address=:443
                ports:
                  - name: http
                    containerPort: 80
                  - name: https
                    containerPort: 443
                  - name: admin
                    containerPort: 8080
  traefikTlsOption:
    type: kubernetes:<http://traefik.containo.us/v1alpha1:TLSOption|traefik.containo.us/v1alpha1:TLSOption>
    properties:
      metadata:
        name: default
        namespace: ${namespace}
      spec:
        minVersion: VersionTLS12
        cipherSuites:
          - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 # TLS 1.2
          - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 # TLS 1.2
          - TLS_AES_256_GCM_SHA384 # TLS 1.3
          - TLS_CHACHA20_POLY1305_SHA256 # TLS 1.3
        curvePreferences:
          - CurveP521
          - CurveP384
        sniStrict: true
  traefikService:
    type: kubernetes:core/v1:Service
    properties:
      metadata:
        namespace: ${namespace}
        name: traefik
      spec:
        type: LoadBalancer
        ports:
          - protocol: TCP
            name: http
            port: 80
          - protocol: TCP
            name: admin
            port: 8080
          - protocol: TCP
            name: https
            port: 443
        selector:
          app: traefik
  traefikServiceAccount:
    type: kubernetes:core/v1:ServiceAccount
    properties:
      metadata:
        namespace: ${namespace}
        name: traefik-ingress-controller
config:
  # global
  domain: aaaaaa.aaa
  namespace:
    type: string
    default: n4m35p4c3
  # acme
  acme--email: <mailto:aaaa.aaaaaaa@aaa.com|aaaa.aaaaaaa@aaa.com>
  acme--endpoint:
    type: string
    default: <https://acme-staging-v02.api.letsencrypt.org/directory>
  acme--storage:
    type: string
    default: acme.json
  # images
  images--traefik: traefik:v3.1
  images--whoami: traefik/whoami
  # traefik
  traefik--logging--format: common
  traefik--logging--level: INFO
s
I had the same problem but on an x86_64 amd laptop, fixed it with
go clean -modcache
r
Interesting idea, thanks for the input! However, I’m not sure how to do so; golang isn’t installed by default on MacOS and I didn’t install it beforehand (it isn’t a requirement for
pulumi-cli
nor
pulumi-yaml
, if I’m not mistaken). Therefore, I get
sh: go: command not found
when trying
go clean -modcache
. Was it installed somewhere behind my back but not added to PATH, is it plainly missing, or is it packaged with pulumi and can I find that
go
binary somewhere?
I created a new thread in #CRFURDVQB, as I think half of my trouble comes from there (the CRD part): https://pulumi-community.slack.com/archives/CRFURDVQB/p1723125806664509 However, I’m still interested in solving the go trouble part here if anyone’s game (why
pulumi about
screams as it does, and why logging is fumbled with the compiler option).
h
sorry you’re running into this! i think it’s something to do with the compiler option maybe not handling errors well. your program works fine for me when i include all of the resources in pulumi.yaml, but i get the same panic if i change it to
Copy code
name: debug-merged-yaml
runtime:
  name: yaml
  options:
    compiler: "cat resources.yaml"
r
That’s very kind of you. Thank you for opening the issue, I should have done so myself but I always wait until I’ve exhausted all my leads first, my apologies!
s
@rapid-advantage-25766 I've been looking into the issue. The problem is that the
pulumi-yaml
runtime expects the complete yaml, including the
name
and
runtime
options to be returned by the compiler. So updating your
merge_yaml.sh
script to include the contents of the
Pulumi.yaml
in the output should work for now. We should still not panic here and at least give a better error message, so I'm working on that now as well.
🙌 1
r
Alright! I’ll try and include it as well as soon as I can to confirm (not sure if it’s useful but hey, I’ll contribute as I can 😁). Thank you for the help!
f
pulumi-yaml v1.9.2 is out with a fix for this panic! 🎉
r
Impressive speed! Congratulations and thanks seems to be in order! 🎉 🙇‍♂️
Just tested it: it works perfectly. 🎉
The log is there, easy to read. Great work, and, I insist, impressive speed.
🎉 2
s
Thanks for testing and reporting back!
111 Views