about summary refs log tree commit diff
path: root/infra/kubernetes
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2019-09-02T18·04+0100
committerGitHub <noreply@github.com>2019-09-02T18·04+0100
commit2f239426aa4b9783c301a0ecbb4a9a4fd8b8e6dd (patch)
tree6656efbc41e5dd9c90759b7773538ac064666d54 /infra/kubernetes
parent4bd6d528008c6a8a7357a2c40013931800582252 (diff)
parente2feae3387e5d95715bdd27cd62753a18abf16bd (diff)
Merge pull request #2 from tazjin/refactor/nixos-nginx-cleanup r/73
Remove old NixOS config and move oslo.pub
Diffstat (limited to 'infra/kubernetes')
-rw-r--r--infra/kubernetes/gemma/config.lisp19
-rw-r--r--infra/kubernetes/https-lb/ingress.yaml10
-rw-r--r--infra/kubernetes/nginx/nginx.conf36
-rw-r--r--infra/kubernetes/nginx/nginx.yaml55
-rw-r--r--infra/kubernetes/primary-cluster.yaml7
5 files changed, 125 insertions, 2 deletions
diff --git a/infra/kubernetes/gemma/config.lisp b/infra/kubernetes/gemma/config.lisp
new file mode 100644
index 000000000000..517a658cf150
--- /dev/null
+++ b/infra/kubernetes/gemma/config.lisp
@@ -0,0 +1,19 @@
+(config :port 4242
+        :data-dir "/var/lib/gemma/")
+
+(deftask bathroom/wipe-mirror 7)
+(deftask bathroom/wipe-counter 7)
+
+;; Bedroom tasks
+(deftask bedroom/change-sheets 7)
+(deftask bedroom/vacuum 10)
+
+;; Kitchen tasks
+(deftask kitchen/normal-trash 3)
+(deftask kitchen/green-trash 5)
+(deftask kitchen/blue-trash 5)
+(deftask kitchen/wipe-counters 3)
+(deftask kitchen/vacuum 5 "Kitchen has more crumbs and such!")
+
+;; Entire place
+(deftask clean-windows 60)
diff --git a/infra/kubernetes/https-lb/ingress.yaml b/infra/kubernetes/https-lb/ingress.yaml
index 5afb5f3a48e1..03fa2cec0738 100644
--- a/infra/kubernetes/https-lb/ingress.yaml
+++ b/infra/kubernetes/https-lb/ingress.yaml
@@ -6,10 +6,18 @@ kind: Ingress
 metadata:
   name: https-ingress
   annotations:
-    networking.gke.io/managed-certificates: tazj-in, www-tazj-in
+    networking.gke.io/managed-certificates: tazj-in, www-tazj-in, oslo-pub
 spec:
   # Default traffic is routed to the blog, in case people go to
   # peculiar hostnames.
   backend:
     serviceName: tazblog
     servicePort: 8000
+  rules:
+    # Route oslo.pub to the nginx instance which serves redirects
+    - host: oslo.pub
+      http:
+        paths:
+          - backend:
+              serviceName: nginx
+              servicePort: 80
diff --git a/infra/kubernetes/nginx/nginx.conf b/infra/kubernetes/nginx/nginx.conf
new file mode 100644
index 000000000000..cdc228b494b0
--- /dev/null
+++ b/infra/kubernetes/nginx/nginx.conf
@@ -0,0 +1,36 @@
+daemon off;
+worker_processes  1;
+error_log stderr;
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    log_format json_combined escape=json
+    '{'
+        '"time_local":"$time_local",'
+        '"remote_addr":"$remote_addr",'
+        '"remote_user":"$remote_user",'
+        '"request":"$request",'
+        '"status": "$status",'
+        '"body_bytes_sent":"$body_bytes_sent",'
+        '"request_time":"$request_time",'
+        '"http_referrer":"$http_referer",'
+        '"http_user_agent":"$http_user_agent"'
+        '}';
+
+    access_log /dev/stdout json_combined;
+
+    sendfile        on;
+    keepalive_timeout  65;
+
+    server {
+        listen       80;
+        server_name  oslo.pub;
+
+        location / {
+            return 302 https://www.google.com/maps/d/viewer?mid=1pJIYY9cuEdt9DuMTbb4etBVq7hs;
+        }
+    }
+}
diff --git a/infra/kubernetes/nginx/nginx.yaml b/infra/kubernetes/nginx/nginx.yaml
new file mode 100644
index 000000000000..c107ab68764a
--- /dev/null
+++ b/infra/kubernetes/nginx/nginx.yaml
@@ -0,0 +1,55 @@
+# Deploy an nginx instance which serves ... redirects.
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: nginx-conf
+data:
+  nginx.conf: {{ insertFile "nginx.conf" | toJson }}
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: nginx
+  labels:
+    app: nginx
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: nginx
+  template:
+    metadata:
+      labels:
+        app: nginx
+        config: {{ insertFile "nginx.conf" | sha1sum }}
+    spec:
+      containers:
+        - name: tazblog
+          image: nixery.local/shell/nginx
+          command: ["/bin/bash", "-c"]
+          args:
+            - |
+              echo 'nogroup:x:30000:nobody' >> /etc/group
+              echo 'nobody:x:30000:30000:nobody:/tmp:/bin/bash' >> /etc/passwd
+              exec nginx -c /etc/nginx/nginx.conf
+          volumeMounts:
+            - name: nginx-conf
+              mountPath: /etc/nginx
+      volumes:
+        - name: nginx-conf
+          configMap:
+            name: nginx-conf
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: nginx
+spec:
+  type: NodePort
+  selector:
+    app: nginx
+  ports:
+    - protocol: TCP
+      port: 80
+      targetPort: 80
diff --git a/infra/kubernetes/primary-cluster.yaml b/infra/kubernetes/primary-cluster.yaml
index 5b4b04d5d5c2..99bd6fac38d0 100644
--- a/infra/kubernetes/primary-cluster.yaml
+++ b/infra/kubernetes/primary-cluster.yaml
@@ -12,6 +12,10 @@ include:
     path: https-cert
     values:
       domain: www.tazj.in
+  - name: oslo-pub-cert
+    path: https-cert
+    values:
+      domain: oslo.pub
 
   # Services
   - name: nixery
@@ -20,6 +24,7 @@ include:
       version: 2e688c1
       bucket: tazjins-data
       account: nixery@tazjins-infrastructure.iam.gserviceaccount.com
-      repo: ssh://source.developers.google.com:2022/p/tazjins-infrastructure/r/monorepo
+      repo: git@github.com:tazjin/depot.git
   - name: tazblog
   - name: https-lb
+  - name: nginx