Skip to content

Commit

Permalink
Initial files.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Aug 12, 2024
0 parents commit b70d30f
Show file tree
Hide file tree
Showing 24 changed files with 899 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/publish-workshops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Publish Workshops

on:
push:
tags:
- "[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+-alpha.[0-9]+"
- "[0-9]+.[0-9]+-beta.[0-9]+"
- "[0-9]+.[0-9]+-rc.[0-9]+"
branches:
- main
- develop
workflow_dispatch:

jobs:
publish-workshops:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Carvel tools
shell: bash
run: curl -L https://carvel.dev/install.sh | bash

- name: Install Educates CLI
shell: bash
run: |
imgpkg pull -i ghcr.io/vmware-tanzu-labs/educates-client-programs:2.7.2 -o /tmp/client-programs
mv /tmp/client-programs/educates-linux-amd64 /usr/local/bin/educates
- name: Setup repository variables and release details
shell: bash
run: |
REPOSITORY_NAME=${{github.event.repository.name}}
echo "REPOSITORY_NAME=${REPOSITORY_NAME,,}" >>${GITHUB_ENV}
echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
echo "REPOSITORY_TAG=${GITHUB_REF##*/}" >>${GITHUB_ENV}
- name: Publish workshops and create workshop definitions
shell: bash
run: |
for WORKSHOP_DIRECTORY in workshops/*; do
mkdir -p ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources
educates publish-workshop ${WORKSHOP_DIRECTORY} \
--export-workshop ${{runner.temp}}/${WORKSHOP_DIRECTORY}/resources/workshop.yaml \
--image-repository=ghcr.io/${REPOSITORY_OWNER} \
--workshop-version=${REPOSITORY_TAG} \
--registry-username=${{github.actor}} \
--registry-password=${{secrets.GITHUB_TOKEN}}
done
- name: Generate archives containing the workshop definitions
shell: bash
run: |
ytt -f ${{runner.temp}}/workshops > ${{runner.temp}}/workshops.yaml
(cd ${{runner.temp}}; tar cvfz workshops.tar.gz workshops)
(cd ${{runner.temp}}; zip workshops.zip -r workshops)
- name: Create the GitHub release for the workshops
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{env.REPOSITORY_TAG}}
name: ${{env.REPOSITORY_NAME}}:${{env.REPOSITORY_TAG}}
draft: false
prerelease: false
files: |
${{runner.temp}}/workshops.tar.gz
${{runner.temp}}/workshops.zip
${{runner.temp}}/workshops.yaml
resources/trainingportal.yaml
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Authoring Guides
================

This repository contains a set of workshops for learning about how to create
workshops for Educates. The workshops are:

* [Getting Started](workshops/lab-authoring-environment) - Workshop on getting started with workshop authoring.
Empty file added resources/trainingportal.yaml
Empty file.
5 changes: 5 additions & 0 deletions workshops/lab-authoring-environment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Authoring Environment

This Educates workshop will teach you about how to install Educates to create
your own authoring environment, use it to host workshops, and how to create your
first workshop.
199 changes: 199 additions & 0 deletions workshops/lab-authoring-environment/resources/workshop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
apiVersion: training.educates.dev/v1beta1
kind: Workshop
metadata:
name: "lab-authoring-environment"
spec:
title: "Authoring Environment"
description: "A workshop on getting started with workshop authoring."
publish:
image: "$(image_repository)/labs-authoring-guides/lab-authoring-environment-files:$(workshop_version)"
workshop:
files:
- image:
url: "$(image_repository)/labs-authoring-guides/lab-authoring-environment-files:$(workshop_version)"
includePaths:
- /workshop/**
- /exercises/**
- /README.md
packages:
- name: educates
files:
- image:
url: $(oci_image_cache)/educates-client-programs:3.0.0-alpha.12
path: bin
includePaths:
- educates-linux-$(platform_arch)
session:
namespaces:
budget: x-large
security:
policy: baseline
token:
enabled: false
applications:
terminal:
enabled: true
layout: split
editor:
enabled: true
console:
enabled: false
docker:
enabled: true
socket:
enabled: false
compose:
services:
registry:
image: registry:2.8.3
ports:
- "0.0.0.0:5001:5000"
registry:
enabled: false
vcluster:
enabled: false
volumes:
- name: admin-credentials-config
secret:
secretName: $(session_name)-kubeconfig
volumeMounts:
- name: admin-credentials-config
mountPath: /opt/kubeconfig
dashboards:
- name: Docs
url: https://docs.educates.dev/
objects:
- apiVersion: v1
kind: Secret
metadata:
name: $(session_name)-admin-vcluster-values
namespace: $(workshop_namespace)
stringData:
values.yaml: |
vcluster:
image: rancher/k3s:v1.25.3-k3s1
syncer:
extraArgs:
- --tls-san=admin-vcluster.$(session_namespace).svc.$(cluster_domain)
- --out-kube-config-server=https://admin-vcluster.$(session_namespace).svc.$(cluster_domain)
mapServices:
fromHost:
- from: $(workshop_namespace)/registry-$(session_name)
to: default/registry
- from: $(workshop_namespace)/localhost-$(session_name)
to: default/loopback
sync:
ingresses:
enabled: true
- apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: $(session_name)-admin-vcluster-package
namespace: $(workshop_namespace)
spec:
serviceAccountName: kapp-installer
syncPeriod: 720h
noopDelete: true
fetch:
- helmChart:
name: vcluster
repository:
url: https://charts.loft.sh
template:
- helmTemplate:
name: admin-vcluster
namespace: $(session_namespace)
valuesFrom:
- secretRef:
name: $(session_name)-admin-vcluster-values
- ytt:
inline:
paths:
overlays.yaml: |
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.all, expects="1+"
---
metadata:
#@overlay/match missing_ok=True
ownerReferences:
- apiVersion: training.educates.dev/v1beta1
kind: WorkshopSession
blockOwnerDeletion: true
controller: true
name: $(session_name)
uid: $(workshop_session_uid)
deploy:
- kapp:
rawOptions:
- --app-changes-max-to-keep=5
- apiVersion: secrets.educates.dev/v1beta1
kind: SecretCopier
metadata:
name: $(session_name)-kubeconfig
spec:
rules:
- sourceSecret:
name: vc-admin-vcluster
namespace: $(session_namespace)
targetNamespaces:
nameSelector:
matchNames:
- $(workshop_namespace)
targetSecret:
name: $(session_name)-kubeconfig
- apiVersion: v1
kind: Service
metadata:
name: registry-$(session_name)
namespace: $(workshop_namespace)
spec:
type: ClusterIP
selector:
deployment: $(session_name)
ports:
- name: registry
port: 80
protocol: TCP
targetPort: 5001
- apiVersion: v1
kind: Service
metadata:
name: localhost-$(session_name)
namespace: $(workshop_namespace)
spec:
type: ClusterIP
selector:
deployment: $(session_name)
ports:
- name: renderer
port: 10081
protocol: TCP
targetPort: 10081
environment:
images:
registries:
- content:
- destination: /educates-client-programs
prefix: /vmware-tanzu-labs/educates-client-programs
stripPrefix: true
onDemand: true
urls:
- https://ghcr.io
objects:
- apiVersion: v1
kind: ServiceAccount
metadata:
name: kapp-installer
- apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kapp-installer-$(workshop_namespace)
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kapp-installer
namespace: $(workshop_namespace)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Workshop Overview
---

Educates is a system for hosting interactive workshop environments in
Kubernetes, or a local docker environment. It can be used for self paced or
supervised workshops. It can also be useful where you need to package up demos
of applications hosted in Kubernetes.

In this workshop you will learn the basics of how to install Educates, host
workshops with Educates, and create your own workshops.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Kubernetes Cluster
---

The full Educates training platform requires a Kubernetes cluster in which to
run. It is possible to deploy single workshop instances in a local docker
container runtime, however in this workshop we will only be covering deploying
to Kubernetes.

Any Kubernetes cluster should be able to be used to deploy Educates. This
includes being able to use a local Kind cluster running on your own computer, a
hosted Kubernetes cluster such as EKS (AWS), GKE (GCP) or AKS (Azure), or a
Kubernetes cluster you have installed yourself to an IaaS or your own compute
hardware.

In this workshop we will be deploying to a Kubernetes virtual cluster created
for you for this workshop session. This virtual cluster is running inside of the
larger Kubernetes cluster that the Educates instance hosting this workshop, is
running.

In other words, we are using Educates itself to teach you about Educates.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: Packaging Mechanism
---

Numerous packaging and installation mechanisms exist for applications to be
deployed to a Kubernetes cluster. Probably the most well known is Helm
templates. For Educates, we use an alternative packaging and installation
mechanism utilizing the [Carvel](https://carvel.dev/) tool set.

The Carvel tool set consists of a number of different tools which perform tasks
such as vendoring (`vendir`), YAML templating (`ytt`), container image
resolution and pinning (`kbld`), and Kubernetes application deployment (`kapp`).

Used together these tools provide a very powerful and flexible system for
distributing and installing packages for Kubernetes.

To install Educates you can use the Carvel command line tools from your
computer, or using Carvel's in cluster `kapp-controller` operator.

To make it much easier to install Educates to your local computer, but also in a
hosted Kubernetes cluster, Educates provides it's own CLI which bundles up the
functionality of the Carvel tools so you do not need to install them on your
computer to install Educates.

In the case of installing Educates to your local computer, the CLI is even able
to create a local Kubernetes cluster for you using Kind into which Educates is
then installed.

In this workshop we will use the CLI to install Educates into the Kubernetes
virtual cluster allocated to your workshop session.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Clickable Actions
---

The name of the CLI for Educates is as one might expect, called `educates`.
Running the CLI with no arguments will yield help on the major top level
commands and command groups. Run the command in the terminal of the workshop
session.

```terminal:execute
command: educates
```

If this is your first experience with Educates you may have typed in the command
manually, this however is not necessary and demonstrates the first bit of magic
that Educates provides to make your workshops simpler for your users to work
though.

The highlighed section showing the command to be executed is what in Educates we
call a clickable action block. In this case of a command we want you to execute
in the terminal, rather than typing it yourself, you can click on it and it will
be run for your automatically in the appropriate terminal.

Clickable actions like this in workshop instructions for a training system are
not unique to Educates, however other similar systems only apply them to the
execution of terminal commands or copying text from the instructions. In
Educates we use them for a much broader range of tasks, some of which you will
get to see in this workshop. So whenever you see a clickable action block,
rather than try and work out yourself how you should perform the required task,
just click on it.

Note that for clickable actions for such things as commands, if you wanted to
copy the command shown rather than execute it, hold down the shift key while
clicking on it and the text shown will be copied to your system paste buffer
rather than executing the command. You can then paste it to the terminal or
into another application if you want to capture the text for later.
Loading

0 comments on commit b70d30f

Please sign in to comment.