By default, KubeVela Application will recycle outdated resources when new version is deployed and confirmed to be healthy. In some cases, you may want to have more customized control to the recycle of outdated resources, where you can leverage the garbage-collect policy.
In garbage-collect policy, there are two major capabilities you can use.
Suppose you want to keep the resources created by the old version of the application. Use the garbage-collect policy and enable the option
- create app
- update the app
check whether legacy resources are reserved.
In the following steps, we'll use
kubectlcommand to do some verification. You can also use
vela status first-vela-appto check the aggregated application status and see if components are healthy.
- delete the app
If you hope to delete resources in one specified version, you can run
kubectl delete resourcetracker first-vela-app-v1-default.
You can also persist some resources, which skips the normal garbage-collect process when the application is updated.
Take the following app as an example, in the garbage-collect policy, a rule is added which marks all the resources created by the
expose trait to use the
onAppDelete strategy. This will keep those services until application is deleted.
You can find deployment and service created.
If you upgrade the application and use a different component, you will find the old versioned deployment is deleted but the service is kept.
If you want to deploy job-like components, in which cases the resources in the component are not expected to be recycled even after the application is deleted, you can use the component type selector and set strategy to
never as follows.
An alternative selector for the component resources is the component name selector.