diff --git a/Taskfile.yml b/Taskfile.yml index be958a3..70e10e4 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -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: diff --git a/docs/docs/04-crossplane-101/02-create-your-project.mdx b/docs/docs/04-crossplane-101/02-create-your-project.mdx index ae2126d..2e5126f 100644 --- a/docs/docs/04-crossplane-101/02-create-your-project.mdx +++ b/docs/docs/04-crossplane-101/02-create-your-project.mdx @@ -76,7 +76,7 @@ metadata: namespace: default spec: message: "Hello from our platform" - color: "#2563eb" + backgroundColor: "#2563eb" EOF ``` @@ -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 diff --git a/docs/docs/04-crossplane-101/03-define-application.mdx b/docs/docs/04-crossplane-101/03-define-application.mdx index 419969c..44c8116 100644 --- a/docs/docs/04-crossplane-101/03-define-application.mdx +++ b/docs/docs/04-crossplane-101/03-define-application.mdx @@ -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. Tile
Loading...
@@ -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; } @@ -172,7 +179,7 @@ spec: name: backend namespace: default data: - message: '{"message":"placeholder","color":"#2563eb"}' + message: '{"message":"placeholder","backgroundColor":"#2563eb"}' readinessChecks: - type: None patches: @@ -180,10 +187,10 @@ spec: 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: @@ -278,8 +285,10 @@ spec: Tile
Loading...
@@ -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; } @@ -305,7 +319,9 @@ spec: - type: None ``` -The page's `