ves-io-schema-virtual_host-API-Create
On This Page:
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_cert_params": {
"certificates": [
{
"kind": "certificate",
"name": "cert1"
}
],
"validation_params": {
"trusted_ca_url": "",
"use_volterra_trusted_ca_url": true
},
"cipher_suites": []
},
"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": "3eaaf9b6-07de-4d77-a9c7-0c441c9417d6",
"creation_timestamp": "2024-03-21T14:09:02.654080Z",
"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_cert_params": {
"certificates": [
{
"kind": "certificate",
"uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
"tenant": "acmecorp",
"namespace": "documentation",
"name": "cert1"
}
],
"validation_params": {
"trusted_ca_url": "",
"skip_hostname_verification": false,
"verify_subject_alt_names": [],
"use_volterra_trusted_ca_url": true
},
"minimum_protocol_version": "TLS_AUTO",
"maximum_protocol_version": "TLS_AUTO",
"cipher_suites": [],
"require_client_certificate": false,
"crl": [],
"xfcc_header_elements": []
},
"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,
"header_transformation_type": null,
"cookies_to_modify": [],
"connection_idle_timeout": 0,
"state": "VIRTUAL_HOST_READY",
"host_name": "",
"dns_info": [],
"auto_cert_info": null,
"auto_cert_error_msg": "",
"disable_dns_resolve": false,
"cdn_service": null,
"csrf_policy": null,
"dns_proxy_configuration": null,
"slow_ddos_mitigation": null,
"api_spec": null,
"domain_cert_map": {}
}
}
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_cert_params":{"certificates":[{"kind":"certificate","name":"cert1"}],"validation_params":{"trusted_ca_url":"","use_volterra_trusted_ca_url":true},"cipher_suites":[]},"proxy":"UDP_PROXY","no_challenge":{}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_var_folders_2__8qnt6fwd5dvglr1xqq6l8b7w0000gp_T_go-build3109416560_b001_apidocs.test/host=C02FN35BMD6R/svc=S:examplesvc/site=mytestce01' '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, 21 Mar 2024 14:09:02 GMT
Vary: Accept-Encoding
{
"metadata": {
"name": "productpage",
"namespace": "documentation",
"labels": {
"ves.io/app_type": "bookinfo"
},
"annotations": {
},
"description": "",
"disable": false
},
"system_metadata": {
"uid": "3eaaf9b6-07de-4d77-a9c7-0c441c9417d6",
"creation_timestamp": "2024-03-21T14:09:02.654080Z",
"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_cert_params": {
"certificates": [
{
"kind": "certificate",
"uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
"tenant": "acmecorp",
"namespace": "documentation",
"name": "cert1"
}
],
"validation_params": {
"trusted_ca_url": "",
"skip_hostname_verification": false,
"verify_subject_alt_names": [
],
"use_volterra_trusted_ca_url": true
},
"minimum_protocol_version": "TLS_AUTO",
"maximum_protocol_version": "TLS_AUTO",
"cipher_suites": [
],
"require_client_certificate": false,
"crl": [
],
"xfcc_header_elements": [
]
},
"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,
"header_transformation_type": null,
"cookies_to_modify": [
],
"connection_idle_timeout": 0,
"state": "VIRTUAL_HOST_READY",
"host_name": "",
"dns_info": [
],
"auto_cert_info": null,
"auto_cert_error_msg": "",
"disable_dns_resolve": false,
"cdn_service": null,
"csrf_policy": null,
"dns_proxy_configuration": null,
"slow_ddos_mitigation": null,
"api_spec": null,
"domain_cert_map": {
}
}
}