Dry Run for Debugging

Dry run will help you to understand what are the real resources which will to be expanded and deployed to the Kubernetes cluster. In other words, it will mock to run the same logic as KubeVela’s controller and output the results locally.

For example, let’s dry-run the following application:

  1. # app.yaml
  2. apiVersion: core.oam.dev/v1beta1
  3. kind: Application
  4. metadata:
  5. name: vela-app
  6. spec:
  7. components:
  8. - name: express-server
  9. type: webservice
  10. properties:
  11. image: oamdev/hello-world
  12. port: 8000
  13. traits:
  14. - type: ingress
  15. properties:
  16. domain: testsvc.example.com
  17. http:
  18. "/": 8000
  1. vela dry-run -f app.yaml
  2. ---
  3. # Application(vela-app) -- Comopnent(express-server)
  4. ---
  5. apiVersion: apps/v1
  6. kind: Deployment
  7. metadata:
  8. labels:
  9. app.oam.dev/appRevision: ""
  10. app.oam.dev/component: express-server
  11. app.oam.dev/name: vela-app
  12. workload.oam.dev/type: webservice
  13. spec:
  14. selector:
  15. matchLabels:
  16. app.oam.dev/component: express-server
  17. template:
  18. metadata:
  19. labels:
  20. app.oam.dev/component: express-server
  21. spec:
  22. containers:
  23. - image: oamdev/hello-world
  24. name: express-server
  25. ports:
  26. - containerPort: 8000
  27. ---
  28. apiVersion: v1
  29. kind: Service
  30. metadata:
  31. labels:
  32. app.oam.dev/appRevision: ""
  33. app.oam.dev/component: express-server
  34. app.oam.dev/name: vela-app
  35. trait.oam.dev/resource: service
  36. trait.oam.dev/type: ingress
  37. name: express-server
  38. spec:
  39. ports:
  40. - port: 8000
  41. targetPort: 8000
  42. selector:
  43. app.oam.dev/component: express-server
  44. ---
  45. apiVersion: networking.k8s.io/v1beta1
  46. kind: Ingress
  47. metadata:
  48. labels:
  49. app.oam.dev/appRevision: ""
  50. app.oam.dev/component: express-server
  51. app.oam.dev/name: vela-app
  52. trait.oam.dev/resource: ingress
  53. trait.oam.dev/type: ingress
  54. name: express-server
  55. spec:
  56. rules:
  57. - host: testsvc.example.com
  58. http:
  59. paths:
  60. - backend:
  61. serviceName: express-server
  62. servicePort: 8000
  63. path: /
  64. ---

In this example, the definitions(webservice and ingress) which vela-app depends on are the built-in components and traits of KubeVela. You can also use -d or --definitions to specify your local definition files.

-d or --definitions permits users to provide capability definitions used in the application from local files. dry-run cmd will prioritize the provided capabilities than the living ones in the cluster.