Allow CORS in backend
This commit is contained in:
parent
02541a62ea
commit
994d7bb093
@ -46,9 +46,17 @@ app = FastAPI(
|
|||||||
description="API פשוט לבחירת מתכונים לצהריים / ערב / כל ארוחה 😋",
|
description="API פשוט לבחירת מתכונים לצהריים / ערב / כל ארוחה 😋",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Allow CORS from frontend domains
|
||||||
|
allowed_origins = [
|
||||||
|
"http://localhost:5173",
|
||||||
|
"http://localhost:3000",
|
||||||
|
"https://my-recipes.dvirlabs.com",
|
||||||
|
"http://my-recipes.dvirlabs.com",
|
||||||
|
]
|
||||||
|
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=["http://localhost:5173", "http://localhost:3000"],
|
allow_origins=allowed_origins,
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
|
|||||||
@ -1,110 +0,0 @@
|
|||||||
global:
|
|
||||||
namespace: my-apps
|
|
||||||
imagePullSecrets: []
|
|
||||||
# Backend configuration
|
|
||||||
backend:
|
|
||||||
name: backend
|
|
||||||
replicaCount: 1
|
|
||||||
image:
|
|
||||||
repository: harbor.dvirlabs.com/my-apps/my-recipes-backend
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
tag: "master-895786b"
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 8000
|
|
||||||
targetPort: 8000
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 128Mi
|
|
||||||
limits:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 512Mi
|
|
||||||
env:
|
|
||||||
PYTHONUNBUFFERED: "1"
|
|
||||||
tag: master-895786b
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: "nginx"
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
|
||||||
hosts:
|
|
||||||
- host: api-my-recipes.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
# Frontend configuration
|
|
||||||
frontend:
|
|
||||||
name: frontend
|
|
||||||
replicaCount: 1
|
|
||||||
image:
|
|
||||||
repository: harbor.dvirlabs.com/my-apps/my-recipes-frontend
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
tag: "master-895786b"
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 80
|
|
||||||
targetPort: 80
|
|
||||||
env:
|
|
||||||
API_BASE: "https://api-my-recipes.dvirlabs.com"
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 50m
|
|
||||||
memory: 64Mi
|
|
||||||
limits:
|
|
||||||
cpu: 200m
|
|
||||||
memory: 256Mi
|
|
||||||
tag: master-bd31ffb
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: "nginx"
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
|
||||||
hosts:
|
|
||||||
- host: my-recipes.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
# PostgreSQL configuration
|
|
||||||
postgres:
|
|
||||||
name: db
|
|
||||||
image:
|
|
||||||
repository: postgres
|
|
||||||
tag: "16"
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
user: recipes_user
|
|
||||||
password: recipes_password # POC only – later use Secret/ExternalSecret
|
|
||||||
database: recipes_db
|
|
||||||
port: 5432
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 5432
|
|
||||||
targetPort: 5432
|
|
||||||
persistence:
|
|
||||||
enabled: true
|
|
||||||
accessMode: ReadWriteOnce
|
|
||||||
storageClass: "nfs-client"
|
|
||||||
size: 8Gi
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 256Mi
|
|
||||||
limits:
|
|
||||||
cpu: 1000m
|
|
||||||
memory: 1Gi
|
|
||||||
# Ingress (top-level, disabled - use component-specific ingress instead)
|
|
||||||
ingress:
|
|
||||||
enabled: false
|
|
||||||
className: "nginx"
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
|
||||||
hosts:
|
|
||||||
- host: my-recipes.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
backend: frontend
|
|
||||||
tls:
|
|
||||||
- secretName: recipes-tls
|
|
||||||
hosts:
|
|
||||||
- my-recipes.dvirlabs.com
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
frontend:
|
|
||||||
image:
|
|
||||||
repository: harbor.dvirlabs.com/my-apps/navix-frontend
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
tag: master-e56328b
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 80
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: traefik
|
|
||||||
annotations:
|
|
||||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
|
||||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
|
||||||
hosts:
|
|
||||||
- host: navix.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
env:
|
|
||||||
API_BASE: "https://api-navix.dvirlabs.com/api"
|
|
||||||
MINIO_ENDPOINT: "s3.dvirlabs.com"
|
|
||||||
MINIO_BUCKET: "navix-icons"
|
|
||||||
backend:
|
|
||||||
image:
|
|
||||||
repository: harbor.dvirlabs.com/my-apps/navix-backend
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
tag: master-62a2769
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 8000
|
|
||||||
env:
|
|
||||||
MINIO_ACCESS_KEY: "your-access-key"
|
|
||||||
MINIO_SECRET_KEY: "your-secret-key"
|
|
||||||
MINIO_ENDPOINT: "s3.dvirlabs.com"
|
|
||||||
MINIO_BUCKET: "navix-icons"
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: traefik
|
|
||||||
annotations:
|
|
||||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
|
||||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
|
||||||
hosts:
|
|
||||||
- host: api-navix.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /api
|
|
||||||
pathType: Prefix
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
apiVersion: v2
|
|
||||||
name: my-recipes
|
|
||||||
description: Complete recipe management application with PostgreSQL, FastAPI backend, and React frontend
|
|
||||||
type: application
|
|
||||||
version: 1.0.0
|
|
||||||
appVersion: "1.0.0"
|
|
||||||
keywords:
|
|
||||||
- recipes
|
|
||||||
- fastapi
|
|
||||||
- react
|
|
||||||
- postgresql
|
|
||||||
maintainers:
|
|
||||||
- name: Development Team
|
|
||||||
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-{{ .Values.backend.name }}
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.backend.name }}
|
|
||||||
component: backend
|
|
||||||
spec:
|
|
||||||
replicas: {{ .Values.backend.replicaCount }}
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.backend.name }}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.backend.name }}
|
|
||||||
component: backend
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: {{ .Values.backend.name }}
|
|
||||||
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- containerPort: {{ .Values.backend.service.targetPort }}
|
|
||||||
name: http
|
|
||||||
protocol: TCP
|
|
||||||
env:
|
|
||||||
{{- if .Values.backend.env }}
|
|
||||||
{{- range $key, $value := .Values.backend.env }}
|
|
||||||
- name: {{ $key }}
|
|
||||||
value: {{ $value | quote }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
envFrom:
|
|
||||||
- secretRef:
|
|
||||||
name: {{ .Release.Name }}-db-credentials
|
|
||||||
startupProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /docs
|
|
||||||
port: http
|
|
||||||
initialDelaySeconds: 15
|
|
||||||
periodSeconds: 5
|
|
||||||
timeoutSeconds: 3
|
|
||||||
failureThreshold: 30
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /docs
|
|
||||||
port: http
|
|
||||||
initialDelaySeconds: 30
|
|
||||||
periodSeconds: 10
|
|
||||||
timeoutSeconds: 5
|
|
||||||
failureThreshold: 3
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /docs
|
|
||||||
port: http
|
|
||||||
initialDelaySeconds: 10
|
|
||||||
periodSeconds: 5
|
|
||||||
timeoutSeconds: 3
|
|
||||||
failureThreshold: 2
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: {{ .Values.backend.resources.requests.cpu }}
|
|
||||||
memory: {{ .Values.backend.resources.requests.memory }}
|
|
||||||
limits:
|
|
||||||
cpu: {{ .Values.backend.resources.limits.cpu }}
|
|
||||||
memory: {{ .Values.backend.resources.limits.memory }}
|
|
||||||
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-{{ .Values.backend.name }}
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.backend.name }}
|
|
||||||
component: backend
|
|
||||||
spec:
|
|
||||||
type: {{ .Values.backend.service.type }}
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.backend.service.port }}
|
|
||||||
targetPort: {{ .Values.backend.service.targetPort }}
|
|
||||||
protocol: TCP
|
|
||||||
name: http
|
|
||||||
selector:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.backend.name }}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-db-schema
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
data:
|
|
||||||
schema.sql: |
|
|
||||||
-- Create recipes table
|
|
||||||
CREATE TABLE IF NOT EXISTS recipes (
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
name TEXT NOT NULL,
|
|
||||||
meal_type TEXT NOT NULL,
|
|
||||||
time_minutes INTEGER NOT NULL,
|
|
||||||
tags JSONB NOT NULL DEFAULT '[]',
|
|
||||||
ingredients JSONB NOT NULL DEFAULT '[]',
|
|
||||||
steps JSONB NOT NULL DEFAULT '[]',
|
|
||||||
image TEXT
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_recipes_meal_type
|
|
||||||
ON recipes (meal_type);
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_recipes_time_minutes
|
|
||||||
ON recipes (time_minutes);
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_recipes_tags_jsonb
|
|
||||||
ON recipes USING GIN (tags);
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_recipes_ingredients_jsonb
|
|
||||||
ON recipes USING GIN (ingredients);
|
|
||||||
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-db-credentials
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
type: Opaque
|
|
||||||
stringData:
|
|
||||||
DB_HOST: {{ printf "%s-%s-headless.%s.svc.cluster.local" .Release.Name .Values.postgres.name .Values.global.namespace }}
|
|
||||||
DB_PORT: "{{ .Values.postgres.port }}"
|
|
||||||
DB_NAME: {{ .Values.postgres.database | quote }}
|
|
||||||
DB_USER: {{ .Values.postgres.user | quote }}
|
|
||||||
DB_PASSWORD: {{ .Values.postgres.password | quote }}
|
|
||||||
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-{{ .Values.postgres.name }}-headless
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
component: database
|
|
||||||
spec:
|
|
||||||
clusterIP: None
|
|
||||||
selector:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
ports:
|
|
||||||
- name: postgres
|
|
||||||
port: {{ .Values.postgres.port }}
|
|
||||||
targetPort: {{ .Values.postgres.port }}
|
|
||||||
protocol: TCP
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
component: database
|
|
||||||
spec:
|
|
||||||
type: {{ .Values.postgres.service.type }}
|
|
||||||
selector:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
ports:
|
|
||||||
- name: postgres
|
|
||||||
port: {{ .Values.postgres.service.port }}
|
|
||||||
targetPort: {{ .Values.postgres.port }}
|
|
||||||
protocol: TCP
|
|
||||||
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: StatefulSet
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
component: database
|
|
||||||
spec:
|
|
||||||
serviceName: {{ .Release.Name }}-{{ .Values.postgres.name }}-headless
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.postgres.name }}
|
|
||||||
component: database
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: postgres
|
|
||||||
image: "{{ .Values.postgres.image.repository }}:{{ .Values.postgres.image.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.postgres.image.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- containerPort: {{ .Values.postgres.port }}
|
|
||||||
name: postgres
|
|
||||||
protocol: TCP
|
|
||||||
env:
|
|
||||||
- name: POSTGRES_USER
|
|
||||||
value: {{ .Values.postgres.user | quote }}
|
|
||||||
- name: POSTGRES_PASSWORD
|
|
||||||
value: {{ .Values.postgres.password | quote }}
|
|
||||||
- name: POSTGRES_DB
|
|
||||||
value: {{ .Values.postgres.database | quote }}
|
|
||||||
- name: PGDATA
|
|
||||||
value: /var/lib/postgresql/data/pgdata
|
|
||||||
volumeMounts:
|
|
||||||
- name: data
|
|
||||||
mountPath: /var/lib/postgresql/data
|
|
||||||
- name: init-sql
|
|
||||||
mountPath: /docker-entrypoint-initdb.d
|
|
||||||
livenessProbe:
|
|
||||||
exec:
|
|
||||||
command:
|
|
||||||
- /bin/sh
|
|
||||||
- -c
|
|
||||||
- pg_isready -U {{ .Values.postgres.user }}
|
|
||||||
initialDelaySeconds: 30
|
|
||||||
periodSeconds: 10
|
|
||||||
timeoutSeconds: 5
|
|
||||||
failureThreshold: 3
|
|
||||||
readinessProbe:
|
|
||||||
exec:
|
|
||||||
command:
|
|
||||||
- /bin/sh
|
|
||||||
- -c
|
|
||||||
- pg_isready -U {{ .Values.postgres.user }}
|
|
||||||
initialDelaySeconds: 10
|
|
||||||
periodSeconds: 5
|
|
||||||
timeoutSeconds: 3
|
|
||||||
failureThreshold: 2
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: {{ .Values.postgres.resources.requests.cpu }}
|
|
||||||
memory: {{ .Values.postgres.resources.requests.memory }}
|
|
||||||
limits:
|
|
||||||
cpu: {{ .Values.postgres.resources.limits.cpu }}
|
|
||||||
memory: {{ .Values.postgres.resources.limits.memory }}
|
|
||||||
volumes:
|
|
||||||
- name: init-sql
|
|
||||||
configMap:
|
|
||||||
name: {{ .Release.Name }}-db-schema
|
|
||||||
volumeClaimTemplates:
|
|
||||||
- metadata:
|
|
||||||
name: data
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- {{ .Values.postgres.persistence.accessMode }}
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .Values.postgres.persistence.size }}
|
|
||||||
{{- if .Values.postgres.persistence.storageClass }}
|
|
||||||
storageClassName: {{ .Values.postgres.persistence.storageClass | quote }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
||||||
component: frontend
|
|
||||||
spec:
|
|
||||||
replicas: {{ .Values.frontend.replicaCount }}
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
||||||
component: frontend
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: {{ .Values.frontend.name }}
|
|
||||||
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- containerPort: {{ .Values.frontend.service.targetPort }}
|
|
||||||
name: http
|
|
||||||
protocol: TCP
|
|
||||||
{{- with .Values.frontend.env }}
|
|
||||||
env:
|
|
||||||
{{- range $key, $value := . }}
|
|
||||||
- name: {{ $key }}
|
|
||||||
value: {{ $value | quote }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /
|
|
||||||
port: http
|
|
||||||
initialDelaySeconds: 10
|
|
||||||
periodSeconds: 10
|
|
||||||
timeoutSeconds: 5
|
|
||||||
failureThreshold: 3
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /
|
|
||||||
port: http
|
|
||||||
initialDelaySeconds: 5
|
|
||||||
periodSeconds: 5
|
|
||||||
timeoutSeconds: 3
|
|
||||||
failureThreshold: 2
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: {{ .Values.frontend.resources.requests.cpu }}
|
|
||||||
memory: {{ .Values.frontend.resources.requests.memory }}
|
|
||||||
limits:
|
|
||||||
cpu: {{ .Values.frontend.resources.limits.cpu }}
|
|
||||||
memory: {{ .Values.frontend.resources.limits.memory }}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
||||||
component: frontend
|
|
||||||
spec:
|
|
||||||
type: {{ .Values.frontend.service.type }}
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.frontend.service.port }}
|
|
||||||
targetPort: {{ .Values.frontend.service.targetPort }}
|
|
||||||
protocol: TCP
|
|
||||||
name: http
|
|
||||||
selector:
|
|
||||||
app: {{ .Release.Name }}-{{ .Values.frontend.name }}
|
|
||||||
@ -1,89 +0,0 @@
|
|||||||
{{- if .Values.frontend.ingress.enabled }}
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-frontend
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-frontend
|
|
||||||
component: frontend
|
|
||||||
{{- with .Values.frontend.ingress.annotations }}
|
|
||||||
annotations:
|
|
||||||
{{- toYaml . | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
{{- if .Values.frontend.ingress.className }}
|
|
||||||
ingressClassName: {{ .Values.frontend.ingress.className }}
|
|
||||||
{{- end }}
|
|
||||||
rules:
|
|
||||||
{{- range .Values.frontend.ingress.hosts }}
|
|
||||||
- host: {{ .host | quote }}
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
{{- range .paths }}
|
|
||||||
- path: {{ .path }}
|
|
||||||
pathType: {{ .pathType }}
|
|
||||||
backend:
|
|
||||||
service:
|
|
||||||
name: {{ $.Release.Name }}-{{ $.Values.frontend.name }}
|
|
||||||
port:
|
|
||||||
number: {{ $.Values.frontend.service.port }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.frontend.ingress.tls }}
|
|
||||||
tls:
|
|
||||||
{{- range .Values.frontend.ingress.tls }}
|
|
||||||
- hosts:
|
|
||||||
{{- range .hosts }}
|
|
||||||
- {{ . | quote }}
|
|
||||||
{{- end }}
|
|
||||||
secretName: {{ .secretName }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
{{- if .Values.backend.ingress.enabled }}
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: {{ .Release.Name }}-backend
|
|
||||||
namespace: {{ .Values.global.namespace }}
|
|
||||||
labels:
|
|
||||||
app: {{ .Release.Name }}-backend
|
|
||||||
component: backend
|
|
||||||
{{- with .Values.backend.ingress.annotations }}
|
|
||||||
annotations:
|
|
||||||
{{- toYaml . | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
{{- if .Values.backend.ingress.className }}
|
|
||||||
ingressClassName: {{ .Values.backend.ingress.className }}
|
|
||||||
{{- end }}
|
|
||||||
rules:
|
|
||||||
{{- range .Values.backend.ingress.hosts }}
|
|
||||||
- host: {{ .host | quote }}
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
{{- range .paths }}
|
|
||||||
- path: {{ .path }}
|
|
||||||
pathType: {{ .pathType }}
|
|
||||||
backend:
|
|
||||||
service:
|
|
||||||
name: {{ $.Release.Name }}-{{ $.Values.backend.name }}
|
|
||||||
port:
|
|
||||||
number: {{ $.Values.backend.service.port }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.backend.ingress.tls }}
|
|
||||||
tls:
|
|
||||||
{{- range .Values.backend.ingress.tls }}
|
|
||||||
- hosts:
|
|
||||||
{{- range .hosts }}
|
|
||||||
- {{ . | quote }}
|
|
||||||
{{- end }}
|
|
||||||
secretName: {{ .secretName }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
@ -1,125 +0,0 @@
|
|||||||
global:
|
|
||||||
namespace: my-apps
|
|
||||||
imagePullSecrets: []
|
|
||||||
|
|
||||||
# Backend configuration
|
|
||||||
backend:
|
|
||||||
name: backend
|
|
||||||
replicaCount: 2
|
|
||||||
image:
|
|
||||||
repository: harbor.dvirlabs.com/my-apps/my-recipes-backend
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
tag: "latest"
|
|
||||||
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 8000
|
|
||||||
targetPort: 8000
|
|
||||||
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 128Mi
|
|
||||||
limits:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 512Mi
|
|
||||||
|
|
||||||
env:
|
|
||||||
PYTHONUNBUFFERED: "1"
|
|
||||||
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: "nginx"
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
|
||||||
hosts:
|
|
||||||
- host: api-my-recipes.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
|
|
||||||
# Frontend configuration
|
|
||||||
frontend:
|
|
||||||
name: frontend
|
|
||||||
replicaCount: 2
|
|
||||||
image:
|
|
||||||
repository: harbor.dvirlabs.com/my-apps/my-recipes-frontend
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
tag: "latest"
|
|
||||||
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 80
|
|
||||||
targetPort: 80
|
|
||||||
|
|
||||||
env:
|
|
||||||
API_BASE: "https://api-my-recipes.dvirlabs.com"
|
|
||||||
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 50m
|
|
||||||
memory: 64Mi
|
|
||||||
limits:
|
|
||||||
cpu: 200m
|
|
||||||
memory: 256Mi
|
|
||||||
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: "nginx"
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
|
||||||
hosts:
|
|
||||||
- host: my-recipes.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
|
|
||||||
# PostgreSQL configuration
|
|
||||||
postgres:
|
|
||||||
name: db
|
|
||||||
image:
|
|
||||||
repository: postgres
|
|
||||||
tag: "16-alpine"
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
|
|
||||||
user: recipes_user
|
|
||||||
password: recipes_password
|
|
||||||
database: recipes_db
|
|
||||||
port: 5432
|
|
||||||
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 5432
|
|
||||||
targetPort: 5432
|
|
||||||
|
|
||||||
persistence:
|
|
||||||
enabled: true
|
|
||||||
accessMode: ReadWriteOnce
|
|
||||||
storageClass: "nfs-client"
|
|
||||||
size: 10Gi
|
|
||||||
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 256Mi
|
|
||||||
limits:
|
|
||||||
cpu: 1000m
|
|
||||||
memory: 1Gi
|
|
||||||
|
|
||||||
# Ingress configuration
|
|
||||||
ingress:
|
|
||||||
enabled: false # Individual frontend/backend ingress resources handle routing instead
|
|
||||||
className: "nginx"
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
|
||||||
hosts:
|
|
||||||
- host: my-recipes.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
backend: frontend
|
|
||||||
tls:
|
|
||||||
- secretName: recipes-tls
|
|
||||||
hosts:
|
|
||||||
- my-recipes.dvirlabs.com
|
|
||||||
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
apiVersion: v2
|
|
||||||
name: navix
|
|
||||||
version: 0.1.0
|
|
||||||
description: A DevOps dashboard called Navix
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: navix-backend
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: navix-backend
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: navix-backend
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: backend
|
|
||||||
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- containerPort: 8000
|
|
||||||
env:
|
|
||||||
- name: MINIO_ACCESS_KEY
|
|
||||||
value: "{{ .Values.backend.env.MINIO_ACCESS_KEY }}"
|
|
||||||
- name: MINIO_SECRET_KEY
|
|
||||||
value: "{{ .Values.backend.env.MINIO_SECRET_KEY }}"
|
|
||||||
- name: MINIO_ENDPOINT
|
|
||||||
value: "{{ .Values.backend.env.MINIO_ENDPOINT }}"
|
|
||||||
- name: MINIO_BUCKET
|
|
||||||
value: "{{ .Values.backend.env.MINIO_BUCKET }}"
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: navix-backend
|
|
||||||
spec:
|
|
||||||
type: {{ .Values.backend.service.type }}
|
|
||||||
selector:
|
|
||||||
app: navix-backend
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.backend.service.port }}
|
|
||||||
targetPort: 8000
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: navix-frontend
|
|
||||||
spec:
|
|
||||||
replicas: 1
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: navix-frontend
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: navix-frontend
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: frontend
|
|
||||||
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
|
|
||||||
ports:
|
|
||||||
- containerPort: 80
|
|
||||||
env:
|
|
||||||
- name: API_BASE
|
|
||||||
value: {{ .Values.frontend.env.API_BASE | quote }}
|
|
||||||
- name: MINIO_ENDPOINT
|
|
||||||
value: {{ .Values.frontend.env.MINIO_ENDPOINT | quote }}
|
|
||||||
- name: MINIO_BUCKET
|
|
||||||
value: {{ .Values.frontend.env.MINIO_BUCKET | quote }}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: navix-frontend
|
|
||||||
spec:
|
|
||||||
type: {{ .Values.frontend.service.type }}
|
|
||||||
selector:
|
|
||||||
app: navix-frontend
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.frontend.service.port }}
|
|
||||||
targetPort: 80
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
{{- if .Values.frontend.ingress.enabled }}
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: navix-frontend
|
|
||||||
annotations:
|
|
||||||
{{- range $key, $value := .Values.frontend.ingress.annotations }}
|
|
||||||
{{ $key }}: {{ $value | quote }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
ingressClassName: {{ .Values.frontend.ingress.className }}
|
|
||||||
rules:
|
|
||||||
{{- range .Values.frontend.ingress.hosts }}
|
|
||||||
- host: {{ .host }}
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
{{- range .paths }}
|
|
||||||
- path: {{ .path }}
|
|
||||||
pathType: {{ .pathType }}
|
|
||||||
backend:
|
|
||||||
service:
|
|
||||||
name: navix-frontend
|
|
||||||
port:
|
|
||||||
number: {{ $.Values.frontend.service.port }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
{{- if .Values.backend.ingress.enabled }}
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: navix-backend
|
|
||||||
annotations:
|
|
||||||
{{- range $key, $value := .Values.backend.ingress.annotations }}
|
|
||||||
{{ $key }}: {{ $value | quote }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
ingressClassName: {{ .Values.backend.ingress.className }}
|
|
||||||
rules:
|
|
||||||
{{- range .Values.backend.ingress.hosts }}
|
|
||||||
- host: {{ .host }}
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
{{- range .paths }}
|
|
||||||
- path: {{ .path }}
|
|
||||||
pathType: {{ .pathType }}
|
|
||||||
backend:
|
|
||||||
service:
|
|
||||||
name: navix-backend
|
|
||||||
port:
|
|
||||||
number: {{ $.Values.backend.service.port }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
frontend:
|
|
||||||
image:
|
|
||||||
repository: harbor.dvirlabs.com/my-apps/navix-front
|
|
||||||
tag: latest
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 80
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: traefik
|
|
||||||
annotations:
|
|
||||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
|
||||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
|
||||||
hosts:
|
|
||||||
- host: navix.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
env:
|
|
||||||
API_BASE: "https://navix.dvirlabs.com/api"
|
|
||||||
MINIO_ENDPOINT: "s3.dvirlabs.com"
|
|
||||||
MINIO_BUCKET: "navix-icons"
|
|
||||||
|
|
||||||
backend:
|
|
||||||
image:
|
|
||||||
repository: harbor.dvirlabs.com/my-apps/navix-back
|
|
||||||
tag: latest
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
service:
|
|
||||||
type: ClusterIP
|
|
||||||
port: 8000
|
|
||||||
env:
|
|
||||||
MINIO_ACCESS_KEY: "your-access-key"
|
|
||||||
MINIO_SECRET_KEY: "your-secret-key"
|
|
||||||
MINIO_ENDPOINT: "s3.dvirlabs.com"
|
|
||||||
MINIO_BUCKET: "navix-icons"
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
className: traefik
|
|
||||||
annotations:
|
|
||||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
|
||||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
|
||||||
hosts:
|
|
||||||
- host: navix.dvirlabs.com
|
|
||||||
paths:
|
|
||||||
- path: /api
|
|
||||||
pathType: Prefix
|
|
||||||
Loading…
x
Reference in New Issue
Block a user