update deployment for multi-environment setup

This commit is contained in:
2024-09-20 22:09:48 +02:00
parent c9df181256
commit d9d8aa8e8e
14 changed files with 78 additions and 32 deletions

45
base/deployment.yaml Normal file
View File

@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: anyway-backend
spec:
replicas: 1
selector:
matchLabels:
app: anyway-backend
template:
metadata:
labels:
app: anyway-backend
spec:
containers:
- name: worker
securityContext:
allowPrivilegeEscalation: false
image: backend-image
imagePullPolicy: Always
ports:
- containerPort: 8000
env:
- name: NUM_WORKERS
value: "3"
- name: OSM_CACHE_DIR
value: "/osm-cache"
- name: MEMCACHED_HOST_PATH
value: "memcached:11211"
volumeMounts:
- name: osm-cache
mountPath: /osm-cache
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 4
memory: 10Gi
volumes:
- name: osm-cache
persistentVolumeClaim:
claimName: osm-cache

15
base/ingress.yaml Normal file
View File

@@ -0,0 +1,15 @@
kind: IngressRoute
apiVersion: traefik.io/v1alpha1
metadata:
name: anyway-ingress
spec:
entryPoints:
- websecure
routes:
- match: Host(`dummy`)
kind: Rule
services:
- name: anyway-backend
port: 8000
tls:
certResolver: default-tls

10
base/kustomization.yaml Normal file
View File

@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- pvc.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
- memcached/

View File

@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: memcached
spec:
replicas: 1
selector:
matchLabels:
app: memcached
template:
metadata:
labels:
app: memcached
spec:
containers:
- name: memcached
securityContext:
allowPrivilegeEscalation: false
image: memcached
imagePullPolicy: IfNotPresent
ports:
- containerPort: 11211

View File

@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
images:
- name: memcached
newName: memcached
newTag: 1.6.29

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: memcached
spec:
selector:
app: memcached
ports:
- protocol: TCP
port: 11211
targetPort: 11211

4
base/namespace.yaml Normal file
View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: placeholder

11
base/pvc.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: osm-cache
spec:
storageClassName: "nfs-client"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "5Gi"

11
base/service.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: anyway-backend
spec:
selector:
app: anyway-backend
ports:
- protocol: TCP
port: 8000
targetPort: 8000