Skip to content

Commit

Permalink
general updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTheSnowman committed Oct 31, 2021
1 parent 6931d36 commit 149fbfb
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .tools/labCheckers/checker_common.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions .tools/labCheckers/l1_e1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
32 changes: 29 additions & 3 deletions LAB_README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# Summary:
# About:
---
NOTE: To read all the documentation in a pretty way, from within Visual Studio Code, press: <ctrl> + <shift> + <v>

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.

Expand All @@ -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.
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`
10 changes: 9 additions & 1 deletion lab1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- 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
7 changes: 7 additions & 0 deletions lab1/exercise-1/check-work
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

assignment=l1_e1

lib=../../.tools/labCheckers/
DIR="$(dirname "$(realpath "$0")")"
python3 $lib/$assignment.py $DIR/$assignment.yaml
2 changes: 1 addition & 1 deletion .tools/labCheckers/t.yaml → lab1/exercise-1/l1_e1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ date: 2017-10-01
metrics:
percentage:
value: 87
trend: down
trend: downn
7 changes: 7 additions & 0 deletions lab1/exercise-2/check-work
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

assignment=l1_e1

lib=../../.tools/labCheckers/
DIR="$(dirname "$(realpath "$0")")"
python3 $lib/$assignment.py $DIR/$assignment.yaml
6 changes: 6 additions & 0 deletions lab1/exercise-2/l1_e1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: 'my_name'
date: 2017-10-01
metrics:
percentage:
value: 87
trend: downn

0 comments on commit 149fbfb

Please sign in to comment.