Webhook icon
Schedule icon
Script icon
Docker icon
Switch icon
Log icon
SlackIncomingWebhook icon
Create icon
If icon
Fail icon

Gate Deploys on Crossplane Claim Health Instead of Trusting a Ready Condition

Classify a Crossplane claim from its conditions and resources, flag drift markers behind a Ready surface, and gate the deploy with Slack and GitHub.

Categories
Infrastructure

A Crossplane claim can read Ready while the composition behind it has quietly drifted, through late-initialized fields, resources that stopped being Ready, or a reconciler that keeps failing polls, and almost nothing gates a deploy on that position. This blueprint takes one status report carrying the claim conditions and the composed resources, classifies the claim as Ready, NotReady or Unavailable in Python, and routes on that state with a Switch. NotReady claims get a Slack alert and a labeled GitHub issue listing every drift marker, Unavailable claims get a Slack alert, and a final gate fails the execution whenever the claim is not Ready so the pipeline waiting on it stops.

How it works

  1. post_claim_status (io.kestra.plugin.core.trigger.Webhook, keyed with the CLAIM_STATUS_WEBHOOK_KEY secret) accepts the report after each reconcile. hourly_claim_safety_net (io.kestra.plugin.core.trigger.Schedule, cron 0 7 * * *) ships disabled: true until an operator has reviewed the classification inputs and switched it on.
  2. inspect_claim_status (io.kestra.plugin.scripts.python.Script on python:3.12-slim) reads claim_status.json from inputFiles and the three thresholds from env. It reads the Ready condition, counts resources that are not Ready, collects lateInitializedFields, notes a reconciler driftDetected flag, and ages the Ready condition. The state is Unavailable when no Ready condition exists, NotReady when Ready is False or when a Ready claim still carries drift markers, and Ready only when both surfaces are clean. The verdict is printed as one ::{"outputs": ...}:: line.
  3. route_on_claim_state (io.kestra.plugin.core.flow.Switch) branches on that state with map shaped cases. Ready logs the inspection, NotReady posts Slack and then opens a labeled GitHub issue with the markers as JSON, and Unavailable posts Slack. A defaults branch logs any state the classifier did not predict.
  4. claim_gate (io.kestra.plugin.core.flow.If) is the verdict. A blocked claim gets one Slack summary naming the markers and then fails the execution through io.kestra.plugin.core.execution.Fail, a Ready claim logs the pass, and the flow level errors handler (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) reports any other failure with the execution id.

What you get

  • A state that reflects composition reality, NotReady even when the claim's own condition says Ready, if a resource or a late-initialized field proves otherwise.
  • Escalation that fits the state, Slack plus a GitHub issue for drift, Slack for a claim that cannot even report, a quiet log when clean.
  • A configurable stance, require_all_resources_ready decides whether a not ready child resource is a blocker or only a note.
  • Gateable outputs (claim_state, gate_blocked, drift_markers, non_ready_resources, composition, detail) a promotion flow can branch on.

Who it's for

  • Platform teams running Crossplane compositions who need a deploy gate on claim health, not just on whether the claim object exists.
  • Kubernetes engineers triaging late-initialized drift and failed polls that never surface in a normal readiness check.
  • GitOps maintainers who want drifted claims to arrive as issues with markers, not as a surprise after the release ships.

Why orchestrate this with Kestra

Crossplane reconciles continuously and tells you about state one condition at a time, with no memory of what looked wrong yesterday and no opinion about whether a deploy may proceed. Kestra gives the check a keyed entry point for the cluster reporter, a Switch that separates the three states into three different responses, a conditional gate that stops the pipeline, typed outputs a parent flow can branch on, and an execution history showing which claim was classified, with which markers, at which time. Outside Kestra this becomes a controller hook whose alert nobody owns.

Prerequisites

  • A worker with Docker access, the classifier runs in python:3.12-slim.
  • A reporter step that POSTs the claim, its conditions and its composed resources, shaped as claim, composition, conditions and resources, with optional driftDetected and observedAt fields.
  • A Slack incoming webhook and a GitHub token that can open issues in the repository named on open_claim_issue.

Secrets

  • CLAIM_STATUS_WEBHOOK_KEY: key segment guarding the status webhook URL, anyone holding it can post a claim report.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL used by the routing alerts, the gate summary and the errors handler.
  • GITHUB_TOKEN: token used to open the drift issue, classic repo scope or fine-grained Issues write.

Quick start

  1. Add the three secrets and point open_claim_issue.repository at a repository where issues are welcome.

  2. Run the flow once with a clean claim and watch it log Ready.

    curl -X POST -H "Content-Type: application/json" -d '{"observedAt":"2026-10-15T06:00:00Z","claim":{"metadata":{"name":"orders-db","namespace":"team-a"}},"composition":{"name":"xpostgresql-database-aws"},"conditions":[{"type":"Ready","status":"True","lastTransitionTime":"2026-10-15T05:00:00Z"},{"type":"Synced","status":"True"}],"resources":[{"name":"orders-db-rds","ready":"True","lateInitializedFields":[]}],"driftDetected":false}' "https://<kestra>/api/v1/<tenant>/executions/webhook/<namespace>/crossplane-composition-drift-claim-gate/<CLAIM_STATUS_WEBHOOK_KEY>"
    
  3. Re-post with Ready set to False and one resource carrying lateInitializedFields to watch the Switch take the NotReady branch, post to Slack, open the issue and fail the gate.

  4. Drop the conditions array entirely to see the Unavailable branch.

  5. Set require_all_resources_ready to false to prove a not ready child resource stops blocking while the late-initialized markers still block.

How to extend

  • Split drift markers into blocking and advisory lists so cosmetic late initialization can warn without failing every deploy, using a second Ready with warnings state.
  • Read the composition revisions with io.kestra.plugin.core.http.Request against the Kubernetes API and include the diff in the issue body.
  • Store the last clean marker set in the Kestra KV store and only escalate on markers that are new since the claim was last healthy.
  • Fan the gate across every claim with io.kestra.plugin.core.flow.ForEachItem over a claim list, each subflow classifying one claim.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.