Skip to content

Commit

Permalink
🌱 updates to enable autogenerated demo, hosted out-of-tree (#212)
Browse files Browse the repository at this point in the history
* updates to support automated demo generation

Signed-off-by: Jordan Keister <jordan@nimblewidget.com>

* review updates

Signed-off-by: Jordan Keister <jordan@nimblewidget.com>

---------

Signed-off-by: Jordan Keister <jordan@nimblewidget.com>
  • Loading branch information
grokspawn committed Nov 29, 2023
1 parent 093cae4 commit 10a0803
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 40 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,8 @@ release: $(GORELEASER) ## Runs goreleaser for catalogd. By default, this will ru

quickstart: $(KUSTOMIZE) generate ## Generate the installation release manifests and scripts
$(KUSTOMIZE) build config/default | sed "s/:devel/:$(GIT_VERSION)/g" > catalogd.yaml

.PHONY: demo-update
demo-update:
hack/scripts/generate-asciidemo.sh

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ Catalogd is a Kubernetes extension that unpacks [file-based catalog (FBC)](https

Catalogd helps customers discover installable content by hosting catalog metadata for Kubernetes extensions, such as Operators and controllers. For more information on the Operator Lifecycle Manager (OLM) v1 suite of microservices, see the [documentation](https://github.com/operator-framework/operator-controller/tree/main/docs) for the Operator Controller.

## Quick start
## Quickstart DEMO
[![asciicast](https://asciinema.org/a/623959.svg)](https://asciinema.org/a/623959)

## Quickstart Steps
**NOTE:** Procedure steps marked with an asterisk (`*`) are likely to change with future API updates.

1. To install catalogd, navigate to the [releases](https://github.com/operator-framework/catalogd/releases/) page, and follow the install instructions included in the release you want to install.
Expand Down
Binary file removed docs/demo.gif
Binary file not shown.
31 changes: 31 additions & 0 deletions hack/scripts/demo-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
# Welcome to the catalogd demo
make kind-cluster-cleanup
kind delete cluster
make kind-cluster
kubectl cluster-info --context kind-catalogd
sleep 10
make install
sleep 10
# inspect crds (catalog)
kubectl get crds -A

# create a catalog
kubectl apply -f config/samples/core_v1alpha1_catalog.yaml
# shows catalog-sample
kubectl get catalog -A
# waiting for catalog to report ready status
time kubectl wait --for=condition=Unpacked catalog/operatorhubio --timeout=1m

# port forward the catalogd-catalogserver service to interact with the HTTP server serving catalog contents
(kubectl -n catalogd-system port-forward svc/catalogd-catalogserver 8080:80)&

# check what 'packages' are available in this catalog
curl http://localhost:8080/catalogs/operatorhubio/all.json | jq -s '.[] | select(.schema == "olm.package") | .name'
# check what channels are included in the wavefront package
curl http://localhost:8080/catalogs/operatorhubio/all.json | jq -s '.[] | select(.schema == "olm.channel") | select(.package == "wavefront") | .name'
# check what bundles are included in the wavefront package
curl http://localhost:8080/catalogs/operatorhubio/all.json | jq -s '.[] | select(.schema == "olm.bundle") | select(.package == "wavefront") | .name'

77 changes: 38 additions & 39 deletions hack/scripts/generate-asciidemo.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
#!/usr/bin/env bash
# run against a local copy of https://github.com/grokspawn/asciidemo-tools
# ../asciidemo-tools/generate-gif.sh hack/scripts/generate-asciidemo.sh docs/demo.gif

set -v

trap cleanup SIGINT SIGTERM EXIT

SCRIPTPATH="$( cd -- "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"

ASCIIDEMO_TOOLS=../asciidemo-tools/demo-functions.sh
REPO="https://github.com/operator-framework/catalogd"

. $ASCIIDEMO_TOOLS

function run() {
typeline -x "# Welcome to the catalogd demo"
typeline "make kind-cluster-cleanup"
typeline "kind delete cluster"
typeline "make kind-cluster"
typeline "kubectl cluster-info --context kind-catalogd"
sleep 10
typeline "make install"
sleep 10
# inspect crds (catalog)
typeline 'kubectl get crds -A'

typeline -x "# create a catalog"
typeline "kubectl apply -f config/samples/core_v1alpha1_catalog.yaml" # or other
typeline "kubectl get catalog -A" # shows catalog-sample
typeline -x "# waiting for catalog to report ready status"
typeline "time kubectl wait --for=condition=Unpacked catalog/operatorhubio --timeout=1h"

# port forward the catalogd-catalogserver service
typeline -x "# port forward the catalogd-catalogserver service to interact with the HTTP server serving catalog contents"
typline "kubectl -n catalogd-system port-forward svc/catalogd-catalogserver 8080:80"

# inspect packages
typeline -x "# check what 'packages' are available in this catalog"
typeline "curl http://localhost:8080/catalogs/operatorhubio/all.json | jq -s '.[] | select(.schema == \"olm.package\") | .name'"
# inspect channels
typeline -x "# check what channels are included in the wavefront package"
typeline "curl http://localhost:8080/catalogs/operatorhubio/all.json | jq -s '.[] | select(.schema == \"olm.channel\") | select(.package == \"wavefront\") | .name'"
# inspect bundles
typeline -x "# check what bundles are included in the wavefront package"
typeline "curl http://localhost:8080/catalogs/operatorhubio/all.json | jq -s '.[] | select(.schema == \"olm.bundle\") | select(.package == \"ack-acm-controller\") | .name'"
function check_prereq() {
prog=$1
if ! command -v ${prog} &> /dev/null
then
echo "unable to find prerequisite: $1"
exit 1
fi
}

run
function cleanup() {
if [ -d $WKDIR ]
then
rm -rf $WKDIR
fi
}


WKDIR=$(mktemp -td generate-asciidemo.XXXXX)
if [ ! -d ${WKDIR} ]
then
echo "unable to create temporary workspace"
exit 2
fi

for prereq in "asciinema curl"
do
check_prereq ${prereq}
done


curl https://raw.githubusercontent.com/zechris/asciinema-rec_script/main/bin/asciinema-rec_script -o ${WKDIR}/asciinema-rec_script
chmod +x ${WKDIR}/asciinema-rec_script
screencast=${WKDIR}/catalogd-demo.cast ${WKDIR}/asciinema-rec_script ${SCRIPTPATH}/demo-script.sh

asciinema upload ${WKDIR}/catalogd-demo.cast

0 comments on commit 10a0803

Please sign in to comment.