11/11/2022, 7:55 AM
Hi everyone ! We are trying to apply gitops principles to Pulumi (with the pulumi kubernetes operator), and so far I am struggling with our code structure. At first we tried the following structure for our stacks :
├── myApp
│   ├── index.ts
│   ├── Pulumi.yaml
│   ├── Pulumi.staging.yaml
│   └──
└── ...
And we configured pulumi-kubernetes-operator to watch the myApp folder and deploy changes. So, we needed to create one branch per environment because we had only one folder for all environments. This is commonly known as an anti pattern when applied to gitops. Then we decided to try this other solution :
├── myApp
|   ├── staging
|       ├── Pulumi.yaml
│       └── Pulumi.staging.yaml
|   ├── prod
|       ├── Pulumi.yaml
│       └──
|   ├── pulumi-module
│       └── index.ts
└── ...
We have one folder per environment and we avoid code duplication by adding a dependency to the pulumi-module folder. But this structure is way more complicate to manage in local for our developments. Any thoughts about this 2 solutions ? Does someone manage to do it differently ?


11/13/2022, 7:00 PM
Tags are a good addition to this model. One of my projects always deploys to a deploy-test environment when the infra code changes, and to other environments when certain tags are also present.