|  | 
| 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 | +   | 
|  | 55 | +  # Linux | 
|  | 56 | +  curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64 | 
|  | 57 | +  chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind | 
|  | 58 | +  ``` | 
|  | 59 | + | 
|  | 60 | +- `kubectl`: For interacting with Kubernetes | 
|  | 61 | +  ```sh | 
|  | 62 | +  # macOS | 
|  | 63 | +  brew install kubectl | 
|  | 64 | +   | 
|  | 65 | +  # Other platforms: https://kubernetes.io/docs/tasks/tools/install-kubectl/ | 
|  | 66 | +  ``` | 
|  | 67 | + | 
|  | 68 | +- `asciinema`: For recording terminal sessions | 
|  | 69 | +  ```sh | 
|  | 70 | +  # macOS | 
|  | 71 | +  brew install asciinema | 
|  | 72 | +   | 
|  | 73 | +  # Ubuntu/Debian | 
|  | 74 | +  sudo apt-get install asciinema | 
|  | 75 | +  ``` | 
|  | 76 | + | 
|  | 77 | +- `svg-term`: For converting recordings to SVG | 
|  | 78 | +  ```sh | 
|  | 79 | +  npm install -g svg-term-cli | 
|  | 80 | +  ``` | 
|  | 81 | + | 
|  | 82 | +## What the Demo Shows | 
|  | 83 | + | 
|  | 84 | +The current demo showcases: | 
|  | 85 | + | 
|  | 86 | +1. **Cluster Setup**: Creates a local Kind cluster for testing | 
|  | 87 | +2. **Installation**: Installing Kubebuilder from scratch | 
|  | 88 | +3. **Project Initialization**: Creating a new operator project | 
|  | 89 | +4. **API Creation**: Creating APIs with validation markers | 
|  | 90 | +5. **Plugin System**: Using the deploy-image plugin | 
|  | 91 | +6. **Modern Features**:  | 
|  | 92 | +   - Validation markers (`+kubebuilder:validation`) | 
|  | 93 | +   - Multiple APIs in one project | 
|  | 94 | +   - Generated CRDs with OpenAPI schemas | 
|  | 95 | +   - Sample resource management | 
|  | 96 | +7. **Development Workflow**: Install CRDs, apply samples, run controller | 
|  | 97 | +8. **Cluster Integration**: Full integration with Kubernetes cluster | 
|  | 98 | + | 
|  | 99 | +## Manual Recording Instructions (Legacy) | 
|  | 100 | + | 
|  | 101 | +If you prefer to record manually: | 
|  | 102 | + | 
|  | 103 | +```sh | 
|  | 104 | +# Set up Kind cluster first | 
|  | 105 | +./scripts/demo/setup-kind.sh | 
| 15 | 106 | 
 | 
| 16 | 107 | # Create temporary directory | 
| 17 | 108 | mkdir /tmp/kb-demo | 
| 18 | 109 | cd /tmp/kb-demo | 
| 19 | 110 | 
 | 
| 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 | 
|  | 111 | +# Start recording | 
|  | 112 | +asciinema rec --title "Kubebuilder Demo" kb-demo.cast | 
| 24 | 113 | 
 | 
| 25 |  | -<CTRL-C> to terminate the script | 
| 26 |  | -<CTRL-D> to terminate the asciinema recording | 
| 27 |  | -<CTRL-C> to save the recording locally | 
|  | 114 | +# Run the demo script | 
|  | 115 | +DEMO_AUTO_RUN=1 /path/to/kubebuilder/scripts/demo/run.sh | 
| 28 | 116 | 
 | 
| 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 | 
|  | 117 | +# Stop recording with Ctrl+C when done | 
|  | 118 | +# Convert to SVG | 
|  | 119 | +svg-term --in=kb-demo.cast --out=kb-demo.svg --window --width=120 --height=30 | 
| 31 | 120 | 
 | 
| 32 |  | -svg-term --in=<cast-file-path> --out demo.svg --window | 
|  | 121 | +# Clean up when done | 
|  | 122 | +kind delete cluster --name kubebuilder-demo | 
| 33 | 123 | ``` | 
0 commit comments