Skip to main content

Updates

Kratix supports updating Promises with new specifications.

An update to a Promise will cause Kratix to reconcile on the new Promise definition, and any changes will be rolled out during this reconciliation.

This may include:

  • Updating the Promise API, which rolls out an update to the underlying CRD for the Resources managed by the Promise.
  • Updating the Promise or Resource workflows.
  • Updating the Promise scheduling.
  • Updating the Promise's static dependencies (the dependencies field in the Promise spec).

Workflows

Any update to the Promise spec will result in Kratix re-running the Promise Configure workflow, as well as re-running the Resource Configure workflow for all existing Resource Requests.

For example, if you bump an image version for a Pipeline container in a Resource Configure workflow, Kratix will ensure that all Resources are re-reconciled, including re-running the Resource Configure workflow using the new image for every existing Resource.

See Promise Workflows and Resource Workflows for more details.

Scheduling

The scheduling for a Promise may be changed by modifying either:

  • .spec.destinationSelectors in the Promise; or
  • the contents of /kratix/metadata/destination-selectors.yaml at the end of a Workflow.

See Managing Multiple Destinations for more details on scheduling.

Misscheduled workloads

An update to the Promise's scheduling may result in a set of Destinations previously targeted from old version of the Promise no longer being targeted.

When this happens, existing files written to the Destination are not removed, but are marked as misscheduled by Kratix and are not updated any more.

It's up to the platform team to manually delete these resources by deleting all WorkPlacement resources marked with the kratix.io/misscheduled label.

Example

Take a simple Promise which creates a namespace on the scheduled Destinations, with scheduling to environment: dev as follows:

apiVersion: platform.kratix.io/v1alpha1
kind: Promise
metadata:
name: promise-name
spec:
destinationSelectors:
- matchLabels:
environment: dev
dependencies:
- apiVersion: v1
kind: Namespace
metadata:
name: foo

Kratix will schedule the foo namespace resource to all Destinations with the label environment: dev as expected.

If you later update the Promise to instead have the following spec:

apiVersion: platform.kratix.io/v1alpha1
kind: Promise
metadata:
name: promise-name
spec:
destinationSelectors:
- matchLabels:
environment: prod
dependencies:
- apiVersion: v1
kind: Namespace
metadata:
name: bar

Kratix will schedule the bar namespace to all Destinations with the label environment: prod and leave all the environment: dev Destinations with the old foo namespace.

The misscheduled WorkPlacement resources can be identified by the misscheduled label:

> kubectl --context kind-platform -n kratix-platform-system get workplacements.platform.kratix.io --show-labels
NAME AGE LABELS
namespace.dev-cluster-1 40s kratix.io/misscheduled=true,kratix.io/work=namespace
namespace.prod-cluster-1 26s kratix.io/work=namespace

Cleaning them up:

> kubectl --context kind-platform -n kratix-platform-system delete workplacements.platform.kratix.io --selector kratix.io/misscheduled=true
workplacements.platform.kratix.io "namespace.dev-cluster-1" deleted