Using the SKE Cortex Integration
With your Cortex Workspace configured and the Cortex Controller installed on your Platform Cluster, you will now be able to leverage the SKE Cortex integration. If you have not setup the workspace and installed the controller, follow the Configuring Cortex guide.
How does it work?
The SKE Cortex Controller uses the the Cortex API to generate Entity Types and Workflows in Cortex, these can be used to manage the lifecycle of Resource Requests in the SKE Platform. For a given Promise, the SKE Cortex Controller will generate:
- Promise Entity Type: Represents the Promise in Cortex
- Create Workflow: Creates Resource Requests of the Promise exposing the options in the Promise API
- Update Workflow: Updates a given Resource Request of the Promise
- Delete Workflow: Deletes a given Resource Request of the Promise
When a user uses the Create Workflow to make a Request of a Promise, the Workflow generates a yaml document for that request and writes it to the Cortex Git Repository. When the
Platform Cluster converges on this and creates the Resource Request, the Cortex Controller creates an Entity in Cortex to correspond with the request. This details the spec and
status of the Resource Request in SKE.
When a given Resource Request or Promise is deleted (either via the Workflow or the Kubernetes API), the corresponding objects in Cortex will also be deleted.
Translating Promises to Entity Types
The Cortex Controller takes the API of the Promise and uses this to create the fields for the generated Entity Type in Cortex.
The supported types for Cortex fields are array,
boolean, integer, null, number, object and string. At present, Cortex does not support arrays of objects with fields with more than one level of nesting.
Additionally, when defined outside of an array, objects cannot exceed more than five levels of nesting.
Labelling Promises for Cortex Integration
To take advantage of the Cortex Integration for a given Promise and automatically generate Cortex objects, label your Promise with kratix.io/cortex: "true".
kubectl label promises PROMISE_NAME kratix.io/cortex=true
Or add the label to the Promise spec:
apiVersion: platform.kratix.io/v1alpha1
kind: Promise
metadata:
name: my-promise
labels:
kratix.io/cortex: "true"
The Cortex Controller will then create the Cortex objects which you will be able to see in the Cortex UI.
Managing Resource Requests in Cortex
When a Promise has been successfully installed with the Cortex integration, Platform users can use Cortex workflows to manage the lifecycle of their services. From either the Entity Type view or the Workflows view, users can trigger the Create Workflow for the desired Entity Type that represents the Promise. When initiating the Workflow, they will be presented with the input form with fields that honour the Promise API.

Upon submitting their request form, the Resource Request will be written to the configured Git Repository and created on the Platform Cluster. The creation of the request on the cluster will trigger a Kratix Workflow that creates an Entity representing the Resource Request in Cortex.

The Resource Request can then be managed via the Entity in Cortex, which will expose both the Update and Delete workflows for the Entity.

Running the Update Workflow for the Resource Request will update the request in the Git Repository and eventually, the Kratix workflows for the request will re-run and the Entity in Cortex will be updated accordingly.
Triggering the Delete Workflow will remove the request from the Git Repository, trigger a deletion on the Platform Cluster and remove the Entity from Cortex.
