Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
killercoda-github committed Mar 16, 2022
0 parents commit 49ec779
Show file tree
Hide file tree
Showing 68 changed files with 638 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
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

17 changes: 17 additions & 0 deletions code-actions/index.json
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"
}
}
5 changes: 5 additions & 0 deletions code-actions/intro.md
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

24 changes: 24 additions & 0 deletions code-actions/step1.md
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}}
6 changes: 6 additions & 0 deletions code-snippets/finish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

<br>

### WELL DONE !

You solved this challenge!
26 changes: 26 additions & 0 deletions code-snippets/index.json
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"
}
}
8 changes: 8 additions & 0 deletions code-snippets/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

<br>

```
howTo() {
includeCode("snippets");
}
```
59 changes: 59 additions & 0 deletions code-snippets/step1.md
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",
}
}
```
28 changes: 28 additions & 0 deletions code-snippets/step2.md
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
```
30 changes: 30 additions & 0 deletions code-snippets/step3.md
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 foreground-background-scripts-multi-step/finish/background.sh
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 foreground-background-scripts-multi-step/finish/foreground.sh
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
4 changes: 4 additions & 0 deletions foreground-background-scripts-multi-step/finish/text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

<br>

THE END
37 changes: 37 additions & 0 deletions foreground-background-scripts-multi-step/index.json
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"
}
}
2 changes: 2 additions & 0 deletions foreground-background-scripts-multi-step/intro/background.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sleep 3
echo done > /tmp/background0
3 changes: 3 additions & 0 deletions foreground-background-scripts-multi-step/intro/foreground.sh
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!
4 changes: 4 additions & 0 deletions foreground-background-scripts-multi-step/intro/text.md
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!
2 changes: 2 additions & 0 deletions foreground-background-scripts-multi-step/step1/background.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sleep 3
echo done > /tmp/background1
3 changes: 3 additions & 0 deletions foreground-background-scripts-multi-step/step1/foreground.sh
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
4 changes: 4 additions & 0 deletions foreground-background-scripts-multi-step/step1/text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

<br>

Please create file `/tmp/step1`
1 change: 1 addition & 0 deletions foreground-background-scripts-multi-step/step1/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stat /tmp/step1
2 changes: 2 additions & 0 deletions foreground-background-scripts-multi-step/step2/background.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sleep 3
echo done > /tmp/background2
3 changes: 3 additions & 0 deletions foreground-background-scripts-multi-step/step2/foreground.sh
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
4 changes: 4 additions & 0 deletions foreground-background-scripts-multi-step/step2/text.md
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`
1 change: 1 addition & 0 deletions foreground-background-scripts-multi-step/step2/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stat /tmp/step2
9 changes: 9 additions & 0 deletions foreground-background-scripts/background.sh
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
12 changes: 12 additions & 0 deletions foreground-background-scripts/foreground.sh
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
14 changes: 14 additions & 0 deletions foreground-background-scripts/index.json
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"
}
}
4 changes: 4 additions & 0 deletions foreground-background-scripts/intro.md
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.
6 changes: 6 additions & 0 deletions kubernetes-1node/finish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

<br>

### WELL DONE !

You solved this challenge!
21 changes: 21 additions & 0 deletions kubernetes-1node/index.json
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"
}
}
8 changes: 8 additions & 0 deletions kubernetes-1node/intro.md
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**
2 changes: 2 additions & 0 deletions kubernetes-1node/step1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Run `k get pod -A`
Loading

0 comments on commit 49ec779

Please sign in to comment.