Version: v1.0

Aggregated Health Probe

The HealthyScope allows you to define an aggregated health probe for all components in same application.

1.Create health scope instance.

  1. apiVersion: core.oam.dev/v1alpha2
  2. kind: HealthScope
  3. metadata:
  4. name: health-check
  5. namespace: default
  6. spec:
  7. probe-interval: 60
  8. workloadRefs:
  9. - apiVersion: apps/v1
  10. kind: Deployment
  11. name: express-server
  1. Create an application that drops in this health scope.
  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: vela-app
  5. spec:
  6. components:
  7. - name: express-server
  8. type: webservice
  9. properties:
  10. image: crccheck/hello-world
  11. port: 8080 # change port
  12. cpu: 0.5 # add requests cpu units
  13. scopes:
  14. healthscopes.core.oam.dev: health-check
  1. Check the reference of the aggregated health probe (status.service.scopes).
  1. $ kubectl get app vela-app -o yaml
  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: vela-app
  5. ...
  6. status:
  7. ...
  8. services:
  9. - healthy: true
  10. name: express-server
  11. scopes:
  12. - apiVersion: core.oam.dev/v1alpha2
  13. kind: HealthScope
  14. name: health-check

4.Check health scope detail.

  1. $ kubectl get healthscope health-check -o yaml
  1. apiVersion: core.oam.dev/v1alpha2
  2. kind: HealthScope
  3. metadata:
  4. name: health-check
  5. ...
  6. spec:
  7. probe-interval: 60
  8. workloadRefs:
  9. - apiVersion: apps/v1
  10. kind: Deployment
  11. name: express-server
  12. status:
  13. healthConditions:
  14. - componentName: express-server
  15. diagnosis: 'Ready:1/1 '
  16. healthStatus: HEALTHY
  17. targetWorkload:
  18. apiVersion: apps/v1
  19. kind: Deployment
  20. name: express-server
  21. scopeHealthCondition:
  22. healthStatus: HEALTHY
  23. healthyWorkloads: 1
  24. total: 1

It shows the aggregated health status for all components in this application.