https://pulumi.com logo
#general
Title
# general
b

brainy-beach-36627

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 :
Copy code
├── myApp
│   ├── index.ts
│   ├── Pulumi.yaml
│   ├── Pulumi.staging.yaml
│   └── Pulumi.prod.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 :
Copy code
├── myApp
|   ├── staging
|       ├── Pulumi.yaml
│       └── Pulumi.staging.yaml
|   ├── prod
|       ├── Pulumi.yaml
│       └── Pulumi.prod.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 ?
l

little-cartoon-10569

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.