UNPKG

1.12 kBMarkdownView Raw
1# pk-template
2p template engine for kubernetes.
3this is proof of concept project for kubernetes yaml templating influenced by helm, css, jquery.
4
5## install
6```
7$ npm install pk-template -g
8```
9
10## example
11```bash
12$ cat > pod.yaml <<EOF
13apiVersion: v1
14kind: Pod
15spec:
16 containers:
17 - image: <<<= image >>>
18EOF
19
20$ pkt pod.yaml --image nginx
21apiVersion: v1
22kind: Pod
23spec:
24 containers:
25 - image: nginx
26```
27
28```bash
29$ cat > sample.pkt <<EOF
30input:
31 namespace: test
32routine:
33- assign:
34 image: nginx
35- include: pod.yaml
36- assign:
37 image: apache
38- include: pod.yaml
39- script: |
40 for obj in $.objects
41 obj.metadata =
42 name: obj.spec.containers[0].image.split(':')[0].split('/')[*-1*]
43 namespace: namespace
44EOF
45$ pkt sample.pkt --namespace pkt
46apiVersion: v1
47kind: Pod
48spec:
49 containers:
50 - image: nginx
51metadata:
52 name: nginx
53 namespace: pkt
54---
55apiVersion: v1
56kind: Pod
57spec:
58 containers:
59 - image: apache
60metadata:
61 name: apache
62 namespace: pkt
63
64```
65
66## more info
67- [QuickStarts](quickstarts/QuickStarts.md)
68