github.com/oam-dev/kubevela@v1.9.11/references/docgen/def-doc/policy/garbage-collect.eg.md (about) 1 It's used in [garbage collection](https://kubevela.io/docs/end-user/policies/gc) scenario. It can be used to configure the collection policy, e.g. don't delete the legacy resources when updating. 2 3 ```yaml 4 apiVersion: core.oam.dev/v1beta1 5 kind: Application 6 metadata: 7 name: first-vela-app 8 spec: 9 components: 10 - name: express-server 11 type: webservice 12 properties: 13 image: oamdev/hello-world 14 port: 8000 15 traits: 16 - type: ingress-1-20 17 properties: 18 domain: testsvc.example.com 19 http: 20 "/": 8000 21 policies: 22 - name: keep-legacy-resource 23 type: garbage-collect 24 properties: 25 keepLegacyResource: true 26 ``` 27 28 ```yaml 29 apiVersion: core.oam.dev/v1beta1 30 kind: Application 31 metadata: 32 name: garbage-collect-app 33 spec: 34 components: 35 - name: hello-world-new 36 type: webservice 37 properties: 38 image: oamdev/hello-world 39 traits: 40 - type: expose 41 properties: 42 port: [8000] 43 policies: 44 - name: garbage-collect 45 type: garbage-collect 46 properties: 47 rules: 48 - selector: 49 traitTypes: 50 - expose 51 strategy: onAppDelete 52 ```