Skip to content

Commit

Permalink
Merge pull request #206 from Tauffer-Consulting/k8s-config
Browse files Browse the repository at this point in the history
K8s config
  • Loading branch information
vinicvaz authored Dec 15, 2023
2 parents 8e37c73 + a0d2282 commit bf35832
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 29 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release-frontend-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ jobs:
tags: ghcr.io/tauffer-consulting/domino-frontend:k8s-dev
context: frontend
file: frontend/Dockerfile.prod # Path to the Dockerfile
env:
API_ENV: dev

release-domino-frontend-compose:
name: Domino Frontend Image
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ jobs:
tags: ghcr.io/tauffer-consulting/domino-frontend:k8s
context: frontend
file: frontend/Dockerfile.prod # Path to the Dockerfile
env:
VITE_API_ENV: prod

release-domino-frontend-compose:
name: Domino Frontend Image
Expand Down
1 change: 1 addition & 0 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ services:
environment:
- API_ENV=local
- DOMINO_DEPLOY_MODE=local-compose
- API_URL=http://localhost:8000
ports:
- 3000:3000
volumes:
Expand Down
1 change: 1 addition & 0 deletions frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# These values are placeholders
API_ENV="local"
DOMINO_DEPLOY_MODE="local-compose"
API_URL="http://localhost:8000"
1 change: 1 addition & 0 deletions frontend/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set -e

echo "API_ENV=$API_ENV" >> .env.production
echo "DOMINO_DEPLOY_MODE=$DOMINO_DEPLOY_MODE" >> .env.production
echo "API_URL=$API_URL" >> .env.production

/usr/share/nginx/html/import-meta-env -x .env.production -p /usr/share/nginx/html/index.html || exit 1

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/config/environment.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface IEnvironment {
NODE_ENV: INodeEnv;
API_ENV: IApiEnv;
USE_MOCK: boolean;
API_URL: string;
}

/**
Expand All @@ -16,5 +17,6 @@ export interface IEnvironment {
export const environment: IEnvironment = {
NODE_ENV: import.meta.env.NODE_ENV as INodeEnv,
API_ENV: import.meta.env.API_ENV as IApiEnv,
API_URL: import.meta.env.API_URL as string,
USE_MOCK: !!import.meta.env.VITE_USE_MOCK,
};
2 changes: 1 addition & 1 deletion frontend/src/services/config/endpoints.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const configEndpoints: Record<IApiEnv, IEndpoints> = {
api: "http://localhost/api",
},
prod: {
api: "http://localhost/api",
api: environment.API_URL,
},
};

Expand Down
4 changes: 2 additions & 2 deletions helm/domino/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: domino
description: A Helm chart for Domino
type: application
version: 0.1.8
appVersion: 0.1.8
version: 0.1.9
appVersion: 0.1.9
home: https://github.com/Tauffer-Consulting/domino
sources:
- https://github.com/Tauffer-Consulting/domino
15 changes: 3 additions & 12 deletions helm/domino/templates/domino-frontend-deployment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- if .Values.frontend.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
metadata:
name: {{ .Release.Name }}-frontend
labels:
app: {{ .Release.Name }}-frontend
Expand Down Expand Up @@ -32,14 +32,8 @@ spec:
value: {{ .Values.frontend.apiEnv }}
- name: DOMINO_DEPLOY_MODE
value: {{ .Values.frontend.deployMode }}

# resources:
# limits:
# memory: {{ .Values.frontend.memoryLimit }}
# cpu: {{ .Values.frontend.cpuLimit }}
# requests:
# memory: {{ .Values.frontend.memoryRequest }}
# cpu: {{ .Values.frontend.cpuRequest }}
- name: API_URL
value: {{ .Values.frontend.apiUrl }}

---
# Frontend Service
Expand All @@ -52,7 +46,4 @@ spec:
app: {{ .Release.Name }}-frontend
ports:
- port: 80
#targetPort: 3000
#nodePort: 30030
#type: NodePort
{{- end}}
6 changes: 2 additions & 4 deletions helm/domino/templates/domino-rest-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
ports:
- containerPort: 8000
imagePullPolicy: IfNotPresent
env:
env:
# TODO use load balancer instead of service ip for airflow webserver ?
- name: AIRFLOW_WEBSERVER_HOST
value: http://airflow-webserver:8080
Expand Down Expand Up @@ -59,7 +59,7 @@ spec:
- name: DOMINO_GITHUB_WORKFLOWS_REPOSITORY
value: {{ .Values.rest.workflowsRepository }}
{{- if .Values.rest.extraVolumeMounts }}
volumeMounts:
volumeMounts:
{{ toYaml .Values.rest.extraVolumeMounts | indent 12 }}
{{- end }}
resources:
Expand All @@ -86,6 +86,4 @@ spec:
app: {{ .Release.Name }}-rest
ports:
- port: 8000
#- protocol: "TCP"
#targetPort: 8000

1 change: 1 addition & 0 deletions helm/domino/templates/ingress-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
ingressClassName: nginx
rules:
- http:
paths:
Expand Down
1 change: 1 addition & 0 deletions helm/domino/templates/ingress-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
ingressClassName: nginx
rules:
- http:
paths:
Expand Down
1 change: 1 addition & 0 deletions helm/domino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ frontend:
enabled: true
image: ghcr.io/tauffer-consulting/domino-frontend
tag: latest
apiUrl: http://localhost/api

# REST service
rest:
Expand Down
5 changes: 3 additions & 2 deletions src/domino/cli/utils/docker-compose-without-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ x-airflow-common:
postgres:
condition: service_healthy

services:
services:
postgres:
image: postgres:13
container_name: airflow-postgres
Expand Down Expand Up @@ -319,7 +319,8 @@ services:
environment:
- API_ENV=local
- DOMINO_DEPLOY_MODE=local-compose

- API_URL=http://localhost:8000

# Domino Docker proxy
docker-proxy:
image: bobrik/socat
Expand Down
5 changes: 3 additions & 2 deletions src/domino/cli/utils/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ x-airflow-common:
postgres:
condition: service_healthy

services:
services:
postgres:
image: postgres:13
container_name: airflow-postgres
Expand Down Expand Up @@ -350,7 +350,8 @@ services:
environment:
- API_ENV=local
- DOMINO_DEPLOY_MODE=local-compose

- API_URL=http://localhost:8000

# Domino Docker proxy
docker-proxy:
image: bobrik/socat
Expand Down
4 changes: 2 additions & 2 deletions src/domino/cli/utils/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
"enabled": True,
"image": domino_frontend_image,
"apiEnv": "dev" if platform_config['kind']["DOMINO_DEPLOY_MODE"] in ['local-k8s-dev', 'local-k8s'] else 'prod',
"deployMode": platform_config['kind']["DOMINO_DEPLOY_MODE"]
"deployMode": platform_config['kind']["DOMINO_DEPLOY_MODE"],
},
"rest": {
"enabled": True,
Expand Down Expand Up @@ -384,7 +384,7 @@ def create_platform(install_airflow: bool = True, use_gpu: bool = False) -> None
},
"config": {
"api": {
"auth_backend": "airflow.api.auth.backend.basic_auth"
"auth_backends": "airflow.api.auth.backend.basic_auth"
},
},
"dags": {
Expand Down

0 comments on commit bf35832

Please sign in to comment.