|
1 |
| -This directory contains scripts to run a quick demo of Kubebuilder. |
| 1 | +# Kubebuilder Demo |
2 | 2 |
|
3 |
| -Steps to run demo: |
| 3 | +This directory contains scripts to run a comprehensive demo of Kubebuilder features with a local Kind cluster. |
| 4 | + |
| 5 | +## Quick Demo (Manual) |
| 6 | + |
| 7 | +To run the demo manually: |
4 | 8 |
|
5 | 9 | ```sh
|
6 | 10 | mkdir /tmp/kb-demo
|
7 | 11 | cd /tmp/kb-demo
|
8 |
| -DEMO_AUTO_RUN=1 ./run.sh |
| 12 | +DEMO_AUTO_RUN=1 /path/to/kubebuilder/scripts/demo/run.sh |
| 13 | +``` |
| 14 | + |
| 15 | +## Automated Demo Recording |
| 16 | + |
| 17 | +To automatically record and update the demo using Asciinema: |
| 18 | + |
| 19 | +```sh |
| 20 | +# From the root of the Kubebuilder repository |
| 21 | +make update-demo |
| 22 | +``` |
| 23 | + |
| 24 | +This will: |
| 25 | +1. Check for required dependencies (asciinema, svg-term, kind, kubectl) |
| 26 | +2. Set up a Kind cluster for the demo |
| 27 | +3. Record the demo session automatically |
| 28 | +4. Convert the recording to SVG format |
| 29 | +5. Update the demo file in `docs/gif/kb-demo.${VERSION}.svg` |
| 30 | +6. Clean up temporary files |
| 31 | + |
| 32 | +## Setup Demo Cluster Only |
| 33 | + |
| 34 | +If you just want to set up the Kind cluster for testing: |
9 | 35 |
|
| 36 | +```sh |
| 37 | +make setup-demo-cluster |
10 | 38 | ```
|
11 | 39 |
|
12 |
| -Instructions for producing the demo movie: |
| 40 | +## Clean Up Demo Cluster |
| 41 | + |
| 42 | +To remove the demo Kind cluster when done: |
13 | 43 |
|
14 | 44 | ```sh
|
| 45 | +make clean-demo |
| 46 | +``` |
| 47 | + |
| 48 | +## Prerequisites for Recording |
| 49 | + |
| 50 | +- `kind`: For creating local Kubernetes clusters |
| 51 | + ```sh |
| 52 | + # macOS |
| 53 | + brew install kind |
| 54 | + # Linux |
| 55 | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64 |
| 56 | + chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind |
| 57 | + ``` |
| 58 | + |
| 59 | +- `kubectl`: For interacting with Kubernetes |
| 60 | + ```sh |
| 61 | + # macOS |
| 62 | + brew install kubectl |
| 63 | + # Other platforms: https://kubernetes.io/docs/tasks/tools/install-kubectl/ |
| 64 | + ``` |
| 65 | + |
| 66 | +- `asciinema`: For recording terminal sessions |
| 67 | + ```sh |
| 68 | + # macOS |
| 69 | + brew install asciinema |
| 70 | + # Ubuntu/Debian |
| 71 | + sudo apt-get install asciinema |
| 72 | + ``` |
| 73 | + |
| 74 | +- `svg-term`: For converting recordings to SVG |
| 75 | + ```sh |
| 76 | + npm install -g svg-term-cli |
| 77 | + ``` |
| 78 | + |
| 79 | +## What the Demo Shows |
| 80 | + |
| 81 | +The current demo showcases: |
| 82 | + |
| 83 | +1. **Cluster Setup**: Creates a local Kind cluster for testing |
| 84 | +2. **Installation**: Installing Kubebuilder from scratch |
| 85 | +3. **Project Initialization**: Creating a new operator project |
| 86 | +4. **API Creation**: Creating APIs with validation markers |
| 87 | +5. **Plugin System**: Using the deploy-image plugin |
| 88 | +6. **Modern Features**: |
| 89 | + - Validation markers (`+kubebuilder:validation`) |
| 90 | + - Multiple APIs in one project |
| 91 | + - Generated CRDs with OpenAPI schemas |
| 92 | + - Sample resource management |
| 93 | +7. **Development Workflow**: Install CRDs, apply samples, run controller |
| 94 | +8. **Cluster Integration**: Full integration with Kubernetes cluster |
| 95 | + |
| 96 | +## Manual Recording Instructions (Legacy) |
| 97 | + |
| 98 | +If you prefer to record manually: |
| 99 | + |
| 100 | +```sh |
| 101 | +# Set up Kind cluster first |
| 102 | +./scripts/demo/setup-kind.sh |
15 | 103 |
|
16 | 104 | # Create temporary directory
|
17 | 105 | mkdir /tmp/kb-demo
|
18 | 106 | cd /tmp/kb-demo
|
19 | 107 |
|
20 |
| -asciinema rec |
21 |
| -<path-to-KB-repo>/scripts/demo/run.sh |
22 |
| - |
23 |
| -# After each step, press <Enter> to proceed to the next step |
| 108 | +# Start recording |
| 109 | +asciinema rec --title "Kubebuilder Demo" kb-demo.cast |
24 | 110 |
|
25 |
| -<CTRL-C> to terminate the script |
26 |
| -<CTRL-D> to terminate the asciinema recording |
27 |
| -<CTRL-C> to save the recording locally |
| 111 | +# Run the demo script |
| 112 | +DEMO_AUTO_RUN=1 /path/to/kubebuilder/scripts/demo/run.sh |
28 | 113 |
|
29 |
| -# Edit the recorded file by editing the controller-gen path |
30 |
| -# Once you are happy with the recording, use svg-term program to generate the svg |
| 114 | +# Stop recording with Ctrl+C when done |
| 115 | +# Convert to SVG |
| 116 | +svg-term --in=kb-demo.cast --out=kb-demo.svg --window --width=120 --height=30 |
31 | 117 |
|
32 |
| -svg-term --in=<cast-file-path> --out demo.svg --window |
| 118 | +# Clean up when done |
| 119 | +kind delete cluster --name kubebuilder-demo |
33 | 120 | ```
|
0 commit comments