Health

The health policy provides a mechanism to check the health of all application components consolidating their status in a single entity. This entity can be then consumed by other tools to integrate with custom application monitoring. The following snippet contains an example application using a health policy.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: app-healthscope
spec:
  components:
    - name: component1
      type: worker
      properties:
        image: my-app-image:v1.0.0
  policies:
    - name: healthscope-policy # policy name
      type: health # set to health
      properties:
        probeInterval: 30 # (Required) health checking interval, 30s by default
        probeTimeout: 10 # (Required) health checking timeout, 10s by default

The result of the health check will appear in a newly created HealthScope entity associated with the application in its status.

apiVersion: core.oam.dev/v1alpha2
kind: HealthScope
metadata:
  ...
  labels:
    app.oam.dev/appRevision: app-healthscope-v1
    app.oam.dev/cluster: ""
    app.oam.dev/component: healthscope-policy
    app.oam.dev/name: app-healthscope
    oam.dev/render-hash: 1f2d41ad5a62c712
    workload.oam.dev/type: health
  name: healthscope-policy
  ...
spec:
  appReferences:
  - appName: app-healthscope
  probe-interval: 5
  probe-timeout: 10
  workloadRefs: []
status:
  scopeHealthCondition:
    healthStatus: HEALTHY