Split GitOps Repositories by Service or by Environment?

With the same number of repositories, a per-service layout and a per-environment layout differ in which changes can be reviewed together and where production change authority sits. A four-way comparison covering promotion, joint releases and permissions, why one commit is not a simultaneous cutover, and how to decide with three changes from last month.

John Baek
John Baek
Founder, CollabOps
2 min read

There's a booking web app and a booking API, and both deploy to dev and production. Two services, two environments. You could create two GitOps repositories split by service, or two split by environment. The count is the same, but which changes can be reviewed together, and where production change authority lives, are not.

The boundary of a GitOps repository is set not by how many repositories you have but by which changes get reviewed in one change request and who approves production changes.

Why separate application source from deployment config?

The Argo CD best practices recommend keeping application source and deployment manifests in separate repositories. It decouples the cadence of code builds from config changes and lets you decide separately who may change production config. What's left is the boundary inside the config repositories. Where GitOps runs into certification controls in Korean public institutions is covered separately in six points where K-ISMS and GitOps collide.

CriterionPer-service repositoriesPer-environment repositories
Layoutweb-config and api-config, each with dev and prod pathsenv-dev and env-prod, each with web and api paths
Promoting one service to productionCopy the verified image digest to the prod path in the same repositoryState the digest verified in the dev repository in a change request on the prod repository
Releasing web and API togetherLink change requests in two repositories to one releaseReview both services' target versions in one change request on the prod repository
Permission design watch-outsSeparate a service owner's dev write access from production change approvalCheck which services people with prod repository access can see

Does one commit switch both services at once?

No. Bundling both into one commit doesn't make the two applications cut over simultaneously in the cluster. Suppose the web app now uses a new API field. In the per-environment layout, a single production change request can say "API 219, web 84," and the approver reviews both versions in one place. But if the API must be ready first, the deploy procedure itself has to express the order: confirm the API's responses, then switch the web app. Ordering a release when web and API live on different platforms is covered in a release order for an API on VMs and a web app on Kubernetes.

On the other hand, an organization where one team owns a service from development to production and deploys it independently may find the per-service layout easier. Even then, confirm that review on the prod path is an actual merge requirement. Having an owner's name in a file and requiring that owner's approval to merge are two different settings. If you don't want to duplicate common manifests, Kustomize bases with per-environment overlays help.

What should you bring to the decision meeting?

Three changes from last month are enough: an urgent fix to one service, a joint release of two services, and a change to production config only. Apply each to both layouts and write down how many change requests you'd need, who approves, and what unit you'd roll back if only one side failed. The more natural boundary for your organization shows up quickly.

  • #gitops
  • #kubernetes
  • #architecture
  • #change-management
  • #deployment