From 4630363dddfb3463969652980ce37ca43c34d2e0 Mon Sep 17 00:00:00 2001 From: Chuck D'Antonio Date: Thu, 26 Oct 2023 13:29:56 -0700 Subject: [PATCH] Quick Hit Lab for CMX (initial skeleton) (#314) TL;DR ----- Sketches out an initial skeleton for a fast CMX lab Details ------- Creates the track structure and first challenge for a quick lab on CMX to use at Kubecon. This PR just gets those files in place to simplify working with the lab setup as the lab gets full developed. --- .../01-create-a-test-cluster/assignment.md | 38 +++++++++++++++++++ .../01-create-a-test-cluster/check-shell | 11 ++++++ .../01-create-a-test-cluster/cleanup-shell | 11 ++++++ .../01-create-a-test-cluster/setup-shell | 19 ++++++++++ .../01-create-a-test-cluster/solve-shell | 11 ++++++ instruqt/trying-out-cmx/config.yml | 5 +++ instruqt/trying-out-cmx/track.yml | 27 +++++++++++++ .../trying-out-cmx/track_scripts/setup-shell | 18 +++++++++ instruqt/trying-out-cmx/vendor/vendor.json | 7 ++++ 9 files changed, 147 insertions(+) create mode 100755 instruqt/trying-out-cmx/01-create-a-test-cluster/assignment.md create mode 100755 instruqt/trying-out-cmx/01-create-a-test-cluster/check-shell create mode 100755 instruqt/trying-out-cmx/01-create-a-test-cluster/cleanup-shell create mode 100755 instruqt/trying-out-cmx/01-create-a-test-cluster/setup-shell create mode 100755 instruqt/trying-out-cmx/01-create-a-test-cluster/solve-shell create mode 100644 instruqt/trying-out-cmx/config.yml create mode 100755 instruqt/trying-out-cmx/track.yml create mode 100755 instruqt/trying-out-cmx/track_scripts/setup-shell create mode 100755 instruqt/trying-out-cmx/vendor/vendor.json diff --git a/instruqt/trying-out-cmx/01-create-a-test-cluster/assignment.md b/instruqt/trying-out-cmx/01-create-a-test-cluster/assignment.md new file mode 100755 index 000000000..0ad04b967 --- /dev/null +++ b/instruqt/trying-out-cmx/01-create-a-test-cluster/assignment.md @@ -0,0 +1,38 @@ +--- +slug: create-a-test-cluster +id: znzkrjto96nr +type: challenge +title: Create a Test Cluster +teaser: A short description of the challenge. +notes: +- type: text + contents: Replace this text with your own text +tabs: +- title: Vendor Portal + type: website + url: https://vendor.replicated.com/compatibility-matrix/clusters + new_window: true +difficulty: basic +timelimit: 300 +--- + + +đź‘‹ Introducing the Comptibility Matrix +====================================== + +The Replicated Compatibility Matrix is a service for quickly and easily +spinning up ephemeral clusters for testing your application. You can manage +your clusters using the Replicated Vendor Portal. We also provide a command-line +interface and a series of GitHub actions to facilitate Continuous Delivery. + +Clusters Available +================== + +Let's use the Replicated Vendor Portal to understand the types of clusters +you can create for you testing. Click the "Vendor Portal" tab and log in with +the following credentials + +Username: `[[ Instruqt-Var key="USERNAME" hostname="shell" ]]`
+Password: `[[ Instruqt-Var key="PASSWORD" hostname="shell" ]]` + + diff --git a/instruqt/trying-out-cmx/01-create-a-test-cluster/check-shell b/instruqt/trying-out-cmx/01-create-a-test-cluster/check-shell new file mode 100755 index 000000000..8f9df0d6e --- /dev/null +++ b/instruqt/trying-out-cmx/01-create-a-test-cluster/check-shell @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script runs when the platform check the challenge. +# +# The platform determines if the script was successful using the exit code of this +# script. If the exit code is not 0, the script fails. +# + +echo "This is the check script" + +exit 0 diff --git a/instruqt/trying-out-cmx/01-create-a-test-cluster/cleanup-shell b/instruqt/trying-out-cmx/01-create-a-test-cluster/cleanup-shell new file mode 100755 index 000000000..3fab24155 --- /dev/null +++ b/instruqt/trying-out-cmx/01-create-a-test-cluster/cleanup-shell @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script runs when the platform cleanup the challenge. +# +# The platform determines if the script was successful using the exit code of this +# script. If the exit code is not 0, the script fails. +# + +echo "This is the cleanup script" + +exit 0 diff --git a/instruqt/trying-out-cmx/01-create-a-test-cluster/setup-shell b/instruqt/trying-out-cmx/01-create-a-test-cluster/setup-shell new file mode 100755 index 000000000..a3da48a0a --- /dev/null +++ b/instruqt/trying-out-cmx/01-create-a-test-cluster/setup-shell @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# This set line ensures that all failures will cause the script to error and exit +set -euxo pipefail + +HOME_DIR=/home/replicant + +# Wait for Instruqt bootstrap to be complete +while [ ! -f /opt/instruqt/bootstrap/host-bootstrap-completed ] +do + echo "Waiting for Instruqt to finish booting the VM" + sleep 1 +done + +# convenience library for Replicated lab lifecycle scripts +source /etc/profile.d/header.sh + +agent variable set USERNAME $(get_username) +agent variable set PASSWORD $(get_password) diff --git a/instruqt/trying-out-cmx/01-create-a-test-cluster/solve-shell b/instruqt/trying-out-cmx/01-create-a-test-cluster/solve-shell new file mode 100755 index 000000000..a182bdeed --- /dev/null +++ b/instruqt/trying-out-cmx/01-create-a-test-cluster/solve-shell @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This script runs when the platform solve the challenge. +# +# The platform determines if the script was successful using the exit code of this +# script. If the exit code is not 0, the script fails. +# + +echo "This is the solve script" + +exit 0 diff --git a/instruqt/trying-out-cmx/config.yml b/instruqt/trying-out-cmx/config.yml new file mode 100644 index 000000000..c970e1a00 --- /dev/null +++ b/instruqt/trying-out-cmx/config.yml @@ -0,0 +1,5 @@ +version: "3" +containers: +- name: shell + image: gcr.io/kots-field-labs/shell:latest + shell: tmux new-session -A -s shell su - replicant diff --git a/instruqt/trying-out-cmx/track.yml b/instruqt/trying-out-cmx/track.yml new file mode 100755 index 000000000..6594172ba --- /dev/null +++ b/instruqt/trying-out-cmx/track.yml @@ -0,0 +1,27 @@ +slug: trying-out-cmx +id: 1gpba3eivmb4 +title: Trying Out the Replicated Compability Matrix +teaser: |- + Learn how the Replicated Platform helps you prevent cluster compatibility + issue before you release to your customers +description: |2- + + What if you could automatically test your new releases on truly + customer-representative environments—same cloud provider, same Kubernetes + distribution and version, and even the same entitlements and configuration? + With the [Compatibility Matrix](https://www.replicated.com/test-compatibility-in-customer-representative-environments), + you can. +icon: https://storage.googleapis.com/shared-lab-assets/icons/red/connect.png +tags: +- prod +- builders-plan +- compatibility-matrix +- helm +owner: replicated +developers: +- chuck@replicated.com +lab_config: + overlay: false + width: 33 + position: right +checksum: "16262887100161909657" diff --git a/instruqt/trying-out-cmx/track_scripts/setup-shell b/instruqt/trying-out-cmx/track_scripts/setup-shell new file mode 100755 index 000000000..19726fbda --- /dev/null +++ b/instruqt/trying-out-cmx/track_scripts/setup-shell @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# This set line ensures that all failures will cause the script to error and exit +set -euxo pipefail + +# simple SSH client setup so we can SSH to/from the shell + +cat <> "$HOME/.ssh/config" +Host * + StrictHostKeyChecking no + UserKnownHostsFile /dev/null +EOF + +# assure an RSA key for Dropbear +ssh-keygen -t rsa -f /etc/dropbear/dropbear_rsa_host_key -N '' + +# use our shared libary in setup scripts +curl -s -o /etc/profile.d/header.sh https://raw.githubusercontent.com/replicatedhq/kots-field-labs/main/libs/header.sh diff --git a/instruqt/trying-out-cmx/vendor/vendor.json b/instruqt/trying-out-cmx/vendor/vendor.json new file mode 100755 index 000000000..ba5f5ff9a --- /dev/null +++ b/instruqt/trying-out-cmx/vendor/vendor.json @@ -0,0 +1,7 @@ +{ + "name": "Harbor", + "slug": "harbor", + "customer": "Omozan", + "yaml_dir": "", + "k8s_installer_yaml_path": "" +}