-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add overrides
section to Atmos stack manifests. Update docs
#464
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
osterman
reviewed
Nov 1, 2023
osterman
reviewed
Nov 1, 2023
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
nitrocode
reviewed
Nov 2, 2023
nitrocode
approved these changes
Nov 2, 2023
nitrocode
approved these changes
Nov 2, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
osterman
approved these changes
Nov 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
what
overrides
section to Atmos stack manifestswhy
Atmos supports the overrides pattern to modify component(s) configuration and behavior using the
overrides
section in Atmos stack manifests.You can override the following sections in the component(s) configuration:
vars
settings
env
command
The
overrides
section can be used at the global level or at the Terraform and Helmfile levels.Overrides Schema
The
overrides
section schema at the global level is as follows:The
overrides
section schemas at the Terraform and Helmfile levels are as follows:You can include the
overrides
,terraform.overrides
andhelmfile.overrides
sections in any Atmos stack manifest at any level of inheritance to override the configuration of all the Atmos components defined inline in the manifest and all its imports.Use-case: Overrides for Teams
The overrides pattern is used to override the components only in a particular Atmos stack manifest and all the imported
manifests. This is different from the other configuration sections (e.g.
vars
,settings
,env
). If we define avars
,settings
orenv
section at the global, Terraform or Helmfile levels, all the components in the top-level stack will get the updated configurations. On the other hand, if we define anoverrides
section in a stack manifest, only the components directly defined in the manifest and its imports will get the overridden values, not all the components in the top-level Atmos stack.This is especially useful when you have Atmos stack manifests split per Teams, each Team manages a set of components, and you need to define a common configuration (or override the existing one) for the components that only a particular Team manages.
For example, we have two Teams:
devops
andtesting
.The
devops
Team manifest is defined instacks/teams/devops.yaml
:The
testing
Team manifest is defined instacks/teams/testing.yaml
:We can import the two manifests into a top-level stack manifest, e.g.
tenant1/dev/us-west-2.yaml
:Suppose that we want to change some variables in the
vars
andenv
sections and some config in thesettings
section for all the components that thetesting
Team manges, but we don't want to affect any components that thedevops
Team manages.If we added a global or Terraform level
vars
,env
orsettings
sections to the top-level manifeststacks/orgs/cp/tenant1/dev/us-west-2.yaml
or to the Team manifeststacks/teams/testing.yaml
, then all the components in thetenant1/dev/us-west-2
top-level stack would be modified, including those managed by thedevops
Team.To solve this, we could individually modify the
vars
,env
andsettings
sections in all the components managed by thetesting
Team, but the entire configuration would not be DRY and reusable. That's where the overrides pattern comes into play. To make the configuration DRY and configured only in one place, use theoverrides
section.For example, we want to override some values in the
env
,vars
andsetings
sections for all the components managed by thetesting
Team:In the manifest above, we configure the following:
The global
overrides
section to override theTEST_ENV_VAR1
ENV variable in theenv
section. All the Terraform and Helmfile components managed by thetesting
Team will get the ENV vars updated totest-env-var1-overridden
.The Terraform-level
terraform.overrides
section to override some Spacelift configuration in thesettings
section, a variable in thevars
section, and thetofu
command to execute instead ofterraform
in thecommand
section. All the Terraform components managed by thetesting
Team will be affected by the new values (but not the Helmfile components). The Terraformoverrides
are deep-merged with the globaloverrides
and takes higher priority (it will override the same keys from the globaloverrides
).The Helmfile-level
helmfile.overrides
section to override an ENV variable in theenv
section. All the Helmfile components managed by thetesting
Team will get the new ENV variable value (but not the Terraform components). The Helmfileoverrides
are deep-merged with the globaloverrides
and takes higher priority (it will override the same keys from the globaloverrides
).To confirm that the components managed by the
testing
Team get the new values from theoverrides
sections, execute the followingcommands:
You should see the following output:
To confirm that the components managed by the
devops
Team are not affected by theoverrides
for thetesting
Team, execute the following command:You should see the following output:
The
top-level-component1
component managed by thedevops
Team does not get affected by theoverrides
sections for thetesting
Team, and the sectionsvars
,env
,settings
andcommand
are not updated with the values from theoverrides
configuration.