aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-11-03 21:50:57 -0500
committerXe Iaso <me@xeiaso.net>2024-11-03 21:50:57 -0500
commit35e42faf652289d63613753ef64263c7c2e3b23c (patch)
tree9ff7067188ee2ef409be58eb3a8de5d44ba5e6a1
parente0c82be01621dd9ef6799c0cf919a92d1f924d2e (diff)
downloadxesite-35e42faf652289d63613753ef64263c7c2e3b23c.tar.xz
xesite-35e42faf652289d63613753ef64263c7c2e3b23c.zip
manifest/xesite: properly configure pod disruption budget, hostmount for xesite as a hack
Signed-off-by: Xe Iaso <me@xeiaso.net>
-rw-r--r--cmd/xesite/internalapi.go4
-rw-r--r--manifest/kustomization.yaml2
-rw-r--r--manifest/xesite/deployment.yaml23
-rw-r--r--manifest/xesite/kustomization.yaml1
-rw-r--r--manifest/xesite/pod-disruption-budget.yaml9
-rw-r--r--manifest/xesite/service.yaml4
6 files changed, 40 insertions, 3 deletions
diff --git a/cmd/xesite/internalapi.go b/cmd/xesite/internalapi.go
index c0dfa9c..615af72 100644
--- a/cmd/xesite/internalapi.go
+++ b/cmd/xesite/internalapi.go
@@ -3,6 +3,7 @@ package main
import (
"context"
"expvar"
+ "fmt"
"log"
"net"
"net/http"
@@ -23,6 +24,9 @@ func internalAPI(fs *lume.FS) {
mux := http.NewServeMux()
mux.Handle("/debug/vars", expvar.Handler())
+ mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, "OK")
+ })
mux.HandleFunc("/rebuild", func(w http.ResponseWriter, r *http.Request) {
go fs.Update(context.Background())
diff --git a/manifest/kustomization.yaml b/manifest/kustomization.yaml
index 409aa1a..5e58581 100644
--- a/manifest/kustomization.yaml
+++ b/manifest/kustomization.yaml
@@ -1,5 +1,5 @@
resources:
- patreon-saasproxy
- #- xesite
+ - xesite
namespace: default \ No newline at end of file
diff --git a/manifest/xesite/deployment.yaml b/manifest/xesite/deployment.yaml
index 57f79b4..88d26ed 100644
--- a/manifest/xesite/deployment.yaml
+++ b/manifest/xesite/deployment.yaml
@@ -13,8 +13,9 @@ spec:
spec:
volumes:
- name: data
- emptyDir:
- sizeLimit: 500Mi
+ hostPath:
+ path: /data/xesite
+ type: DirectoryOrCreate
containers:
- name: web
image: ghcr.io/xe/site/bin:latest
@@ -39,3 +40,21 @@ spec:
volumeMounts:
- mountPath: "/xe/data"
name: data
+ readinessProbe:
+ httpGet:
+ path: /healthz
+ port: 3001
+ httpHeaders:
+ - name: X-Kubernetes
+ value: "Is alright, I guess"
+ initialDelaySeconds: 120
+ periodSeconds: 30
+ livenessProbe:
+ httpGet:
+ path: /healthz
+ port: 3001
+ httpHeaders:
+ - name: X-Kubernetes
+ value: "Is alright, I guess"
+ initialDelaySeconds: 30
+ periodSeconds: 30
diff --git a/manifest/xesite/kustomization.yaml b/manifest/xesite/kustomization.yaml
index 7e81bf4..be627cc 100644
--- a/manifest/xesite/kustomization.yaml
+++ b/manifest/xesite/kustomization.yaml
@@ -2,4 +2,5 @@ resources:
- 1password.yaml
- deployment.yaml
- ingress.yaml
+ - pod-disruption-budget.yaml
- service.yaml \ No newline at end of file
diff --git a/manifest/xesite/pod-disruption-budget.yaml b/manifest/xesite/pod-disruption-budget.yaml
new file mode 100644
index 0000000..e6caa0f
--- /dev/null
+++ b/manifest/xesite/pod-disruption-budget.yaml
@@ -0,0 +1,9 @@
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+ name: xesite
+spec:
+ minAvailable: 1
+ selector:
+ matchLabels:
+ app.kubernetes.io/name: xesite \ No newline at end of file
diff --git a/manifest/xesite/service.yaml b/manifest/xesite/service.yaml
index c83e1d0..86b6217 100644
--- a/manifest/xesite/service.yaml
+++ b/manifest/xesite/service.yaml
@@ -12,3 +12,7 @@ spec:
targetPort: 3000
protocol: TCP
name: http
+ - port: 8080
+ targetPort: 3001
+ protocol: TCP
+ name: internalapi