Skip to main content

Modify your Application ⏱️ 20m

Your pair:
Running solo locally?

Same commands. Your tile is at /team/local/. See Solo local setup (k3d).

6.1 Before you start ⏱️ 3m

So far your Composition is static: every XApplication produces the same HTML layout, the same fonts, the same page structure. In this module you'll edit the Composition and watch your tile update without re-applying the XR.

That's the point of composition: the abstraction (XApplication) survives, the implementation (the resources behind it) changes. Platform teams do this all the time — adding sidecar containers, swapping base images, tightening security defaults — and consumers never notice.

You're about to: edit the Composition in place, see the downstream ConfigMap update, refresh the tile.

6.2 Reshape the frontend ⏱️ 15m

1. Open the Composition for editing

kubectl edit composition xapplications.workshop.example.io

Find the frontend-configmap resource (the first one under spec.pipeline[0].input.resources) and modify the HTML inside base.data.index.html.

2. Pick at least one change

Any of these work, pick the one you like:

  • Add a subtitle under the <div id="tile">:
    <div id="subtitle" style="font-size: 1rem; color: #6b7280;">hello from my XRD</div>
  • Change the background color:
    body { background: #fef3c7; font-family: sans-serif; margin: 0; padding: 20px; text-align: center; }
  • Add emoji, a border, a gradient — anything inline CSS can do inside one ConfigMap.

Save and exit the editor.

3. Watch Crossplane reconcile

Crossplane reconciles immediately: the desired ConfigMap from the function's output is updated, and Crossplane core applies the patch in place. Confirm:

kubectl get configmap frontend -n default -o jsonpath='{.data.index\.html}' | head -20

You should see your edit in the output.

4. Make nginx pick up the change

nginx reads /usr/share/nginx/html/index.html on every request, but the ConfigMap projection inside the Pod only refreshes every ~30 seconds (kubelet's periodic sync). Bounce the frontend Pod to see your change immediately:

kubectl rollout restart deployment frontend

5. Refresh the tile

Open the workshop wall in a new tab and click Refresh. Your tile should show the new HTML / CSS you edited. Your XApplication XR is still wall-tile, untouched — the change came from reshaping the Composition.

The check is still green because none of the conditions it watches have changed — the XApplication is still Ready. That's the point.

6.3 What just happened

You changed the platform without changing the consumer. The XApplication YAML the user applied is identical; the five resources it produces are different. In a real platform this is how you roll out security patches, new defaults, observability sidecars, or cost-saving changes — all invisible to the teams using the API.

Go deeper

  • Stretch: add a field. Add subtitle to the XRD (with a default), patch it through the Composition into a new ConfigMap key or a backend env var, and apply a fresh XR that sets it. Good sandbox for the last ten minutes.
  • Composition revisions — how Crossplane keeps old Compositions around so existing XRs stay stable while new ones pick up the new recipe.
  • Composition functions cataloguefunction-kcl, function-go-templating, function-auto-ready — patterns for moving beyond patch-and-transform once you need more logic.