ves-io-schema-healthcheck-API-Create

Examples of creating healthcheck

Usecase:

Create healthcheck-productpage to check health of productpage in bookinfo application

Request using vesctl:

vesctl configuration create healthcheck -i healthcheck.yaml

where file healthcheck.yaml has following contents (healthcheck.CreateRequest):

metadata:
  name: healthcheck-productpage
  namespace: documentation
spec:
  healthyThreshold: 2
  httpHealthCheck:
    hostHeader: productpage.internal.bookinfo.com
    path: /healthcheck
  interval: 10
  jitter: 1
  timeout: 3
  unhealthyThreshold: 3

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: healthcheck-productpage
  namespace: documentation
spec:
  healthyThreshold: 2
  httpHealthCheck:
    headers: {}
    hostHeader: productpage.internal.bookinfo.com
    path: /healthcheck
    requestHeadersToRemove: []
  interval: 10
  jitter: 1
  timeout: 3
  unhealthyThreshold: 3
systemMetadata:
  creationTimestamp: "2020-07-02T15:53:06.268282600Z"
  creatorClass: examplesvc.ves.io
  finalizers: []
  tenant: acmecorp
  uid: eb77ed58-c0c3-4556-a74f-684480310808

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"healthcheck-productpage","namespace":"documentation"},"spec":{"httpHealthCheck":{"hostHeader":"productpage.internal.bookinfo.com","path":"/healthcheck"},"timeout":3,"interval":10,"jitter":1,"unhealthyThreshold":3,"healthyThreshold":2}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build743694289_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/healthchecks'

curl response:

HTTP/1.1 200 OK
Content-Length: 937
Content-Type: application/json
Date: Thu, 02 Jul 2020 15:53:06 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "healthcheck-productpage",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "eb77ed58-c0c3-4556-a74f-684480310808",
    "creation_timestamp": "2020-07-02T15:53:06.268282600Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc.ves.io",
    "creator_id": "",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "http_health_check": {
      "host_header": "productpage.internal.bookinfo.com",
      "path": "/healthcheck",
      "headers": {
      },
      "request_headers_to_remove": [
      ],
      "use_http2": false
    },
    "timeout": 3,
    "interval": 10,
    "jitter": 1,
    "unhealthy_threshold": 3,
    "healthy_threshold": 2
  }
}