Hey :wave: QQ: can the pulumi kubernetes operator ...
# pulumi-kubernetes-operator
Hey 👋 QQ: can the pulumi kubernetes operator be defined in the same project (i.e. same nodejs package, sharing the same index.ts entrypoint etc.) as the resources it's controlling? Essentially controlling itself and applying it's own configuration, alongside the other deployments/services/resources etc. I understand that you define a stack that points at a git repository, but I'm building a monorepo and would prefer to code all my infra as code in one place, ideally one directory (i.e. /deploy or /infra for example). Is there a workable pattern for this?
Yes, you can tie this knot 🙂 To bootstrap, you will need to do something like this: 1. define the infrastructure that the operator needs (i.e., a cluster); 2. define the operator installation, and a “root” Stack for it to apply; 3. in the root stack, define other Stacks as necessary to introduce apps etc. You can choose whether the root stack points to itself (or even to the stack in 1.), or just creates other stacks. The bit I’m not totally sure on is whether the operator is able to apply the deployment that runs itself — you may need to un-deadlock it by putting the annotation ``pulumi.com/skipAwait: "true"`` on the operator deployment. This WIP guide is about using the operator with Flux, but since it discusses bootstrapping, it might help: https://github.com/pulumi/pulumi-kubernetes-operator/blob/897d9b4593a1a066c76d9c4dde64e3230ee6b91e/docs/flux.md
yes, operator can apply its own configuration. But, I had to init my root/main stack manually first time.
Yup, you have to bootstrap it, either by applying some YAMLs or running a Pulumi program by hand.