devspace
devspace copied to clipboard
Devspace purge all my deployments
What happened?
I have two deployments called app1 and app2 and I want to purge only 1 of these two.
When I do devspace purge
it purges my 2 deployments
Moreover, when I make two deployments with 2 different devspace.yml
, I can't get the two deployments with devspace list
but devspace purge
still purge the two.
What did you expect to happen instead?
I want to have the possibility to purge only 1 of the two, for example devspace purge app1
How can we reproduce the bug? (as minimally and precisely as possible)
Deploy 2 apps
My devspace.yaml:
version: ...
...
Local Environment:
- DevSpace Version: 6.3.2
- Operating System: mac
- ARCH of the OS: ARM64 Kubernetes Cluster:
- Cloud Provider: aws
Anything else we need to know?
Hello!
The default behavior for DevSpace is to deploy. / purge all applications under deployments
in the devspace.yaml. This behavior is defined with the default purge pipeline.
You can customize this with a flag if you'd like:
version: v2beta1
pipelines:
purge:
flags:
- name: app
type: string
description: The app to purge
short: a
run: |-
app=$(get_flag "app")
stop_dev --all
if [[ $app == "" ]]; then
echo "Purge all deployments"
purge_deployments --all
else
echo "Purge ${app}"
purge_deployments $app
fi
Moreover, when I make two deployments with 2 different devspace.yml, I can't get the two deployments with devspace list but devspace purge still purge the two.
It's not clear to me why the separate devspace.yml
would clear both, but they may be sharing the same .devspace
folder, in which case the cache might be causing both to be purged. If you can share more details that would be helpful. A common pattern is to have each apps in separate folders, so each folder has a separate devspace.yaml
and .devspace
folder.
I see,
My usecase is to deploy an environment for each of my PR. So what I'm doing is to replacing some digits using sed
command in my devspace.yml in my pipeline. So for example my branch develop-1
would replace the devspace.yml
and the "app" would be called app-1
and my second branch develop-2
would do the same to deploy app-2
but when I purge it deletes the two :/
@afreyermuth98 what you are trying to do sounds similar to how I use Devspace. There might be some comments on this issue I opened (and since closed) that could be helpful to you.
https://github.com/devspace-sh/devspace/issues/2525
Something else you might consider is creating unique namespaces for each PR and then deploying with Devspace into that namespace.
@lizardruss
The default behavior for DevSpace is to deploy. / purge all applications under
deployments
in the devspace.yaml. This behavior is defined with the default purge pipeline.
Due to devspace
caching its state in a Kubernetes Secret this assumption doesn't seem to be entirely correct in complex cases.
E.g. if I were to do a deploy, then remove some deployments from the devspace.yml
and then a purge, what would actually happen is that everything that had been deployed before would be purged.
That's because of what gets deployed is based on the config, what gets purged is based on the state in said secret.
I don't necessarily think that's bad (some people might expect this, some might expect both deploy
and purge
being based on the config only).