github.com/oam-dev/kubevela@v1.9.11/docs/examples/app-with-policy/gc-policy/reverse-dependency.md (about) 1 # How to garbage collect resources in the order of dependency 2 3 If you want to garbage collect resources in the order of reverse dependency, you can add `order: dependency` in the `garbage-collect` policy. 4 5 > Notice that this order policy is only valid for the resources that are created in the components. 6 7 In the following example, component `test1` depends on `test2`, and `test2` need the output from `test3`. 8 9 So the order of deployment is: `test3 -> test2 -> test1`. 10 11 When we add `order: dependency` in `garbage-collect` policy and delete the application, the order of garbage collect is: `test1 -> test2 -> test3`. 12 13 ```yaml 14 apiVersion: core.oam.dev/v1beta1 15 kind: Application 16 metadata: 17 name: gc-dependency 18 namespace: default 19 spec: 20 components: 21 - name: test1 22 type: webservice 23 properties: 24 image: crccheck/hello-world 25 port: 8000 26 dependsOn: 27 - "test2" 28 - name: test2 29 type: webservice 30 properties: 31 image: crccheck/hello-world 32 port: 8000 33 inputs: 34 - from: test3-output 35 parameterKey: test 36 - name: test3 37 type: webservice 38 properties: 39 image: crccheck/hello-world 40 port: 8000 41 outputs: 42 - name: test3-output 43 valueFrom: output.metadata.name 44 45 policies: 46 - name: gc-dependency 47 type: garbage-collect 48 properties: 49 order: dependency 50 ```