Chapter 7

Run the whole path yourself.

The rc-demos repository has an app, the profile made from it, and a Kratix adapter that fulfils the profile on a local cluster. You need kubectl, curl, and a cluster to run it on. A KinD cluster works.

1. The app

The request logger is a small Go app that calls an HTTP API and Redis. It is its own Go module, and the same app is also written in Java and Python.

Run its tests demos README
cd apps/request-logger-http
go test ./...

2. The profile

The demo uses the profile that was made from the request logger and committed as artifacts/request-logger-http.profile.yaml. The script that deploys the app puts it into the request, so you do not have to generate it first. It names its Conditions, as the demo adapter needs (see Adapters).

Make it again, or check that it still matches the source
portable-profile/scripts/generate-profile.sh
portable-profile/scripts/generate-profile.sh --check

The script needs the extensions and go-rc-profiler repositories cloned beside rc-demos.

3. Run it on Kratix

From the rc-demos repository root
kratix/scripts/00-check-prereqs.sh
kratix/scripts/01-install-kratix.sh
kratix/scripts/02-install-promises.sh
kratix/scripts/03-deploy-catalog-and-provider.sh
kratix/scripts/04-deploy-application-release.sh
kratix/scripts/05-smoke-test.sh

The images the manifests use are meant to be published under ghcr.io/runtimeconditions/. Until they are, build them from your checkout: run kratix/scripts/load-local-images.sh first, and run the scripts above with IMAGE_PULL_POLICY=IfNotPresent.

What should happen

  1. 1
    The adapter reads the profileScript 04 puts the profile into the ApplicationRelease request, and the adapter reads its Conditions.
  2. 2
    It checks the APIThe declared GET /todos/{id} operation is checked against the catalog OpenAPI document.
  3. 3
    The Promises create what is neededA Redis is requested from the Redis Promise, and its address is worked out.
  4. 4
    The app gets its variablesThe Deployment and Service are rendered with TODOS_API_URL, REDIS_URL, and the others filled in.

A change that breaks the contract

This script publishes a catalog where the API no longer matches what the profile declares, and submits a release that should be refused.

The adapter should fail before writing the Deployment
kratix/scripts/06-demo-breaking-change.sh