Skip to content

Commit 59e50f0

Browse files
committed
Address PR review comments
- Fix kubectl apply command: change -k to -f for single YAML file - Extract duplicate version logic to main() function - Remove OS-specific installation commands from prerequisites - Simplify check_prerequisites error messages Addresses feedback from PR kubernetes-sigs#5068
1 parent 213e149 commit 59e50f0

File tree

3 files changed

+14
-36
lines changed

3 files changed

+14
-36
lines changed

scripts/demo/README.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,33 +48,9 @@ make clean-demo
4848
## Prerequisites for Recording
4949

5050
- `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-
5951
- `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-
6652
- `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-
```
53+
- `svg-term`: For converting recordings to SVG (requires Node.js/npm)
7854

7955
## What the Demo Shows
8056

scripts/demo/generate-demo.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ check_prerequisites() {
4444
local missing_tools=()
4545

4646
if ! command -v asciinema &> /dev/null; then
47-
missing_tools+=("asciinema (install with: brew install asciinema)")
47+
missing_tools+=("asciinema")
4848
fi
4949

5050
if ! command -v svg-term &> /dev/null; then
51-
missing_tools+=("svg-term (install with: npm install -g svg-term-cli)")
51+
missing_tools+=("svg-term")
5252
fi
5353

5454
if ! command -v kind &> /dev/null; then
55-
missing_tools+=("kind (install with: brew install kind)")
55+
missing_tools+=("kind")
5656
fi
5757

5858
if ! command -v kubectl &> /dev/null; then
59-
missing_tools+=("kubectl (install from: https://kubernetes.io/docs/tasks/tools/install-kubectl/)")
59+
missing_tools+=("kubectl")
6060
fi
6161

6262
if [ ${#missing_tools[@]} -ne 0 ]; then
@@ -96,8 +96,7 @@ record_demo() {
9696

9797
convert_to_svg() {
9898
local recording_dir="/tmp/kb-demo-recording"
99-
local version
100-
version=$(git -C "$PROJECT_ROOT" describe --tags --abbrev=0 2>/dev/null || echo "v4.0.0")
99+
local version="$1"
101100
local svg_file="${PROJECT_ROOT}/docs/gif/kb-demo.${version}.svg"
102101

103102
log "Converting recording to SVG..."
@@ -113,8 +112,7 @@ convert_to_svg() {
113112
}
114113

115114
update_readme() {
116-
local version
117-
version=$(git -C "$PROJECT_ROOT" describe --tags --abbrev=0 2>/dev/null || echo "v4.0.0")
115+
local version="$1"
118116

119117
log "Updating README.md with new demo..."
120118
if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -137,11 +135,15 @@ cleanup() {
137135
main() {
138136
log "Starting Kubebuilder demo generation..."
139137

138+
# Extract version once to avoid duplication
139+
local version
140+
version=$(git -C "$PROJECT_ROOT" describe --tags --abbrev=0 2>/dev/null || echo "v4.0.0")
141+
140142
check_prerequisites
141143
setup_cluster
142144
record_demo
143-
convert_to_svg
144-
update_readme
145+
convert_to_svg "$version"
146+
update_readme "$version"
145147
cleanup
146148

147149
log "Demo generation completed successfully! 🎉"

scripts/demo/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ run "cat config/samples/webapp_v1_guestbook.yaml"
7474
clear
7575

7676
desc "Apply the sample resources to test our APIs"
77-
run "kubectl apply -k config/samples/webapp_v1alpha1_busybox.yaml --context kind-kubebuilder-demo"
77+
run "kubectl apply -f config/samples/webapp_v1alpha1_busybox.yaml --context kind-kubebuilder-demo"
7878

7979
desc "Check the created custom resources in the cluster"
8080
run "kubectl get guestbooks,busyboxes -A --context kind-kubebuilder-demo"

0 commit comments

Comments
 (0)