summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2024-09-15 16:02:02 +0200
committerSanto Cariotti <santo@dcariotti.me>2024-09-15 16:02:02 +0200
commit7b404a6d2321f27e9a808aca267bf8f9e4e681aa (patch)
tree472003eba97e891d68b241254531bb07033e810e
parent02e41bc8e457ffb6a96e8ae551f172df8140c578 (diff)
Remove K8s stuff
-rw-r--r--README.md8
-rw-r--r--k8s/cas-config.yaml8
-rw-r--r--k8s/cas-deployment.yaml52
-rw-r--r--k8s/cas-secret.yaml9
-rw-r--r--k8s/cas-service.yaml11
-rw-r--r--k8s/network-policy.yaml18
-rw-r--r--k8s/pgdata-pvc.yaml10
-rw-r--r--k8s/postgres-deployment.yaml38
-rw-r--r--k8s/postgres-service.yaml11
-rwxr-xr-xscripts/k8s40
10 files changed, 3 insertions, 202 deletions
diff --git a/README.md b/README.md
index 50a7acf..f1570cc 100644
--- a/README.md
+++ b/README.md
@@ -80,11 +80,9 @@ docker compose up
### Kubernetes
If you do not want to use Docker or Docker compose directly, you can use a
-Kubernetes cluster like [MiniKube](https://minikube.sigs.k8s.io/docs/).
-
-```text
-./scripts/k8s (apply|delete)
-```
+Kubernetes cluster like [MiniKube](https://minikube.sigs.k8s.io/docs/) and
+follow the istructions available at
+[github.com/cas-4/network](https://github.com/cas-4/network).
## Documentation
diff --git a/k8s/cas-config.yaml b/k8s/cas-config.yaml
deleted file mode 100644
index a7aa9d8..0000000
--- a/k8s/cas-config.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: cas-config
-data:
- RUST_LOG: ${RUST_LOG}
- DATABASE_URL: "postgres://postgres:password@postgres-service:5432/gis"
- ALLOWED_HOST: "0.0.0.0:8000"
diff --git a/k8s/cas-deployment.yaml b/k8s/cas-deployment.yaml
deleted file mode 100644
index fc0289a..0000000
--- a/k8s/cas-deployment.yaml
+++ /dev/null
@@ -1,52 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: cas-deployment
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: cas
- template:
- metadata:
- labels:
- app: cas
- spec:
- containers:
- - name: cas
- image: ghcr.io/cas-4/backend:latest
- imagePullPolicy: Always
- env:
- - name: RUST_LOG
- valueFrom:
- configMapKeyRef:
- name: cas-config
- key: RUST_LOG
- - name: DATABASE_URL
- valueFrom:
- configMapKeyRef:
- name: cas-config
- key: DATABASE_URL
- - name: JWT_SECRET
- valueFrom:
- secretKeyRef:
- name: cas-secret
- key: JWT_SECRET
- - name: EXPO_ACCESS_TOKEN
- valueFrom:
- secretKeyRef:
- name: cas-secret
- key: EXPO_ACCESS_TOKEN
- - name: UNREALSPEECH_TOKEN
- valueFrom:
- secretKeyRef:
- name: cas-secret
- key: UNREALSPEECH_TOKEN
- - name: ALLOWED_HOST
- valueFrom:
- configMapKeyRef:
- name: cas-config
- key: ALLOWED_HOST
- ports:
- - containerPort: 8000
- restartPolicy: Always
diff --git a/k8s/cas-secret.yaml b/k8s/cas-secret.yaml
deleted file mode 100644
index a2fc3e3..0000000
--- a/k8s/cas-secret.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-apiVersion: v1
-kind: Secret
-metadata:
- name: cas-secret
-type: Opaque
-data:
- JWT_SECRET: ${JWT_SECRET}
- EXPO_ACCESS_TOKEN: ${EXPO_ACCESS_TOKEN}
- UNREALSPEECH_TOKEN: ${UNREALSPEECH_TOKEN}
diff --git a/k8s/cas-service.yaml b/k8s/cas-service.yaml
deleted file mode 100644
index 98a7a9d..0000000
--- a/k8s/cas-service.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
- name: cas-service
-spec:
- ports:
- - port: 8000
- targetPort: 8000
- selector:
- app: cas
- type: ClusterIP
diff --git a/k8s/network-policy.yaml b/k8s/network-policy.yaml
deleted file mode 100644
index 2af8a27..0000000
--- a/k8s/network-policy.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-apiVersion: networking.k8s.io/v1
-kind: NetworkPolicy
-metadata:
- name: allow-cas-postgres
-spec:
- podSelector:
- matchLabels:
- app: cas
- policyTypes:
- - Ingress
- ingress:
- - from:
- - podSelector:
- matchLabels:
- app: postgres
- ports:
- - protocol: TCP
- port: 5432
diff --git a/k8s/pgdata-pvc.yaml b/k8s/pgdata-pvc.yaml
deleted file mode 100644
index 7580530..0000000
--- a/k8s/pgdata-pvc.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: pgdata-pvc
-spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 1Gi
diff --git a/k8s/postgres-deployment.yaml b/k8s/postgres-deployment.yaml
deleted file mode 100644
index fd9945f..0000000
--- a/k8s/postgres-deployment.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: postgres-deployment
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: postgres
- template:
- metadata:
- labels:
- app: postgres
- spec:
- containers:
- - name: postgres
- image: postgis/postgis:16-3.4
- env:
- - name: POSTGRES_USER
- value: "postgres"
- - name: POSTGRES_PASSWORD
- value: "password"
- - name: POSTGRES_DB
- value: "gis"
- ports:
- - containerPort: 5432
- volumeMounts:
- - mountPath: /var/lib/postgresql/data
- name: pgdata
- - mountPath: /docker-entrypoint-initdb.d
- name: schema
- volumes:
- - name: pgdata
- persistentVolumeClaim:
- claimName: pgdata-pvc
- - name: schema
- hostPath:
- path: ${PGDATA}
diff --git a/k8s/postgres-service.yaml b/k8s/postgres-service.yaml
deleted file mode 100644
index ad3b969..0000000
--- a/k8s/postgres-service.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
- name: postgres-service
-spec:
- ports:
- - port: 5432
- targetPort: 5432
- selector:
- app: postgres
- type: ClusterIP
diff --git a/scripts/k8s b/scripts/k8s
deleted file mode 100755
index 350a19a..0000000
--- a/scripts/k8s
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-usage() {
- echo "Usage: $0 (apply|delete)"
-}
-
-if [ $# -ne 1 ]; then
- usage
- exit 1
-fi
-
-command=$1
-
-if [ "$1" != "apply" ] && [ "$1" != "delete" ]; then
- usage
- exit 1
-fi
-
-K8S_FOLDER="../k8s"
-
-if [ "$(basename "$PWD")" = "backend" ]; then
- K8S_FOLDER="./k8s"
-fi
-
-YAML_FILES=(
- "cas-config.yaml"
- "cas-deployment.yaml"
- "cas-secret.yaml"
- "cas-service.yaml"
- "network-policy.yaml"
- "pgdata-pvc.yaml"
- "postgres-deployment.yaml"
- "postgres-service.yaml"
-)
-
-for file in "${YAML_FILES[@]}"; do
- file="$K8S_FOLDER/$file"
- echo "${command^}ing $file ..."
- envsubst < $file | kubectl "$command" -f -
-done