pulumi / pulumi-kubernetes-operator

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

`npm install` runs all the time #549

Open v-yarotsky opened 7 months ago

v-yarotsky commented 7 months ago

What happened?

I have pulumi-kubernetes-operator managing 4 stacks from 2 TypeScript programs (fetched from git). Even if there are no changes to the git repo, the pod keeps continuously running npm install This does not seem desirable.

Example

All screenshots were taken around the same time.

image image image image

I have the following dependencies in my package.json in the root of the repo where the pulumi programs reside:

...
    "@pulumi/keycloak": "^5.2.1",
    "@pulumi/kubernetes": "^4.5.2",
    "@pulumi/pulumi": "3.91",
...    

Output of pulumi about

Probably not relevant for this case; I'm using version 0.5.0 via the Helm chart.

Additional context

No response

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 7 months ago

Thanks for filing the report @v-yarotsky. Have you checked if the issue reproduces on a fresh cluster? It might also be interesting to try to run a manual preview for the stacks to see if there is and to check the interval for the reconcile loop.

v-yarotsky commented 7 months ago

After taking a brief look at the code, it seems like this is by design. On each iteration of the Reconcile loop^1, reconcileStackSession.setupWorkspace^2 is called, which in turn calls reconcileStackSession.InstallProjectDependencies^3. All of that is happening before checking whether the current commit matches the last applied one^4.

cleverguy25 commented 2 months ago

Added to epic https://github.com/pulumi/pulumi-kubernetes-operator/issues/586