You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
3.4 KiB

# Deployment description
apiVersion: apps/v1
kind: Deployment
metadata:
name: efc-shop-deployment
namespace: dev-environment
labels:
app: efc-shop-dev
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: efc-shop-dev
template:
metadata:
labels:
app: efc-shop-dev
spec:
# securityContext:
# runAsUser: 1000
# runAsGroup: 1000
# fsGroup: 1000
containers:
- name: efc-shop-frontend
image: packages.semapp.lan:5000/efc-shop_frontend:develop
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "4"
ports:
- containerPort: 8501
name: efc-shop-http
protocol: TCP
volumeMounts:
- mountPath: /etc/nginx/conf.d
readOnly: true
name: nginx-shop-conf
imagePullPolicy: Always
envFrom:
- configMapRef:
name: efc-shop-dev-config-dev
volumes:
- name: nginx-shop-conf
configMap:
name: nginx-shop-conf
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: dev-environment
name: efc-shop-dev-config-dev
labels:
app: efc-shop-dev
data:
REACT_APP_PROD_API_URL: "http://efc-shop-dev.k3s.semapp.lan/"
REACT_APP_DEV_API_URL: http://efc-shop-dev.k3s.semapp.lan/
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: dev-environment
name: nginx-shop-conf
data:
default.conf: |
upstream backend {
server efc-backend-dev:5500;
}
server {
listen 8501;
access_log /var/log/nginx/access.log;
charset utf-8;
client_max_body_size 1G;
location / {
root /srv/efc-shop;
index index.html index.htm;
try_files $uri $uri /index.html =404;
}
location ~ ^/api {
proxy_pass http://backend;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
send_timeout 300s;
}
location /storage {
proxy_pass http://backend/storage;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
send_timeout 300s;
}
error_page 404 =200 /index.html;
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
expires off;
open_file_cache off;
sendfile off;
}
---
# EFC Service
apiVersion: v1
kind: Service
metadata:
name: efc-shop-frontend-dev
namespace: dev-environment
spec:
selector:
app: efc-shop-dev
ports:
- name: efc-http
port: 8501
targetPort: efc-shop-http
type: NodePort
---
# Ingress description
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: efc-shop-dev-ingress
namespace: dev-environment
annotations:
kubernetes.io/ingress.class: "traefik"
spec:
rules:
- host: efc-shop-dev.k3s.semapp.lan
http:
paths:
- path: /
backend:
serviceName: efc-shop-frontend-dev
servicePort: 8501