about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--example/prod-cluster.json2
-rw-r--r--example/some-api/deployment.yaml0
-rw-r--r--example/some-api/service.yaml5
-rw-r--r--example/some-api/some-api.yaml34
-rw-r--r--main.go6
-rw-r--r--templater/templater.go9
6 files changed, 42 insertions, 14 deletions
diff --git a/example/prod-cluster.json b/example/prod-cluster.json
index 76246ca382..70e2365f17 100644
--- a/example/prod-cluster.json
+++ b/example/prod-cluster.json
@@ -1,7 +1,7 @@
 {
   "context": "k8s.prod.mydomain.com",
   "global": {
-    "globalTest": "lizards"
+    "globalVar": "lizards"
   },
   "include": [
     {
diff --git a/example/some-api/deployment.yaml b/example/some-api/deployment.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/example/some-api/deployment.yaml
+++ /dev/null
diff --git a/example/some-api/service.yaml b/example/some-api/service.yaml
deleted file mode 100644
index 6aee878809..0000000000
--- a/example/some-api/service.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-name: foo
-importantFeature: {{ .importantFeature }}
-port: {{ .apiPort }}
-globalTest: {{ .globalTest }}
diff --git a/example/some-api/some-api.yaml b/example/some-api/some-api.yaml
new file mode 100644
index 0000000000..6f6a29a159
--- /dev/null
+++ b/example/some-api/some-api.yaml
@@ -0,0 +1,34 @@
+---
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+  name: some-api
+spec:
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        app: some-api
+    spec:
+      containers:
+        - image: my.container.repo/some-api:{{ .version }}
+          name: some-api
+          env:
+            - name: ENABLE_IMPORTANT_FEATURE
+              value: {{ .importantFeature }}
+            - name: SOME_GLOBAL_VAR
+              value: {{ .globalVar }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: some-api
+  labels:
+    app: some-api
+spec:
+  selector:
+    app: some-api
+  ports:
+    - port: 80
+      targetPort: {{ .apiPort }}
+      name: http
diff --git a/main.go b/main.go
index c33ec133d7..158c9a566a 100644
--- a/main.go
+++ b/main.go
@@ -1,8 +1,8 @@
 package main
 
 import (
-	"os"
 	"fmt"
+	"os"
 
 	"github.com/tazjin/kontemplate/context"
 	"github.com/tazjin/kontemplate/templater"
@@ -22,10 +22,10 @@ func main() {
 		os.Exit(1)
 	}
 
-	fmt.Fprintf(os.Stderr,"Applying cluster %s\n", c.Name)
+	fmt.Fprintf(os.Stderr, "Applying cluster %s\n", c.Name)
 
 	for _, rs := range c.ResourceSets {
-		fmt.Fprintf(os.Stderr,"Applying resource %s with values %v\n", rs.Name, rs.Values)
+		fmt.Fprintf(os.Stderr, "Applying resource %s with values %v\n", rs.Name, rs.Values)
 		resources, err := templater.LoadAndPrepareTemplates(c)
 
 		if err != nil {
diff --git a/templater/templater.go b/templater/templater.go
index f4be1e6fa6..27beff371e 100644
--- a/templater/templater.go
+++ b/templater/templater.go
@@ -1,16 +1,16 @@
 package templater
 
 import (
+	"bytes"
 	"fmt"
 	"io/ioutil"
-	"strings"
 	"os"
 	"path"
+	"strings"
 	"text/template"
-	"bytes"
 
-	"github.com/tazjin/kontemplate/context"
 	"github.com/polydawn/meep"
+	"github.com/tazjin/kontemplate/context"
 )
 
 // Error that is caused by non-existent template files being specified
@@ -28,7 +28,7 @@ func LoadAndPrepareTemplates(c *context.Context) ([]string, error) {
 	output := make([]string, 0)
 
 	for _, rs := range c.ResourceSets {
-		fmt.Fprintf(os.Stderr,"Loading resources for %s\n", rs.Name)
+		fmt.Fprintf(os.Stderr, "Loading resources for %s\n", rs.Name)
 
 		rp := path.Join(c.BaseDir, rs.Name)
 		files, err := ioutil.ReadDir(rp)
@@ -40,7 +40,6 @@ func LoadAndPrepareTemplates(c *context.Context) ([]string, error) {
 			)
 		}
 
-
 		for _, file := range files {
 			if !file.IsDir() && isResourceFile(file) {
 				p := path.Join(rp, file.Name())