Skip to content

Commit

Permalink
Add a demo creation tool and an end-to-end demo (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchen8911 authored May 8, 2024
2 parents 5aefacc + e4d4065 commit eab45e8
Show file tree
Hide file tree
Showing 7 changed files with 514 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .xresources
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
!
! Copy from https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/Xresources/Darkside
!
*.foreground: #bababa
*.background: #222324
*.cursorColor: #bbbbbb
!
! Black
*.color0: #000000
*.color8: #000000
!
! Red
*.color1: #e8341c
*.color9: #e05a4f
!
! Green
*.color2: #68c256
*.color10: #77b869
!
! Yellow
*.color3: #f2d42c
*.color11: #efd64b
!
! Blue
*.color4: #1c98e8
*.color12: #387cd3
!
! Magenta
*.color5: #8e69c9
*.color13: #957bbe
!
! Cyan
*.color6: #1c98e8
*.color14: #3d97e2
!
! White
*.color7: #bababa
*.color15: #bababa
!
! Bold, Italic, Underline
*.colorBD: #ffffff
!*.colorIT:
!*.colorUL:
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,18 @@ image-build: build
.PHONY: image-push
image-push: image-build
$(DOCKER_BIN) push $(IMAGE_REPO):$(IMAGE_TAG)

.PRECIOUS: %.cast
%.cast: %.demo
@WORK_DIR=$(shell dirname $<) \
./hack/democtl.sh "$<" "$@" \
--ps1='\033[1;96m~/nvidia/knavigator\033[1;94m$$\033[0m '

.PRECIOUS: %.svg
%.svg: %.cast
@./hack/democtl.sh "$<" "$@" \
--term xresources \
--profile ./.xresources

%.mp4: %.cast
@./hack/democtl.sh "$<" "$@"
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ Alternatively, in server or package configurations, Knavigator can receive a ser

Regardless of the configuration mode, Knavigator executes tasks sequentially. Each task is dependent on the successful completion of the preceding one. Therefore, if any task fails during execution, the entire test is marked as failed. This ensures comprehensive testing and accurate reporting of results, maintaining the integrity of the testing process.

### Demo

Here's a demo showing how to install and configure `Knavigator`, and run an example test that deploys a k8s job in a `minikube` cluster.

<p align="center">
<img width="800" src="./demos/basic.svg">
</p>

### Documentation

- [Deployment](docs/deployment.md)
Expand Down
31 changes: 31 additions & 0 deletions demos/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2022 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

.PRECIOUS: %.cast
%.cast: %.demo
make -C .. ./demo/$@

.PRECIOUS: %.svg
%.svg: %.cast
make -C .. ./demo/$@

%.mp4: %.svg
make -C .. ./demo/$@

.PHONY: all
all: $(patsubst %.demo,%.svg,$(wildcard *.demo))

.PHONY: clean
clean:
@-rm -f *.svg
35 changes: 35 additions & 0 deletions demos/basic.demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Demo: how to install, configure and use Knvavigator in a local k8s cluster, such as minikube or KinD

# Show the cluster infomation
kubectl cluster-info

kubectl get nodes

# Install KWOK node simulator

KWOK_REPO=kubernetes-sigs/kwok
KWOK_LATEST_RELEASE="v0.5.2"
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwok.yaml"
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/stage-fast.yaml"
kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-init-container-running-failed.yaml
kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-container-running-failed.yaml

# Add virtual nodes to the cluster
helm install virtual-nodes charts/virtual-nodes -f charts/virtual-nodes/values-example.yaml
kubectl get nodes

# Build Knavigator
make build

# Run Knavigator with an example test
kubectl create ns k8s-test
./bin/knavigator --tasks resources/tests/k8s/test-job.yml

# Show the job running
kubectl get job -n k8s-test

# Clean up
kubectl delete job job1 -n k8s-test
kubectl delete ns k8s-test

# That's it. Thank you!
1 change: 1 addition & 0 deletions demos/basic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eab45e8

Please sign in to comment.