Create a Temporary Preview Link to a Deployed Service

Create a temporary public preview link to a deployed service for testing.

Overview

Create a temporary public preview link to a deployed service to verify HTTP services after their deployment. The created link is generated with a cryptographically secure domain prefix and automatically expires after a configured time period.

You can use this step in both canary and blue-green deployment strategies.

Expose your service

Canary strategy: add an exposeServices step to strategies.<strategyName>.canary.steps in your deployment file.

Blue/Green strategy: add an exposeServices entry to strategies.<strategyName>.redirectTrafficAfter in your deployment file.

The section enables exposing deployed service resources via a temporary, internet-facing, randomly generated link for testing purposes.

...
- exposeServices:
    services:
      - <service-name-1>
      - <service-name-2>
      - <service-name-n>
    ttl:
      duration: <integer>
      unit: <seconds|minutes|hours>
  • services: List of one-to-many services to expose
    • Each service name must match an existing service deployed in the target cluster.
    • Each service must be in the same namespace as the app you are deploying.
    • Each service must define a single HTTP port.
  • ttl: (Optional) The lifetime of the exposed service preview
    • Minimum: 1 minute (60 seconds)
    • Maximum: 24 hours
    • Default: 5 minutes

Each link automatically expires after the configured amount of time. The exposed link is not secure.

You can configure multiple exposeServices entries, each having a different expiration time.

Example

In this example, the snippet instructs Armory CD-as-a-Service to create a public URL to the deployed services service-name-1 and service-name-2. Both automatically expire after 2 hours.

...
- exposeServices:
    services:
      - service-name-1
      - service-name-2
    ttl:
      duration: 2
      unit: hours

Find your exposed service URL

Customer Portal

The Resources section of your Deployment details page displays a clickable link to preview your service. CD-as-a-Service automatically creates the preview link right after the exposeServices step completes - no need to refresh the page. On the link itself there is a tooltip with the approximate remaining lifetime of the preview link.

CD-as-a-Service deactivates the link after the service preview expires.

REST API

You can find your exposed URL by doing a GET to https://api.cloud.armory.io/deploy-engine/deployments/{{deploymentID}}.

You can find the exposeServices step in the strategy’s steps collection. The exposeServices steps contains a preview object with the following keys:

  • previews: map of service-name:URL objects
  • expiresAtIso8601: the absolute timestamp of the preview link’s expiration

Example

If you configure the following in a canary strategy:

...
steps:
...
- exposeServices:
    services:
      - sample-app-svc
    ttl:
      duration: 20
      unit: minutes

… and then deploy your app, you would see this in your deployment details:

The preview link in the Resources section

If you query the REST API endpoint, you see results similar to:

The preview link in the REST API results

Last modified March 14, 2023: (8e3e6a4)