Skip to main content

Sandbox Endpoints


In order to access a Sandbox Environment manually, or from your test, Sandbox Endpoints should be used. Sandbox Endpoints are entities that provide an authenticated URL that points to a service within your Kubernetes cluster.

There are two different types of endpoints which correspond to different ways in which a Sandbox Environment is typically accessed.

  1. Fork Endpoint: When you fork a single service and want to test it through its own API, a Fork Endpoint can be created that points directly to the forked service.
  2. Host Endpoint: When performing end-to-end tests, or setting up full-stack previews for a backend change, a Host Endpoint can be used to point to a service different from the one that is forked.

Fork and Host Endpoints in a service

Both endpoints automatically set the sandbox request header context on every request made through them, so they will automatically exercise the services within the sandbox as long as header propagation is implemented. Both are authenticated and require a Signadot API Key or cookie-based authentication to access.

Specifying Endpoints

In the below example, the fork endpoint is specified under spec.forks[0].endpoints and the host endpoint under spec.endpoints. Note that once created, all endpoint URLs will assume a similar form,

name: sandbox-better-route
description: sandbox env to test a new route service change
cluster: demo
- forkOf:
kind: Deployment
name: route
namespace: hotrod
# this is a fork endpoint
# it points to the forked workload directly.
- name: route-endpoint
port: 8083
protocol: http
- image: signadot/hotrod:cace2c797082481ac0238cc1310b7816980e3244
# this is a host endpoint
# it can point anywhere that is accessible from your K8s cluster.
# it will automatically set request context corresponding to this sandbox when exercised.
- name: frontend-endpoint
host: frontend.hotrod.svc
port: 8080
protocol: http

Endpoints API Response

Given a specification of endpoints such as above, a sandbox GET or PUT response from the Signadot API will contain a set of endpoints in json (or yaml via the cli) such as below.

- baselineUrl:
host: frontend.hotrod.svc
name: frontend-hotrod-svc
port: 8080
protocol: http
routeType: host

These endpoints provide two URLs. The one under the field baselineUrl accesses a baseline service, which may or may not have an associated forked workload. Requests to this URL do not inject sandbox context propagation headers.

The URL under the field url accesses a service which may or may not have a backing forked workload. In any event, requests to this URL inject a sandbox context propagation header. This url accesses a forked workload directly if the routeType is fork, otherwise it accesses a baseline URL with the context propagation header.

More information regarding context propagation is available here.