🚀 Profile Activation via DevSpace vars 🚀
DevSpace now supports automatic profile activation via DevSpace variables. This allows you to auto activate profiles based on selected namespace, kube context or even custom commands:
profiles:
- name: test
activation:
- vars:
devspace.namespace: test
patches:
- op: remove
path: deployments
🚀 Runtime Variables 🚀
Added runtime variables that are prefixed with ${runtime.}
and replace the helper syntax image()
and tag()
. Those variables are useful to access certain runtime information, such as hook output or image tags, but can only be used in certain config areas that will be evaluated later on (such as deployments.*.helm.values
):
images:
app:
image: myuser/image
deployments:
- name: checkout
helm:
chart:
name: ./kubernetes/helm/app
values:
app:
image:
repo: ${runtime.images.app.image} # old was image(app)
tag: ${runtime.images.app.tag} # old was tag(app)
DevSpace now also supports hook output runtime variables:
images:
app:
image: myuser/image
hooks:
- name: "image-digest"
command: |
# This command prints the image digest
echo $(docker inspect ${runtime.images.app.image}:${runtime.images.app.tag} --format='{{index .RepoDigests 0}}' | cut -d'@' -f2)
events: ["after:build:app"]
deployments:
- name: checkout
helm:
chart:
name: ./kubernetes/helm/app
values:
app:
image:
digest: ${runtime.hooks.image-digest.stdout}
Runtime variables can also be used together with config expressions:
images:
app:
image: myuser/image
deployments:
- name: checkout
helm:
chart:
name: ./kubernetes/helm/app
values:
app:
image:
digest: $(echo $(docker inspect ${runtime.images.app.image}:${runtime.images.app.tag} --format='{{index .RepoDigests 0}}' | cut -d'@' -f2))
🚀 New Features 🚀
- Allow profiles to be defined by expressions:
profiles: $(cat profiles.yaml)
- Allow items of profiles array to be defined by expressions:
profiles:
- $(cat profile1.yaml)
- Allow profile content to be defined by expressions:
profiles:
- name: production
merge:
deployments: $(cat production.yaml)
- Simplified custom builder commands:
images:
default:
image: myuser/image
build:
custom:
skipImageArg: true
command: |-
# Also works on windows as this is executed in a golang shell
docker build -t ${runtime.images.default.image}:${runtime.images.default.tag} . -f custom/Dockerfile
onChange:
- main.go
- New options
deployments.*.disabled
,dependencies.*.disabled
,pullSecrets.*.pullSecrets
&hooks.*.disabled
to make usage of those config areas easier to use with config expressions:
hooks:
- name: load-into-kind
disabled: $( [ ${devspace.context} != "kind" ] && echo "true" || echo "false" )
command: |-
kind load docker-image ${runtime.images.app.image}:${runtime.images.app.tag}
events: ["before:deploy"]
- New hook events
before:resolveDependencies
,after:resolveDependencies
,error:resolveDependencies
,before:buildDependencies
,after:buildDependencies
,error:buildDependencies
,before:deployDependencies
,after:deployDependencies
,error:deployDependencies
,before:purgeDependencies
,after:purgeDependencies
,error:purgeDependencies
that also work for nested dependencies - DevSpace now detects
docker-compose.yaml
when runningdevspace init
and provides an option to generate an initial devspace.yaml from docker compose - DevSpace now simulates docker compose volume behaviour by uploading local files to an init container with the relevant volumes mounted. Once uploads are complete the init container exits and the application continues as expected.
- DevSpace now adds
devspace.yaml
configured commands to cobra command configuration and shows them indevspace --help
anddevspace run --help
- Deprecated the
-s
flag and instead DevSpace will now ask if the Kube context or the namespace has changed - New
--dependency
flag fordevspace print
to show a loaded dependency config - New option
deployments.helm.chart.git
to deploy a helm chart from a git repository instead of helm registry - New option
dev.replacePods.persistPaths.initConainter.resources
to configure resources for the pre-populating init container (#1775)
Changes
- Renamed predefined variables to camelCase and using a
.
. The old predefined variable names can still be used, but are deprecated - DevSpace will now always try to list all helm releases in a namespace to find the correct deployment status (#1772)
- DevSpace will now print by default why it is rebuilding an image
- DevSpace will now print all filesystem events it receives for syncing files if
--debug
is specified and show if a file wasn't synced - Display stdout / stderr if downloading devspacehelper fails
- Updated Helm v3 version that is downloaded if helm is not found (thanks @ragnarpa)
- DevSpace will now use the
replacePods[*].containerName
if multiple containers are found within a replaced pod and noreplacePods[*].persistPaths[*].containerName
is defined - Improved sync change detection for folders
- Improved logging why DevSpace is restarting sync or port-forwarding
- Improved logging if DevSpace is waiting for a pod to become running
Fixes
- Fixed an issue where DevSpace would fail using new kubectl version v1.23 (#1813)
- Fixed an issue where DevSpace would allow substring matches from activating profiles. For example: an expression
test
would matchtest123
- Fixed an issue where DevSpace would hang starting the sync if a recursive symlink was found
- Fixed an issue where sync exec name was not named correctly (#1789)
- Fixed an issue where DevSpace would fail on arm64 systems during sync with
too many files open
(#1444) - Fixed an issue where DevSpace was showing dependency ids instead of names
- Fixed an issue where DevSpace would create a failing pod if the persistence path would not exist in the target container
- Fixed a nil pointer if replacing a path with an empty value (#1774)
- Fixed an issue where
devspace build
would fail if there wasn't a valid kube context (thanks @wollowizard) (#1769) - Fixed an issue where DevSpace would use the wrong path for syncing (#1743)