Workshop content is either embedded in a custom workshop image or downloaded from a Git repository or web server when the workshop session is created. There are several best practices for speeding up the iterative loop of editing and testing a workshop when developing workshop content.
Deactivate the reserved sessions by setting the
reserved field to
0 in your training portal instance:
apiVersion: learningcenter.tanzu.vmware.com/v1beta1 kind: TrainingPortal metadata: name: lab-sample-workshop spec: portal: sessions: maximum: 1 workshops: - name: lab-sample-workshop reserved: 0 expires: 120m orphaned: 15m
If you do not deactivate reserved sessions, a new session is always created ready for the next workshop session when there is available capacity to do so. If you modify workshop content while testing the current workshop session, terminate the session and start a new one, the workshop picks up the reserved session. The reserved session has a copy of the old content.
By deactivating reserved sessions, a new workshop session is always created on demand. This ensures the latest workshop content is used.
Because you might have to wait to create a new workshop, shut down the existing workshop session first. The new workshop session might also take some time to start if an updated version of the workshop image also has to be pulled down.
If you download workshop content from a Git repository or web server, and you are only doing simple updates to workshop instructions, scripts, or files bundled with the workshop, you can update the content in place without needing to restart the workshop session. To perform an update, download the workshop content after you have pushed back any changes to the hosted Git repository or updated the content available through the web server. From the workshop session terminal, run:
This command downloads any workshop content from the Git repository or web server, unpacks it into the live workshop session, and re-runs any script files found in the
Find the location where the workshop content is downloading by viewing the file:
You can change the location saved in this file if, for example, it references a specific version of the workshop content and you want to test with a different version.
Once the workshop content has been updated, reload the current page of the workshop instructions by clicking the reload icon on the dashboard while holding down the shift key.
If additional pages are added to the workshop instructions or pages are renamed, you must restart the workshop renderer process by running:
If you didn’t rename the current pager or if the name changed, you can trigger a reload of the current page. Click the home icon or refresh the webpage if the name of the first page didn’t change.
If action blocks within the workshop instructions are broken, to change and test the workshop instructions within the live workshop session, you can edit the appropriate page under
/opt/workshop/content. Navigate to the modified page or reload it to verify the change.
To change set up scripts that create files specific to a workshop session, edit the script under
To trigger running of any setup scripts, run:
If local changes to the workshop session take effect, you can restore the file in the original Git repository.
Updating workshop content in a live session in this way does not undo any deployments or changes you make in the Kubernetes cluster for that session. To retest parts of the workshop instructions, you might have to manually undo the changes in the cluster to replay them. This depends on your specific workshop content.
If your workshop uses a custom workshop image to provide additional tools and you have included the workshop instructions as part of the workshop image, you must use an image tag of
latest during the development of workshop content. Do not use a version image reference.
apiVersion: learningcenter.tanzu.vmware.com/v1beta1 kind: Workshop metadata: name: lab-sample-workshop spec: title: Sample Workshop description: A sample workshop content: image: <YOUR-GIT-REPO>/lab-sample-workshop:main
When you use an image tag of
latest, the image pull policy is set to
Always to ensure that the custom workshop image is pulled down again for a new workshop session if the remote image changes. If the image tag is for a specific version, you must change the workshop definition every time when the workshop image changes.
For a custom workshop image, you can set up the workshop definition to pull down the workshop content from the hosted Git repository or web server as the follows:
apiVersion: learningcenter.tanzu.vmware.com/v1beta1 kind: Workshop metadata: name: lab-sample-workshop spec: title: Sample Workshop description: A sample workshop content: image: ghcr.io/eduk8s-labs/lab-sample-workshop:main files: <YOUR-GIT-REPO>/lab-sample-workshop
By pulling down the workshop content as an overlay of the custom workshop image when the workshop session starts, you only need to rebuild the custom workshop image when you need to make changes such as to include additional tools or to ensure the latest workshop instructions are included in the final custom workshop image.
Because the location of the workshop files is known, you can live update the workshop content in the session by following Live updates to the content.
If the additional set of tools required for a workshop is not specific to a workshop, VMware recommends that you create a standalone workshop base image where you can add the tools. You can always pull down content for a specific workshop from a Git repository or web server when the workshop session starts.
apiVersion: learningcenter.tanzu.vmware.com/v1beta1 kind: Workshop metadata: name: lab-sample-workshop spec: title: Sample Workshop description: A sample workshop content: image: ghcr.io/eduk8s-labs/custom-environment:main files: github.com/eduk8s-labs/lab-sample-workshop
This separates generic tooling from specific workshops and so you can use the custom workshop base image for multiple workshops on different, but related topics that require the same tooling.
By default, to modify the definition for a workshop, you need to delete the training portal instance, update the workshop definition in the cluster, and recreate the training portal.
During the workshop content development, to change resource allocations, role access, or to specify what resource objects to be automatically created for the workshop environment or a specific workshop session, you can enable automatic updates in the training portal definition by setting
updates.workshop field as
apiVersion: learningcenter.tanzu.vmware.com/v1beta1 kind: TrainingPortal metadata: name: lab-sample-workshop spec: portal: sessions: maximum: 1 updates: workshop: true workshops: - name: lab-sample-workshop expires: 120m orphaned: 15m
With automatic updates enabled, if the workshop definition in the cluster is modified, the existing workshop environment managed by the training portal for that workshop is shut down and replaced with a new workshop environment by using the updated workshop definition.
When an active workshop session is running, the actual deletion of the old workshop environment is delayed until that workshop session is terminated.
If you do not package a workshop into a custom workshop image, VMware recommends to build a custom workshop image locally on your own machine by using
docker to avoid keeping pushing changes to a hosted Git repository and using a Kubernetes cluster for local workshop content development.
Furthermore, to avoid pushing the image to a public image registry on the Internet, you must deploy an image registry to your local Kubernetes cluster where you run the Learning Center. In most cases, a basic deployment of an image registry in a local cluster access is not secure. As a result, you have to configure the Kubernetes cluster to trust the registry that is not secure. This can be difficult to do depending on the Kubernetes cluster you use, but it can enable quicker turnaround because you do not have to push or pull the custom workshop image across the public Internet.
After pushing the custom workshop image built locally to the local image registry, you can set the image reference in the workshop definition to pull the custom workshop from the local registry in the same cluster. To ensure that the custom workshop image is always pulled for a new workshop session after update, use the
latest tag when tagging and pushing the image to the local registry.