Profiles: Replace
Configuration
name
The name option is mandatory and expects a string defining the name of the profile.
replace
The replace option expects an object with the following (optional) fields:
imageswhich will replace the entireimagessection of the devspace.yamldeploymentswhich will replace the entiredeploymentssection of the devspace.yamldevwhich will replace the entiredevsection of the devspace.yamldependencieswhich will replace the entiredependenciessection of the devspace.yamlhookswhich will replace the entirehookssection of the devspace.yaml
Example: Using Config Replace For Profile production
images:
backend:
image: john/devbackend
backend-debugger:
image: john/debugger
deployments:
app-backend:
helm:
values:
containers:
- image: john/devbackend
- image: john/debugger
profiles:
- name: production
replace:
images:
backend:
image: john/prodbackend
patches:
- op: remove
path: deployments.app-backend.helm.values.containers[1]
Explanation:
- The above example defines 1 profile:
production - When using the profile
production, the config sectionimageswould be entirely replaced and additionally, 1 patch would be applied. - The resulting config used in-memory when the profile
productionis used would look like this:
# In-Memory Config After Applying Profile `production`
images:
backend:
image: john/prodbackend
deployments:
app-backend:
helm:
values:
containers:
- image: john/prodbackend
Combine Replace & Patches
As shown in this example, it is possible to use replace and patch options in combination.
Useful Commands
devspace print -p [profile]
The following command is useful to verify that the profile modifies the config as intended:
devspace print -p profile-1 -p profile-2
The above command would print the config after applying all profile patches and replace statements from profile-1 first and then profile-2.
