pulumi / pulumi-kubernetes-operator

A Kubernetes Operator that automates the deployment of Pulumi Stacks
Apache License 2.0
214 stars 54 forks source link

Unable to add a plugin to a stack #542

Open avijitsarkar123 opened 6 months ago

avijitsarkar123 commented 6 months ago

What happened?

I want to add a pulumi plugin for my stack, currently the pulumi-kubernetes-operator pod creates the pulumi workdir here, as its a dynamic path so I have no pay to run a pulumi plugin install from a local file that I am adding to the docker image for the stack to pickup.

Example

I added below to the Dockerfile to have my plugin installed

COPY ./bin/my-plugin-binary /tmp
RUN chmod 755 /tmp/my-plugin-binary

USER pulumi-kubernetes-operator

RUN pulumi plugin install resource my-plugin v0.0.1 -f /tmp/my-plugin-binary

It is installing the plugin in the path /home/pulumi-kubernetes-operator/.pulumi/plugins/ but the Stack root dir is /tmp/pulumi-working/[my-namespace]/[my-stack-name]-[random alphanumeric string]/.pulumi so the custom plugin that I installed isn't being used by the stack when its doing pulumi up internally and I am getting the below error:

pulumi:providers:my-provider poc-gcp-us-west1Provider  error: Could not automatically download and install resource plugin 'pulumi-resource-my-provide' at version v0.0.1, install the plugin using `pulumi plugin install resource rubix v0.0.1`: error downloading provider rubix to file: failed to download plugin: rubix-0.0.1: 403 HTTP error fetching plugin from https://get.pulumi.com/releases/plugins/pulumi-resource-my-provide-v0.0.1-linux-amd64.tar.gz\n    pulumi:providers:rubix poc-gcp-us-west1Provider **failed**

Output of pulumi about

$pulumi about
CLI          
Version      3.92.0
Go Version   go1.21.3
Go Compiler  gc

Host     
OS       debian
Version  11.8
Arch     x86_64

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

Pulumi locates its logs in /tmp by default

Additional context

My objective is to have a custom plugin available to my Stack, I am trying to achieve it by adding the pulumi plugin install... cmd to the Dockerfile assuming it will be used by the Stack but thats not happening as the pulumi root for the stack is different and my Dockerfile pulumi plugin install doesn't apply to that pulumi rootdir.

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

mjeffryes commented 6 months ago

thanks for reporting this @avijitsarkar123. I think we're intentionally isolating the stack root directories to avoid cross contamination, but I can see how that makes configuring custom plugins difficult. We'll hang on to this issue as a reminder to design a way to do this better.