ves-io-schema-discovery-API-Create

Examples of creating discovery

Usecase:

Create discovery object that will discover services from external kubernetes cluster. Any VIP(s) that are advertised on sites selected by virtual site acmecorp-vsite can be discovered by subdomian internal.bookinfo.com

Request using vesctl:

vesctl configuration create discovery -i discovery.yaml

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

metadata:
  name: k8s-discovery
  namespace: system
spec:
  k8s:
    kubeconfigUrl:
      clearSecretInfo:
        url: string://<base64>
  publishVip:
    publishVirtualIp: true
    subdomain: internal.bookinfo.com
  type: K8S
  where:
    virtualSite:
      ref:
      - kind: virtual_site
        name: acmecorp-vsite
        namespace: system
        tenant: acmecorp

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: k8s-discovery
  namespace: system
spec:
  k8s:
    kubeconfigUrl:
      clearSecretInfo:
        url: string://<base64>
  publishVip:
    publishVirtualIp: true
    subdomain: internal.bookinfo.com
  type: K8S
  where:
    virtualSite:
      ref:
      - kind: virtual_site
        name: acmecorp-vsite
        namespace: system
        tenant: acmecorp
        uid: ffffffff-ffff-ffff-ffff-ffffffffffff
systemMetadata:
  creationTimestamp: "2020-05-15T10:52:35.580665052Z"
  creatorClass: examplesvc.ves.io
  finalizers: []
  tenant: acmecorp
  uid: cbc77d09-68ca-4960-80c5-01378b634886

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"k8s-discovery","namespace":"system"},"spec":{"where":{"virtualSite":{"ref":[{"kind":"virtual_site","tenant":"acmecorp","namespace":"system","name":"acmecorp-vsite"}]}},"type":"K8S","publishVip":{"publishVirtualIp":true,"subdomain":"internal.bookinfo.com"},"k8s":{"kubeconfigUrl":{"clearSecretInfo":{"url":"string://\u003cbase64\u003e"}}}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build144460626_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/system/discoverys'

curl response:

HTTP/1.1 200 OK
Content-Length: 1371
Content-Type: application/json
Date: Fri, 15 May 2020 10:52:35 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "k8s-discovery",
    "namespace": "system",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "cbc77d09-68ca-4960-80c5-01378b634886",
    "creation_timestamp": "2020-05-15T10:52:35.580665052Z",
    "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": {
    "where": {
      "virtual_site": {
        "ref": [
          {
            "kind": "virtual_site",
            "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
            "tenant": "acmecorp",
            "namespace": "system",
            "name": "acmecorp-vsite"
          }
        ],
        "network_type": "VIRTUAL_NETWORK_SITE_LOCAL"
      }
    },
    "type": "K8S",
    "publish_vip": {
      "publish_virtual_ip": true,
      "type": "DNS_DELEGATION",
      "subdomain": "internal.bookinfo.com",
      "dns_mode": "CORE_DNS",
      "namespace": ""
    },
    "k8s": {
      "kubeconfig_url": {
        "clear_secret_info": {
          "provider": "",
          "url": "string://\u003cbase64\u003e"
        },
        "secret_encoding_type": "EncodingNone"
      }
    }
  }
}