Skip to content

Commit

Permalink
Add workshop skeleton on authoring workshops for Educates.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed May 8, 2024
1 parent b8309f2 commit 886d177
Show file tree
Hide file tree
Showing 8 changed files with 348 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ of the Educates training platform and how it can be used. The workshops are:
* [Ingress Proxy](workshops/lab-ingress-proxy) - Overview of adding ingresses for local processes.
* [Git Repositories](workshops/lab-git-repositories) - Overview of using local hosted Git repositories.
* [Installing Educates](workshops/lab-installing-educates) - Overview of installing Educates using the CLI.
* [Workshop Authoring](workshops/lab-workshop-authoring) - Overview of authoring workshops for Educates.
3 changes: 3 additions & 0 deletions workshops/lab-workshop-authoring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Workshop Authoring

Overview of authoring workshops for Educates.
252 changes: 252 additions & 0 deletions workshops/lab-workshop-authoring/resources/workshop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
apiVersion: training.educates.dev/v1beta1
kind: Workshop
metadata:
name: "lab-workshop-authoring"
spec:
title: "Workshop Authoring"
description: "Overview of authoring workshops for Educates."
publish:
image: "$(image_repository)/lab-workshop-authoring-files:$(workshop_version)"
workshop:
files:
- image:
url: "$(image_repository)/lab-workshop-authoring-files:$(workshop_version)"
includePaths:
- /workshop/**
- /exercises/**
- /README.md
packages:
- name: educates
files:
- image:
url: $(oci_image_cache)/educates-client-programs:installer-clean
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
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
- apiVersion: v1
kind: Secret
metadata:
name: educates-training-platform-values
stringData:
values.yaml: |
clusterInfrastructure:
provider: custom
clusterPackages:
contour:
enabled: false
kyverno:
enabled: false
clusterIngress:
domain: "$(session_name).$(ingress_domain)"
clusterSecurity:
policyEngine: none
workshopSecurity:
rulesEngine: none
imageRegistry:
host: registry.default.svc.cluster.local
namespace: ""
imagePuller:
prePullImages: []
- apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: educates-training-platform
spec:
noopDelete: true
syncPeriod: 24h
cluster:
namespace: default
kubeconfigSecretRef:
name: vc-admin-vcluster
key: config
fetch:
- imgpkgBundle:
image: ghcr.io/jorgemoralespou/educates-installer:installer-clean
deploy:
- kapp:
rawOptions:
- --app-changes-max-to-keep=5
template:
- ytt:
paths:
- config
- kbld/kbld-bundle.yaml
valuesFrom:
- path: kbld/kbld-images.yaml
- secretRef:
name: educates-training-platform-values
- kbld:
paths:
- .imgpkg/images.yml
- '-'
environment:
images:
registries:
- content:
- destination: /educates-client-programs
prefix: /jorgemoralespou/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)
31 changes: 31 additions & 0 deletions workshops/lab-workshop-authoring/workshop/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# pathways:
# default: workshop
#
# paths:
# workshop:
# title: "Workshop"
#
# steps:
# - 00-workshop-overview
# - 01-workshop-instructions
# - 99-workshop-summary
#
# params:
# - name: NAME
# value: undefined
# aliases:
# - ALIAS

# modules:
# - name: 00-workshop-overview
# title: Workshop Overview
# - name: 01-workshop-instructions
# title: Workshop Instructions
# - name: 99-workshop-summary
# title: Workshop Summary

# params:
# - name: NAME
# value: undefined
# aliases:
# - ALIAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Workshop Overview
---

```terminal:execute
command: educates new-workshop lab-test-workshop
```

```terminal:execute
command: cd lab-test-workshop
```

```terminal:execute
command: educates publish-workshop
```

```terminal:execute
command: educates deploy-workshop
```

```terminal:execute
command: educates browse-workshops
```

```terminal:execute
command: educates list-portals
```

```terminal:execute
command: educates view-credentials
```

```dashboard:open-url
url: http://educates-cli-ui.{{< param session_name >}}.{{< param ingress_domain >}}
```

Need proxy-host option because vcluster no longer returning correct name from DNS when calculating it.

```terminal:execute
command: educates serve-workshop --patch-workshop --proxy-host=loopback.default.svc.cluster.local
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Workshop Instructions
---

This is the first page of the workshop instructions, create as many separate pages as you need to. If necessary pages can be located in sub directories to provided grouping.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Workshop Summary
---

This is the last page of the workshop. Include in this page a summary of the workshop and any links to resources relevant to the workshop. This ensures anyone doing the workshop has material they can research later to learn more.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

mkdir -p $HOME/bin

ln -s /opt/packages/educates/bin/educates-linux-$PLATFORM_ARCH $HOME/bin/educates

if [[ ! -f $HOME/.bash_profile || ! $(grep -q "__start_educates" $HOME/.bash_profile) ]]; then
/opt/packages/educates/bin/educates-linux-$PLATFORM_ARCH completion bash >> $HOME/.bash_profile
fi

0 comments on commit 886d177

Please sign in to comment.