ves-io-schema-route-API-Create

Examples of creating route

Usecase:

Create route-1

Request using vesctl:

vesctl configuration create route -i route.yaml

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

RequestJSON:

          {
    "metadata": {
        "name": "route-1",
        "namespace": "documentation"
    },
    "spec": {
        "routes": [
            {
                "match": [
                    {
                        "path": {
                            "regex": "(.*?)"
                        }
                    }
                ],
                "route_destination": {
                    "destinations": [
                        {
                            "cluster": [
                                {
                                    "kind": "cluster",
                                    "name": "cluster-1"
                                }
                            ]
                        }
                    ],
                    "auto_host_rewrite": false
                }
            }
        ]
    }
}
        

vesctl yaml response:

ResponseJSON:

          {
    "metadata": {
        "name": "route-1",
        "namespace": "documentation",
        "labels": {},
        "annotations": {},
        "description": "",
        "disable": false
    },
    "system_metadata": {
        "uid": "40c012cc-2254-41a5-9b04-32911ece530b",
        "creation_timestamp": "2024-03-21T14:06:49.624430Z",
        "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": {
        "routes": [
            {
                "match": [
                    {
                        "path": {
                            "regex": "(.*?)"
                        },
                        "headers": [],
                        "query_params": [],
                        "http_method": "ANY",
                        "incoming_port": null
                    }
                ],
                "route_destination": {
                    "destinations": [
                        {
                            "cluster": [
                                {
                                    "kind": "cluster",
                                    "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
                                    "tenant": "acmecorp",
                                    "namespace": "documentation",
                                    "name": "cluster-1"
                                }
                            ],
                            "weight": 0,
                            "priority": 0,
                            "endpoint_subsets": {}
                        }
                    ],
                    "auto_host_rewrite": false,
                    "timeout": 0,
                    "retry_policy": null,
                    "endpoint_subsets": {},
                    "mirror_policy": null,
                    "web_socket_config": null,
                    "buffer_policy": null,
                    "cors_policy": null,
                    "csrf_policy": null,
                    "hash_policy": [],
                    "priority": "DEFAULT",
                    "spdy_config": null
                },
                "disable_custom_script": false,
                "service_policy": null,
                "request_headers_to_add": [],
                "response_headers_to_add": [],
                "request_headers_to_remove": [],
                "response_headers_to_remove": [],
                "waf_type": null,
                "disable_location_add": false,
                "skip_lb_override": false,
                "bot_defense_javascript_injection_inline_mode": null
            }
        ]
    }
}
        

Request using curl:

          curl -X 'POST' -d '{"metadata":{"name":"route-1","namespace":"documentation"},"spec":{"routes":[{"match":[{"path":{"regex":"(.*?)"}}],"route_destination":{"destinations":[{"cluster":[{"kind":"cluster","name":"cluster-1"}]}],"auto_host_rewrite":false}}]}}' -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/routes'
        

curl response:

          HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 21 Mar 2024 14:06:49 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "route-1",
    "namespace": "documentation",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "40c012cc-2254-41a5-9b04-32911ece530b",
    "creation_timestamp": "2024-03-21T14:06:49.624430Z",
    "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": {
    "routes": [
      {
        "match": [
          {
            "path": {
              "regex": "(.*?)"
            },
            "headers": [
            ],
            "query_params": [
            ],
            "http_method": "ANY",
            "incoming_port": null
          }
        ],
        "route_destination": {
          "destinations": [
            {
              "cluster": [
                {
                  "kind": "cluster",
                  "uid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
                  "tenant": "acmecorp",
                  "namespace": "documentation",
                  "name": "cluster-1"
                }
              ],
              "weight": 0,
              "priority": 0,
              "endpoint_subsets": {
              }
            }
          ],
          "auto_host_rewrite": false,
          "timeout": 0,
          "retry_policy": null,
          "endpoint_subsets": {
          },
          "mirror_policy": null,
          "web_socket_config": null,
          "buffer_policy": null,
          "cors_policy": null,
          "csrf_policy": null,
          "hash_policy": [
          ],
          "priority": "DEFAULT",
          "spdy_config": null
        },
        "disable_custom_script": false,
        "service_policy": null,
        "request_headers_to_add": [
        ],
        "response_headers_to_add": [
        ],
        "request_headers_to_remove": [
        ],
        "response_headers_to_remove": [
        ],
        "waf_type": null,
        "disable_location_add": false,
        "skip_lb_override": false,
        "bot_defense_javascript_injection_inline_mode": null
      }
    ]
  }
}