Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,24 @@ tasks:
- kubectl -n {{.DOCS_NS}} rollout status deploy/docs --timeout=180s
- 'echo " docs now served from this branch at http://localhost:8080/"'

solo:validator-image:
desc: "Build this branch's validator image and serve it from the solo cluster."
# The docs Pod runs the validator as a sidecar, and `solo:platform`
# deploys the published `:latest` — so a branch that changes the
# validator (a new check, a new /api endpoint) is invisible in solo
# until you swap the image in. Same :dev tag + IfNotPresent trick as
# solo:docs-image, patched into the `validator` container of the same
# Deployment.
cmds:
- docker build -t crossplane-workshop-validator:dev validator/
- k3d image import crossplane-workshop-validator:dev -c {{.SOLO_CLUSTER_NAME}}
- |
kubectl -n {{.DOCS_NS}} patch deploy docs --type=strategic -p \
'{"spec":{"template":{"spec":{"containers":[{"name":"validator","image":"crossplane-workshop-validator:dev","imagePullPolicy":"IfNotPresent"}]}}}}'
- kubectl -n {{.DOCS_NS}} rollout restart deploy/docs
- kubectl -n {{.DOCS_NS}} rollout status deploy/docs --timeout=180s
- 'echo " validator now served from this branch at http://localhost:8080/api/"'

solo:verify:
desc: "Smoke check the solo stack: Envoy Gateway ready, docs pod ready, / and /api/pairs respond."
cmds:
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/04-crossplane-101/02-create-your-project.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ metadata:
namespace: default
spec:
message: "Hello from our platform"
color: "#2563eb"
backgroundColor: "#2563eb"
EOF
```

Expand All @@ -95,11 +95,11 @@ That path is relative to `apis/`, so the file is at `apis/applications/definitio
```yaml
message:
type: string
color:
backgroundColor:
type: string
```

The CLI reads shapes, not intent. It saw two strings and wrote two strings — it has no way to know that `message` should be required or that `color` should carry a default. Those are decisions you add by hand once the shape is right, and `apis/applications/definition.yaml` is now yours to edit.
The CLI reads shapes, not intent. It saw two strings and wrote two strings — it has no way to know that `message` should be required or that `backgroundColor` should carry a default. Those are decisions you add by hand once the shape is right, and `apis/applications/definition.yaml` is now yours to edit.

## 2.3 What just happened

Expand Down
46 changes: 31 additions & 15 deletions docs/docs/04-crossplane-101/03-define-application.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Your `Application` API exists but produces nothing. A **Composition** is the rec
A Composition runs a **pipeline** of functions. You will use `function-patch-and-transform`, which takes a list of resources to create and lets you patch values from the XR into them.

<ThemedImage
alt="One Application XR, carrying spec.message and spec.color, fans out into six composed resources: a ConfigMap, Deployment and Service for both frontend and backend."
alt="One Application XR, carrying spec.message and spec.backgroundColor, fans out into six composed resources: a ConfigMap, Deployment and Service for both frontend and backend."
sources={{
light: useBaseUrl('/diagrams/define-application-fanout-light.svg'),
dark: useBaseUrl('/diagrams/define-application-fanout-dark.svg'),
Expand Down Expand Up @@ -93,8 +93,10 @@ spec:
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Tile</title>
<style>
body { font-family: sans-serif; margin: 0; padding: 20px; text-align: center; }
#title { font-size: 2rem; font-weight: 700; }
html, body { height: 100%; }
body { font-family: sans-serif; margin: 0; padding: 5%; box-sizing: border-box;
display: flex; align-items: center; justify-content: center; text-align: center; }
#title { font-size: clamp(1rem, min(10vw, 22vh), 6rem); font-weight: 700; line-height: 1.1; }
</style>
</head><body>
<div id="title">Loading...</div>
Expand All @@ -106,7 +108,12 @@ spec:
const d = JSON.parse(txt);
const el = document.getElementById('title');
el.innerText = d.message || '(no message)';
if (d.color) el.style.color = d.color;
if (d.backgroundColor) {
document.body.style.background = d.backgroundColor;
const n = parseInt(d.backgroundColor.slice(1), 16);
const bright = ((n >> 16 & 255) * 299 + (n >> 8 & 255) * 587 + (n & 255) * 114) / 255000;
el.style.color = bright > 0.6 ? '#1e293b' : '#ffffff';
}
} catch (e) {
document.getElementById('title').innerText = 'Bad response: ' + txt;
}
Expand Down Expand Up @@ -172,18 +179,18 @@ spec:
name: backend
namespace: default
data:
message: '{"message":"placeholder","color":"#2563eb"}'
message: '{"message":"placeholder","backgroundColor":"#2563eb"}'
readinessChecks:
- type: None
patches:
- type: CombineFromComposite
combine:
variables:
- fromFieldPath: spec.message
- fromFieldPath: spec.color
- fromFieldPath: spec.backgroundColor
strategy: string
string:
fmt: '{"message":"%s","color":"%s"}'
fmt: '{"message":"%s","backgroundColor":"%s"}'
toFieldPath: data.message
- name: backend-deployment
base:
Expand Down Expand Up @@ -278,8 +285,10 @@ spec:
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Tile</title>
<style>
body { font-family: sans-serif; margin: 0; padding: 20px; text-align: center; }
#title { font-size: 2rem; font-weight: 700; }
html, body { height: 100%; }
body { font-family: sans-serif; margin: 0; padding: 5%; box-sizing: border-box;
display: flex; align-items: center; justify-content: center; text-align: center; }
#title { font-size: clamp(1rem, min(10vw, 22vh), 6rem); font-weight: 700; line-height: 1.1; }
</style>
</head><body>
<div id="title">Loading...</div>
Expand All @@ -291,7 +300,12 @@ spec:
const d = JSON.parse(txt);
const el = document.getElementById('title');
el.innerText = d.message || '(no message)';
if (d.color) el.style.color = d.color;
if (d.backgroundColor) {
document.body.style.background = d.backgroundColor;
const n = parseInt(d.backgroundColor.slice(1), 16);
const bright = ((n >> 16 & 255) * 299 + (n >> 8 & 255) * 587 + (n & 255) * 114) / 255000;
el.style.color = bright > 0.6 ? '#1e293b' : '#ffffff';
}
} catch (e) {
document.getElementById('title').innerText = 'Bad response: ' + txt;
}
Expand All @@ -305,7 +319,9 @@ spec:
- type: None
```

The page's `<script>` fetches `./api/message`, parses the JSON, and writes the `message` into the tile in the requested `color`. Every `Application` ships the same HTML — no patch needed.
The page's `<script>` fetches `./api/message`, parses the JSON, writes the `message` into the tile and paints the page in the requested `backgroundColor`, picking dark or light type so the text stays readable against it. Every `Application` ships the same HTML — no patch needed.

The sizes are relative on purpose. This page is viewed at two very different scales — full-window at `/team/<your pair ID>/`, and shrunk into a tile on the workshop wall — and fixed pixel sizes look like two different designs at those two sizes. Centring with flexbox and sizing the text in `vw`/`vh` makes it fill whatever box it is given, so both views match.

`readinessChecks: type: None` is the right choice for ConfigMaps because they expose no Ready condition. Crossplane treats them as Ready as soon as it observes them.

Expand Down Expand Up @@ -380,22 +396,22 @@ Cluster-internal Service on port 80, selected by `app: frontend`. The workshop's
name: backend
namespace: default
data:
message: '{"message":"placeholder","color":"#2563eb"}'
message: '{"message":"placeholder","backgroundColor":"#2563eb"}'
readinessChecks:
- type: None
patches:
- type: CombineFromComposite
combine:
variables:
- fromFieldPath: spec.message
- fromFieldPath: spec.color
- fromFieldPath: spec.backgroundColor
strategy: string
string:
fmt: '{"message":"%s","color":"%s"}'
fmt: '{"message":"%s","backgroundColor":"%s"}'
toFieldPath: data.message
```

This is the interesting one. The patch's `CombineFromComposite` reads `spec.message` and `spec.color` from the XR, fills them into the `printf`-style template, and writes the result into `data.message` — so the ConfigMap that started as a hard-coded `"placeholder"` ends up holding the JSON the XR asked for.
This is the interesting one. The patch's `CombineFromComposite` reads `spec.message` and `spec.backgroundColor` from the XR, fills them into the `printf`-style template, and writes the result into `data.message` — so the ConfigMap that started as a hard-coded `"placeholder"` ends up holding the JSON the XR asked for.

`toFieldPath` is a path inside the naked `ConfigMap` body. Compare to module 4's `Object`-MR shape, which would have prefixed it with `spec.forProvider.manifest.data.message`; here the composed resource *is* the ConfigMap, so there is no MR envelope to step through.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/04-crossplane-101/04-iterate-locally.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ kind: Deployment name: frontend
kind: Service name: frontend port: 80
```

Check the frontend ConfigMap: the `message` from your example `Application` should appear in the HTML. That is the patch doing its job — a field on your API reaching a file inside a container.
Check the **backend** ConfigMap: the `message` from your example `Application` should appear in its JSON. That is the patch doing its job — a field on your API reaching a file inside a container. The frontend ConfigMap holds only static HTML; it fetches that JSON at runtime, which is why your message is not in it.

Change `message` in `examples/applications/hello.yaml`, render again, and watch the output follow. That round trip is a couple of seconds, against the minutes a cluster round trip costs.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/05-crossplane-2xx/03-crossplane-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ metadata:
namespace: default
spec:
message: "rendered, not applied"
color: "#a855f7"
backgroundColor: "#a855f7"
EOF
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 1
slug: /
title: Introduzione
translation_source_commit: 35e86a2a69d7e2d37b8de8f35405e83b9ab052f7
translation_source_commit: c4574ba71e7f3d7f48102a9e655e4e6cf385fb5b
---

import PairId from '@site/src/components/PairId';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar_position: 3
title: Connetti il tuo cluster
translation_source_commit: 36d2988a9b372e4f2a7b06f5f10d8b8931cb7248
translation_source_commit: c4574ba71e7f3d7f48102a9e655e4e6cf385fb5b
---

import PairId from '@site/src/components/PairId';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar_position: 7
title: Riepilogo
translation_source_commit: ec096082dd06bc32f57ed746568e2c2677280945
translation_source_commit: 08f423c7233e286877bf502e5de79de3a57e42d7
---

# Crossplane 101 — Riepilogo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Crossplane Operations
ai_edit: locked
ai_edit_reviewed: 2026-04-28
ai_edit_reviewer: ricCap
translation_source_commit: a9e386a2f7abd13fb73f6fb97b8be37ae9cedac5
translation_source_commit: c4574ba71e7f3d7f48102a9e655e4e6cf385fb5b
---

import PairId from '@site/src/components/PairId';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar_position: 3
title: (Guidato) Usa la CLI Crossplane
translation_source_commit: dc7fee841463a55b25c4436dab1f03a0a33e9d34
translation_source_commit: 08f423c7233e286877bf502e5de79de3a57e42d7
---

import PairId from '@site/src/components/PairId';
Expand Down Expand Up @@ -93,7 +93,7 @@ metadata:
namespace: default
spec:
message: "rendered, not applied"
color: "#a855f7"
backgroundColor: "#a855f7"
EOF
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar_position: 5
title: Componi con altre function
translation_source_commit: 03cb09ed6bd595e0c9998d09d89c5079f65304ff
translation_source_commit: c4574ba71e7f3d7f48102a9e655e4e6cf385fb5b
---

import PairId from '@site/src/components/PairId';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar_position: 5
title: (Guidato) Testa la tua Composition localmente
translation_source_commit: 03cb09ed6bd595e0c9998d09d89c5079f65304ff
translation_source_commit: c4574ba71e7f3d7f48102a9e655e4e6cf385fb5b
---

import PairId from '@site/src/components/PairId';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebar_position: 6
title: Aggiungi un Provider
translation_source_commit: 4a079a6201d4827ea3ae283f88652c3bc04d2445
translation_source_commit: c4574ba71e7f3d7f48102a9e655e4e6cf385fb5b
---

import PairId from '@site/src/components/PairId';
Expand Down
Loading
Loading