- Functional control plan
This commit is contained in:
114
k8s/dev/static-files-service.yaml
Normal file
114
k8s/dev/static-files-service.yaml
Normal file
@@ -0,0 +1,114 @@
|
||||
# Static Files Service for EveAI Dev Environment
|
||||
# File: static-files-service.yaml
|
||||
---
|
||||
# Static Files ConfigMap for nginx configuration
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: static-files-config
|
||||
namespace: eveai-dev
|
||||
data:
|
||||
nginx.conf: |
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
location /static/ {
|
||||
alias /usr/share/nginx/html/static/;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
}
|
||||
|
||||
location /health {
|
||||
return 200 'OK';
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
# Static Files Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: static-files
|
||||
namespace: eveai-dev
|
||||
labels:
|
||||
app: static-files
|
||||
environment: dev
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: static-files
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: static-files
|
||||
spec:
|
||||
initContainers:
|
||||
- name: copy-static-files
|
||||
image: registry.ask-eve-ai-local.com/josakola/nginx:latest
|
||||
command: ['sh', '-c']
|
||||
args:
|
||||
- |
|
||||
echo "Copying static files..."
|
||||
cp -r /etc/nginx/static/* /static-data/static/ 2>/dev/null || true
|
||||
ls -la /static-data/static/
|
||||
echo "Static files copied successfully"
|
||||
volumeMounts:
|
||||
- name: static-data
|
||||
mountPath: /static-data
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- containerPort: 80
|
||||
volumeMounts:
|
||||
- name: nginx-config
|
||||
mountPath: /etc/nginx/conf.d
|
||||
- name: static-data
|
||||
mountPath: /usr/share/nginx/html
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 80
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
volumes:
|
||||
- name: nginx-config
|
||||
configMap:
|
||||
name: static-files-config
|
||||
- name: static-data
|
||||
emptyDir: {}
|
||||
|
||||
---
|
||||
# Static Files Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: static-files-service
|
||||
namespace: eveai-dev
|
||||
labels:
|
||||
app: static-files
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: static-files
|
||||
Reference in New Issue
Block a user