pulumi-kubernetes-operator icon indicating copy to clipboard operation
pulumi-kubernetes-operator copied to clipboard

Support Yarn (+ yarn workspaces) Explicitly

Open liamawhite opened this issue 3 years ago • 2 comments

Per discussion on Slack, the operator currently looks for npm then falls back to yarn. We can workaround by uninstalling npm in an init container.

We use yarn workspaces so can't rely on just looking for yarn.lock in the package root either as it only exists in the repo root.

liamawhite avatar Sep 16 '21 22:09 liamawhite

Additionally, we also have to run as root or chmod/chown /tmp.

{"level":"debug","ts":1632162989.3121283,"logger":"controller_stack","msg":"NPM/Yarn","Request.Namespace":"pulumi-operator","Request.Name":"...","Dir":"...","Path":"/usr/bin/yarn","Args":["/usr
/bin/yarn","install"],"Text":"Error: EACCES: permission denied, open '/tmp/.config/yarn'"}

liamawhite avatar Sep 20 '21 18:09 liamawhite

For people who want a quick workaround we use the following docker image:

FROM pulumi/pulumi-kubernetes-operator:v0.0.20

# Enable us to use yarn, see https://github.com/pulumi/pulumi-kubernetes-operator/issues/196
USER root
RUN npm uninstall npm -g

# We need write permissions for yarn, see https://github.com/pulumi/pulumi-kubernetes-operator/issues/196#issuecomment-923182126
RUN chown -R pulumi-kubernetes-operator:pulumi-kubernetes-operator /tmp
USER pulumi-kubernetes-operator

liamawhite avatar Sep 27 '21 21:09 liamawhite