ves-io-schema-virtual_host-API-Create

Examples of creating virtual_host

Usecase:

Create "productpage" virtual_host which supports HTTPS

Request using vesctl:

vesctl configuration create virtual_host -i virtual_host.yaml

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

metadata:
  labels:
    ves.io/app_type: bookinfo
  name: productpage
  namespace: documentation
spec:
  advertisePolicies:
  - kind: advertise_policy
    name: ppage-advertise
  domains:
  - www.bookinfo.com
  noChallenge: {}
  proxy: HTTPS_PROXY
  routes:
  - kind: route
    name: ppage-route
  tlsParameters:
    commonParams:
      cipherSuites: []
      tlsCertificates:
      - certificateUrl: string:///<Base64>
        privateKey:
          blindfoldSecretInfo:
            location: string:///<Base64>

vesctl yaml response:

metadata:
  annotations: {}
  labels:
    ves.io/app_type: bookinfo
  name: productpage
  namespace: documentation
spec:
  advertisePolicies:
  - kind: advertise_policy
    name: ppage-advertise
    namespace: documentation
    tenant: acmecorp
    uid: ffffffff-ffff-ffff-ffff-ffffffffffff
  customErrors: {}
  dnsInfo: []
  domains:
  - www.bookinfo.com
  maliciousUserMitigation: []
  noChallenge: {}
  proxy: HTTPS_PROXY
  rateLimiter: []
  rateLimiterAllowedPrefixes: []
  requestHeadersToAdd: []
  requestHeadersToRemove: []
  responseHeadersToAdd: []
  responseHeadersToRemove: []
  routes:
  - kind: route
    name: ppage-route
    namespace: documentation
    tenant: acmecorp
    uid: ffffffff-ffff-ffff-ffff-ffffffffffff
  tlsParameters:
    commonParams:
      cipherSuites: []
      tlsCertificates:
      - certificateUrl: string:///<Base64>
        privateKey:
          blindfoldSecretInfo:
            location: string:///<Base64>
  userIdentification: []
systemMetadata:
  creationTimestamp: "2020-10-19T09:49:36.015923900Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: 21534dcf-29f8-4c25-81d1-67275f145b4a

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"productpage","namespace":"documentation","labels":{"ves.io/app_type":"bookinfo"}},"spec":{"domains":["www.bookinfo.com"],"routes":[{"kind":"route","name":"ppage-route"}],"advertisePolicies":[{"kind":"advertise_policy","name":"ppage-advertise"}],"tlsParameters":{"commonParams":{"cipherSuites":[],"tlsCertificates":[{"certificateUrl":"string:///\u003cBase64\u003e","privateKey":{"blindfoldSecretInfo":{"location":"string:///\u003cBase64\u003e"}}}]}},"proxy":"HTTPS_PROXY","noChallenge":{}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build185306297_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/documentation/virtual_hosts'

curl response:

HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 19 Oct 2020 09:49:36 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "productpage",
    "namespace": "documentation",
    "labels": {
      "ves.io/app_type": "bookinfo"
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "21534dcf-29f8-4c25-81d1-67275f145b4a",
    "creation_timestamp": "2020-10-19T09:49:36.015923900Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "domains": [
      "www.bookinfo.com"
    ],
    "routes": [
      {
        "kind": "route",
        "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "tenant": "acmecorp",
        "namespace": "documentation",
        "name": "ppage-route"
      }
    ],
    "advertise_policies": [
      {
        "kind": "advertise_policy",
        "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "tenant": "acmecorp",
        "namespace": "documentation",
        "name": "ppage-advertise"
      }
    ],
    "request_headers_to_add": [
    ],
    "response_headers_to_add": [
    ],
    "request_headers_to_remove": [
    ],
    "response_headers_to_remove": [
    ],
    "tls_parameters": {
      "common_params": {
        "minimum_protocol_version": "TLS_AUTO",
        "maximum_protocol_version": "TLS_AUTO",
        "cipher_suites": [
        ],
        "tls_certificates": [
          {
            "certificate_url": "string:///\u003cBase64\u003e",
            "private_key": {
              "blindfold_secret_info": {
                "decryption_provider": "",
                "store_provider": "",
                "location": "string:///\u003cBase64\u003e"
              },
              "secret_encoding_type": "EncodingNone"
            },
            "description": ""
          }
        ],
        "trusted_ca_url": "",
        "validation_params": null
      },
      "require_client_certificate": false
    },
    "type": "VIRTUAL_SERVICE",
    "buffer_policy": null,
    "cors_policy": null,
    "proxy": "HTTPS_PROXY",
    "waf_type": null,
    "dynamic_reverse_proxy": null,
    "add_location": false,
    "compression_params": null,
    "custom_errors": {
    },
    "disable_default_error_pages": false,
    "max_request_header_size": 0,
    "no_challenge": {

    },
    "user_identification": [
    ],
    "rate_limiter": [
    ],
    "rate_limiter_allowed_prefixes": [
    ],
    "retry_policy": null,
    "idle_timeout": 0,
    "temporary_user_blocking": null,
    "malicious_user_mitigation": [
    ],
    "state": "VIRTUAL_HOST_READY",
    "host_name": "",
    "dns_info": [
    ],
    "auto_cert_state": "AutoCertDisabled",
    "auto_cert_info": null,
    "disable_dns_resolve": false
  }
}