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 virtual_host.yaml has following contents (virtual_host.CreateRequest):

RequestJSON:

{"metadata":{"name":"productpage","namespace":"documentation","labels":{"ves.io/app_type":"bookinfo"}},"spec":{"domains":["www.bookinfo.com"],"routes":[{"kind":"route","name":"ppage-route"}],"advertise_policies":[{"kind":"advertise_policy","name":"ppage-advertise"}],"tls_parameters":{"common_params":{"cipher_suites":[],"tls_certificates":[{"certificate_url":"string:///\u003cBase64\u003e","private_key":{"blindfold_secret_info":{"location":"string:///\u003cBase64\u003e"}}}]}},"proxy":"UDP_PROXY","no_challenge":{}}} `

vesctl yaml response:

ResponseJSON:

  "metadata": {
    "name": "productpage",
    "namespace": "documentation",
    "labels": {
      "ves.io/app_type": "bookinfo"
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "8c31d4b4-bf6a-4d98-b9e0-47a0058c8dc7",
    "creation_timestamp": "2022-07-28T12:15:27.712464957Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null,
    "labels": {
    }
  },
  "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"
              },
              "blindfold_secret_info_internal": null,
              "secret_encoding_type": "EncodingNone"
            },
            "description": ""
          }
        ],
        "trusted_ca_url": "",
        "validation_params": null
      },
      "require_client_certificate": false,
      "crl": [
      ]
    },
    "type": "VIRTUAL_SERVICE",
    "buffer_policy": null,
    "cors_policy": null,
    "proxy": "UDP_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,
    "state": "VIRTUAL_HOST_READY",
    "host_name": "",
    "dns_info": [
    ],
    "auto_cert_state": "AutoCertDisabled",
    "auto_cert_info": null,
    "disable_dns_resolve": false,
    "cdn_service": null
  }
}```
`

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"}],"advertise_policies":[{"kind":"advertise_policy","name":"ppage-advertise"}],"tls_parameters":{"common_params":{"cipher_suites":[],"tls_certificates":[{"certificate_url":"string:///\u003cBase64\u003e","private_key":{"blindfold_secret_info":{"location":"string:///\u003cBase64\u003e"}}}]}},"proxy":"UDP_PROXY","no_challenge":{}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build1372770011_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: Thu, 28 Jul 2022 12:15:27 GMT Vary: Accept-Encoding

{ "metadata": { "name": "productpage", "namespace": "documentation", "labels": { "ves.io/app_type": "bookinfo" }, "annotations": { }, "description": "", "disable": false }, "system_metadata": { "uid": "8c31d4b4-bf6a-4d98-b9e0-47a0058c8dc7", "creation_timestamp": "2022-07-28T12:15:27.712464957Z", "deletion_timestamp": null, "modification_timestamp": null, "initializers": null, "finalizers": [ ], "tenant": "acmecorp", "creator_class": "examplesvc", "creator_id": "examplesvc", "object_index": 0, "owner_view": null, "labels": { } }, "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" }, "blindfold_secret_info_internal": null, "secret_encoding_type": "EncodingNone" }, "description": "" } ], "trusted_ca_url": "", "validation_params": null }, "require_client_certificate": false, "crl": [ ] }, "type": "VIRTUAL_SERVICE", "buffer_policy": null, "cors_policy": null, "proxy": "UDP_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,
"state": "VIRTUAL_HOST_READY",
"host_name": "",
"dns_info": [
],
"auto_cert_state": "AutoCertDisabled",
"auto_cert_info": null,
"disable_dns_resolve": false,
"cdn_service": null

} }