GitOps: Should Configs be Stored Separately from Application Code

Published: August 15, 2020 by Author's Photo Shane Rainville | Reading time: 2 minutes.
Should configs be stored in the same repository as code or should they be separated into different repositories.

In the era of git an age a common question developers and SREs ask themselves is “where should I store my configs?” Should configurations be stored in an application’s repository or should it be stored separately?

With the introduction of GitOps this question will be asked more frequently. GitOps desires to achieve a goal of having all operations done through version control systems. GitOps implementations can be more difficult in some environments depending on the config strategy employed.

Understanding Lifecycles

The reality is configurations and application source code has very different lifecycles. An application typically has frequent code commits to add features, fix bugs, and address technical debt. Configurations, on the other hand are rarely updated.

Configurations tend to be static in nature. Most features won’t require a configuration update, and

Environment Branches

One strategy some teams use is to carve separate environment branches. While this may seems easy to maintain at first, configuration variance starts to creep into the repository. The reason for this is simple: application code changes will be merged into the environment branches as a means to promote it up the ladder, however, an environment’s configuration is usually unique. Therefore, you will likely not be able to merge config changes from one environment branch to another easily.

Pros

  • Single source

Cons

  • Config Drift between environments
  • Config promotion difficult
  • No separation of concern

Separate Repos

Storing application code and configuration files in separate repos is the recommended approach. This strategy solves two major issues: configuration drift and lifecycle management.

Pros

  • No config drift between environments
  • Config change promotion simplified
  • Separation of concern

Cons

  • Multiple repos
Last updated on August 17, 2020 by Shane Rainville: Fix typos and grammar 591191981f7cc28a26f41f02745ecc0ba7650649
Author Photo
Blogger, Developer, pipeline builder, cloud engineer, and DevSecOps specialist. I have been working in the cloud for over a decade and running containized workloads since 2012, with gigs at small startups to large financial enterprises.

How to Effectively use Kubernetes Quality of Service

Publised October 6, 2021 by Shane Rainville

Should configs be stored in the same repository as code or should they be separated into different repositories.

Running Nfs in Kubernetes

Publised June 24, 2021 by Shane Rainville

Should configs be stored in the same repository as code or should they be separated into different repositories.

Know What's in Your Container Images

Publised June 23, 2021 by Shane Rainville

Should configs be stored in the same repository as code or should they be separated into different repositories.

How to Deploy Jekyll on Kubernetes

Publised September 15, 2020 by Shane Rainville

Should configs be stored in the same repository as code or should they be separated into different repositories.

How to Update Kubernetes Deployments

Publised September 11, 2020 by Shane Rainville

Should configs be stored in the same repository as code or should they be separated into different repositories.

How to Configure Node-based apps in Kubernetes

Publised September 9, 2020 by Shane Rainville

Should configs be stored in the same repository as code or should they be separated into different repositories.

How to Backup and Restore MongoDB Deployment on Kubernetes

Publised September 3, 2020 by Shane Rainville

Should configs be stored in the same repository as code or should they be separated into different repositories.

How to Immediately Start Kubernetes CronJobs Manually

Publised September 2, 2020 by Shane Rainville

Should configs be stored in the same repository as code or should they be separated into different repositories.