diff --git a/.tools/labCheckers/checker_common.py b/.tools/labCheckers/checker_common.py index 7c494b1..45170f3 100644 --- a/.tools/labCheckers/checker_common.py +++ b/.tools/labCheckers/checker_common.py @@ -1,8 +1,7 @@ import yaml from yaml import CLoader as Loader from cerberus import Validator - - +import sys def _load_doc(yamlPath): with open(yamlPath, 'r') as stream: @@ -12,6 +11,11 @@ def _load_doc(yamlPath): raise exception def checker(schema, yamlPath): + lessonNum = sys.argv[1].split("/")[-1].split("_")[0][1::] + exerciseNum = sys.argv[1].split("/")[-1].split("_")[1][1::].split('.')[0] + startMsg = "Checking your work for Lab-{0}, Exercise-{1} ...".format(lessonNum, exerciseNum) + print(startMsg) + #schema = eval(open('./schema.py', 'r').read()) v = Validator(schema) doc = _load_doc(yamlPath) diff --git a/.tools/labCheckers/l1_e1.py b/.tools/labCheckers/l1_e1.py index 712ec58..07ec55b 100755 --- a/.tools/labCheckers/l1_e1.py +++ b/.tools/labCheckers/l1_e1.py @@ -35,8 +35,5 @@ import checker_common as C import sys - if __name__ == "__main__": - startMsg = "Checking your work for Lab-1, Exercise-1..." - print(startMsg) C.checker(schema, sys.argv[1]) \ No newline at end of file diff --git a/LAB_README.md b/LAB_README.md index 6d54b6d..8258172 100644 --- a/LAB_README.md +++ b/LAB_README.md @@ -1,13 +1,22 @@ -# Summary: +# About: +--- + NOTE: To read all the documentation in a pretty way, from within Visual Studio Code, press: + + The purpose of the lab exercises is to get you up to speed on using Kubernetes (abbreviated as K8s) with the following learning objectives in mind: +- To become familiar with the basics of YAML - To get introduced to core terminology - To become familiar with the core concepts - To understand how to interact with K8s using kubectl -- To become familiar with the basics of YAML - To understand how to create or deploy your own resources on K8s using YAML and kubectl - And to understand how to read an interptet the K8s API documentation +# Summary of lab modules: +Each lab module has been designed to provide you with exercises on a general topic related to Kubernetes. Below is a quick summary of the primary topic covered by each lab: + - Lab 1: YAML fundamentals + - Lab 2: Working with K3d + - Lab 3: Getting started with kubectl + - Lab 4: Managing K8s resources using YAML + # About this VM: In order to help you along your K8s learning path, this VM has been designed to be as lightweight aspossible and with collection of software pre-installed to make your learning experience much easier so you can focus on just using kubernetes. @@ -28,4 +37,21 @@ K3d accomplishes this in a few ways: 1. K3d provides you a very easy to use command line interface that you can use to create, delete, and manage your Kubernetes cluster. 2. When you create a cluster using K3d, all Kubernetes nodes that K3d creates are running inside of a Docker container. 3. The containers that act as K8s nodes all have a very lightweight container runtime which uses containerd, runc, and cri. - 4. When you create pods (containers) to run on your K8s cluster, you're essentially creating that container, in another container. \ No newline at end of file + 4. When you create pods (containers) to run on your K8s cluster, you're essentially creating that container, in another container. + +Please note, K3d is already installed within this VM for your convienance. But if you with to get K3d installed in another VM please read about the below system requirements and the single curl command you can execute to get K3d installed. +## K3d prerequisites: + - Linux (K3d does not support Windows) + - Docker + - Kubectl +## K3d installation command: + NOTE: K3d is already installed on this VM. If you re-run the command, it's okay, nothing bad will happen. +Installation command to install the latest version: + - wget: `wget -q -O - https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash` + - curl: `curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash` + +Install command for a specific release: +Use the install script to grab a specific release (via TAG environment variable): + + - wget: `wget -q -O - https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v5.0.0 bash` + - curl: `curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v5.0.0 bash` \ No newline at end of file diff --git a/lab1/README.md b/lab1/README.md index 11ea2dd..db1c868 100644 --- a/lab1/README.md +++ b/lab1/README.md @@ -11,4 +11,12 @@ For this lab, your goals are the following: - Become familiar with some of the basic features & capabilities of YAML - Understand the high level structure of a YAML document - Understand what data types and data structures are available - - Be able to read/write some basic YAML \ No newline at end of file + - Be able to read/write some basic YAML + +## Exercise summary: + - Exercise-1: Make scalars or different data types + - Exercise-2: Make your first mapping + - Exercise-3: Make two different sequences + - Exercise-4: Break a long, single, line of text across multiple lines + - Exercise-5: Make a multi-line string and preserve line-breaks + - Exercise-6: Referencing other data within a YAML document \ No newline at end of file diff --git a/lab1/exercise-1/check-work b/lab1/exercise-1/check-work new file mode 100755 index 0000000..0d38385 --- /dev/null +++ b/lab1/exercise-1/check-work @@ -0,0 +1,7 @@ +#!/bin/bash + +assignment=l1_e1 + +lib=../../.tools/labCheckers/ +DIR="$(dirname "$(realpath "$0")")" +python3 $lib/$assignment.py $DIR/$assignment.yaml \ No newline at end of file diff --git a/.tools/labCheckers/t.yaml b/lab1/exercise-1/l1_e1.yaml similarity index 80% rename from .tools/labCheckers/t.yaml rename to lab1/exercise-1/l1_e1.yaml index 9681a94..9e78cb5 100644 --- a/.tools/labCheckers/t.yaml +++ b/lab1/exercise-1/l1_e1.yaml @@ -3,4 +3,4 @@ date: 2017-10-01 metrics: percentage: value: 87 - trend: down \ No newline at end of file + trend: downn \ No newline at end of file diff --git a/lab1/exercise-2/check-work b/lab1/exercise-2/check-work new file mode 100755 index 0000000..0d38385 --- /dev/null +++ b/lab1/exercise-2/check-work @@ -0,0 +1,7 @@ +#!/bin/bash + +assignment=l1_e1 + +lib=../../.tools/labCheckers/ +DIR="$(dirname "$(realpath "$0")")" +python3 $lib/$assignment.py $DIR/$assignment.yaml \ No newline at end of file diff --git a/lab1/exercise-2/l1_e1.yaml b/lab1/exercise-2/l1_e1.yaml new file mode 100644 index 0000000..9e78cb5 --- /dev/null +++ b/lab1/exercise-2/l1_e1.yaml @@ -0,0 +1,6 @@ +name: 'my_name' +date: 2017-10-01 +metrics: + percentage: + value: 87 + trend: downn \ No newline at end of file