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:
images
which will replace the entireimages
section of the devspace.yamldeployments
which will replace the entiredeployments
section of the devspace.yamldev
which will replace the entiredev
section of the devspace.yamldependencies
which will replace the entiredependencies
section of the devspace.yamlhooks
which will replace the entirehooks
section of the devspace.yaml
Example: Using Config Replace For Profile production
images:
backend:
image: john/devbackend
backend-debugger:
image: john/debugger
deployments:
- name: app-backend
helm:
componentChart: true
values:
containers:
- image: john/devbackend
- image: john/debugger
profiles:
- name: production
replace:
images:
backend:
image: john/prodbackend
patches:
- op: remove
path: deployments[0].helm.values.containers[1]
Explanation:
- The above example defines 1 profile:
production
- When using the profile
production
, the config sectionimages
would be entirely replaced and additionally, 1 patch would be applied. - The resulting config used in-memory when the profile
production
is used would look like this:
# In-Memory Config After Applying Profile `production`
images:
backend:
image: john/prodbackend
deployments:
- name: app-backend
helm:
componentChart: true
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
.