pulumi / pulumi-kubernetes-operator

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

Implement a way to trigger a reconcile #455

Closed jaxxstorm closed 1 year ago

jaxxstorm commented 1 year ago

There are circumstances whereby you don't want to wait for the operator reconcile loop to do it's thing.

If you need to provision infrastructure "right now" and you're in a backoff loop, having a way to trigger a reconcile manually seems like a good addition.

I've seen this implemented in other operators by hitting an endpoint with curl, for example

rquitales commented 1 year ago

Thanks for submitting this enhancement request as there are some scenarios where this could be useful. I believe that this is already implemented.

Starting from version 1.12.0 of the operator, a new annotation called pulumi.com/reconciliation-request has been introduced. By updating the value of this annotation to a unique value, you can manually trigger the reconciliation of a Stack CR. Subsequently, the controller will store the value of this annotation in the .status.observedReconcileRequest field. Similar to the .status.observedGeneration field, you can monitor the status to determine if the controller has detected the updated annotation. This approach eliminates the need for an external HTTP server and provides a KRM-friendly method to initiate a manual reconcile.

Example:

NEW_VALUE=$(uuidgen)
kubectl annotate stack <stack-name> pulumi.com/reconciliation-request="$NEW_VALUE" --overwrite