forked from killercoda/scenario-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 49ec779
Showing
68 changed files
with
638 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Killercoda Scenario Examples | ||
|
||
See these in action here: https://killercoda.com/examples | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"title": "Code Actions", | ||
"description": "Let users copy or exec code blocks", | ||
"details": { | ||
"intro": { | ||
"text": "intro.md" | ||
}, | ||
"steps": [ | ||
{ | ||
"text": "step1.md" | ||
} | ||
] | ||
}, | ||
"backend": { | ||
"imageid": "ubuntu20.04" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
<br> | ||
|
||
Let's learn how users can copy or exec code blocks | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
<br> | ||
|
||
### Single line code blocks can be copied by default | ||
`copy me` | ||
|
||
### It can also be disabled | ||
`copying disabled`{{}} | ||
|
||
### Execute a command per click | ||
`ls -lh`{{exec}} | ||
|
||
### Copy multiline code block | ||
``` | ||
uname -r | ||
pwd | ||
```{{copy}} | ||
### Execute multiline code block | ||
``` | ||
uname -r | ||
pwd | ||
```{{exec}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
<br> | ||
|
||
### WELL DONE ! | ||
|
||
You solved this challenge! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"title": "Code Snippets", | ||
"description": "Include code snippets of various languages", | ||
"details": { | ||
"intro": { | ||
"text": "intro.md" | ||
}, | ||
"steps": [ | ||
{ | ||
"text": "step1.md" | ||
}, | ||
{ | ||
"text": "step2.md" | ||
}, | ||
{ | ||
"text": "step3.md" | ||
} | ||
], | ||
"finish": { | ||
"text": "finish.md" | ||
} | ||
}, | ||
"backend": { | ||
"imageid": "ubuntu20.04" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
<br> | ||
|
||
``` | ||
howTo() { | ||
includeCode("snippets"); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
There is recognition for common languages in code blocks. | ||
|
||
### Javascript | ||
``` | ||
let var = 'good morning'; | ||
alert(var); | ||
``` | ||
|
||
### HTML | ||
``` | ||
<!DOCTYPE HTML> | ||
<html> | ||
<body> | ||
<p>This is very informative</p> | ||
</body> | ||
</html> | ||
``` | ||
|
||
### Golang | ||
|
||
``` | ||
package main | ||
import "fmt" | ||
func main() { | ||
fmt.Println("hello world") | ||
} | ||
``` | ||
|
||
### YAML | ||
|
||
``` | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
``` | ||
|
||
### JSON | ||
|
||
``` | ||
{ | ||
"apiVersion": "v1", | ||
"kind": "Pod", | ||
"metadata": { | ||
"generateName": "weave-net-", | ||
"labels": { | ||
"name": "weave-net", | ||
"pod-template-generation": "1" | ||
}, | ||
"name": "weave-net-tntwq", | ||
"namespace": "kube-system", | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
### Set language specifically | ||
|
||
```yaml | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
``` | ||
<br> | ||
### Disable syntax highlighting for a snippet | ||
```text | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
### Highlight important lines | ||
|
||
```yaml{2,5,6} | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
``` | ||
|
||
|
||
```json{6-9} | ||
{ | ||
"apiVersion": "v1", | ||
"kind": "Pod", | ||
"metadata": { | ||
"generateName": "weave-net-", | ||
"labels": { | ||
"name": "weave-net", | ||
"pod-template-generation": "1" | ||
}, | ||
"name": "weave-net-tntwq", | ||
"namespace": "kube-system", | ||
} | ||
} | ||
``` |
2 changes: 2 additions & 0 deletions
2
foreground-background-scripts-multi-step/finish/background.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sleep 3 | ||
echo done > /tmp/background3 |
3 changes: 3 additions & 0 deletions
3
foreground-background-scripts-multi-step/finish/foreground.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
echo waiting for finish-background-script to finish | ||
while [ ! -f /tmp/background3 ]; do sleep 1; done | ||
echo DONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
<br> | ||
|
||
THE END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"title": "Foreground Background Scripts Multi Steps", | ||
"description": "Multiple steps can have foreground and background scripts", | ||
"details": { | ||
"intro": { | ||
"title": "Intro", | ||
"text": "intro/text.md", | ||
"foreground": "intro/foreground.sh", | ||
"background": "intro/background.sh" | ||
}, | ||
"steps": [ | ||
{ | ||
"title": "Step1", | ||
"text": "step1/text.md", | ||
"foreground": "step1/foreground.sh", | ||
"background": "step1/background.sh", | ||
"verify": "step1/verify.sh" | ||
}, | ||
{ | ||
"title": "Step2", | ||
"text": "step2/text.md", | ||
"foreground": "step2/foreground.sh", | ||
"background": "step2/background.sh", | ||
"verify": "step2/verify.sh" | ||
} | ||
], | ||
"finish": { | ||
"title": "Finish", | ||
"text": "finish/text.md", | ||
"foreground": "finish/foreground.sh", | ||
"background": "finish/background.sh" | ||
} | ||
}, | ||
"backend": { | ||
"imageid": "ubuntu20.04" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sleep 3 | ||
echo done > /tmp/background0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
echo waiting for init-background-script to finish | ||
while [ ! -f /tmp/background0 ]; do sleep 1; done | ||
echo Hello and welcome to this scenario! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
<br> | ||
|
||
What an Intro! It even greets us in the terminal! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sleep 3 | ||
echo done > /tmp/background1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
echo waiting for step1-background-script to finish | ||
while [ ! -f /tmp/background1 ]; do sleep 1; done | ||
echo DONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
<br> | ||
|
||
Please create file `/tmp/step1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
stat /tmp/step1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sleep 3 | ||
echo done > /tmp/background2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
echo waiting for step2-background-script to finish | ||
while [ ! -f /tmp/background2 ]; do sleep 1; done | ||
echo DONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
<br> | ||
|
||
And to complete this step just create the file `/tmp/step2` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
stat /tmp/step2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
echo test | ||
|
||
echo test2 | ||
|
||
sleep 5 # some long running background task | ||
|
||
touch /tmp/finished |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
echo -n "Installing scenario..." | ||
|
||
while [ ! -f /tmp/finished ]; do | ||
echo -n '.' | ||
sleep 1; | ||
done | ||
|
||
echo -n " done" | ||
echo | ||
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"title": "Foreground Background Scripts", | ||
"description": "Execute code automatically in foreground and background", | ||
"details": { | ||
"intro": { | ||
"text": "intro.md", | ||
"foreground": "foreground.sh", | ||
"background": "background.sh" | ||
} | ||
}, | ||
"backend": { | ||
"imageid": "ubuntu20.04" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
<br> | ||
|
||
Here we see that the foreground script waits for the background script to finish. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
<br> | ||
|
||
### WELL DONE ! | ||
|
||
You solved this challenge! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"title": "Kubernetes 1node", | ||
"description": "Use a simple one node Kubernetes cluster and let user list all pods", | ||
"details": { | ||
"intro": { | ||
"text": "intro.md" | ||
}, | ||
"steps": [ | ||
{ | ||
"title": "List all pods", | ||
"text": "step1.md" | ||
} | ||
], | ||
"finish": { | ||
"text": "finish.md" | ||
} | ||
}, | ||
"backend": { | ||
"imageid": "kubernetes-kubeadm-1node-ubuntu20.04" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
<br> | ||
|
||
### Welcome ! | ||
|
||
In this scenario we'll learn how to update the `apt` repository. | ||
|
||
**HAVE FUN** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
Run `k get pod -A` |
Oops, something went wrong.