local env done
This commit is contained in:
@@ -43,6 +43,7 @@ docker_build(
|
|||||||
k8s_resource('minio')
|
k8s_resource('minio')
|
||||||
k8s_resource('lambda', resource_deps=['minio'])
|
k8s_resource('lambda', resource_deps=['minio'])
|
||||||
k8s_resource('docs')
|
k8s_resource('docs')
|
||||||
|
k8s_resource('gateway', resource_deps=['docs', 'minio'])
|
||||||
|
|
||||||
k8s_resource(
|
k8s_resource(
|
||||||
objects=['eth:namespace', 'eth-config:configmap'],
|
objects=['eth:namespace', 'eth-config:configmap'],
|
||||||
|
|||||||
12
ctrl/k8s/base/Caddyfile
Normal file
12
ctrl/k8s/base/Caddyfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
auto_https off
|
||||||
|
admin off
|
||||||
|
}
|
||||||
|
|
||||||
|
eth.local.ar:80 {
|
||||||
|
reverse_proxy docs:80
|
||||||
|
}
|
||||||
|
|
||||||
|
minio.eth.local.ar:80 {
|
||||||
|
reverse_proxy minio:9001
|
||||||
|
}
|
||||||
53
ctrl/k8s/base/gateway.yaml
Normal file
53
ctrl/k8s/base/gateway.yaml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: gateway
|
||||||
|
namespace: eth
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: gateway
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: gateway
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: caddy
|
||||||
|
image: caddy:2-alpine
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
name: http
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /etc/caddy
|
||||||
|
readOnly: true
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: 80
|
||||||
|
initialDelaySeconds: 2
|
||||||
|
periodSeconds: 10
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 32Mi
|
||||||
|
cpu: 50m
|
||||||
|
limits:
|
||||||
|
memory: 128Mi
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: gateway-config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: gateway
|
||||||
|
namespace: eth
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: gateway
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
targetPort: 80
|
||||||
@@ -9,3 +9,13 @@ resources:
|
|||||||
- minio.yaml
|
- minio.yaml
|
||||||
- lambda.yaml
|
- lambda.yaml
|
||||||
- docs.yaml
|
- docs.yaml
|
||||||
|
- gateway.yaml
|
||||||
|
|
||||||
|
# Generate the gateway Caddyfile ConfigMap from the standalone file.
|
||||||
|
# Hash suffix is on by default — when Caddyfile changes, the ConfigMap gets
|
||||||
|
# a new hashed name, kustomize rewrites the Deployment volume reference,
|
||||||
|
# and the gateway pod restarts automatically with the new config.
|
||||||
|
configMapGenerator:
|
||||||
|
- name: gateway-config
|
||||||
|
files:
|
||||||
|
- Caddyfile
|
||||||
|
|||||||
@@ -21,9 +21,18 @@ spec:
|
|||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: eth-config
|
name: eth-config
|
||||||
|
volumeMounts:
|
||||||
|
- name: documents
|
||||||
|
mountPath: /mnt/documents
|
||||||
|
readOnly: true
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
memory: 128Mi
|
memory: 128Mi
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
limits:
|
limits:
|
||||||
memory: 512Mi
|
memory: 512Mi
|
||||||
|
volumes:
|
||||||
|
- name: documents
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/documents
|
||||||
|
type: Directory
|
||||||
|
|||||||
@@ -8,3 +8,7 @@ nodes:
|
|||||||
hostPort: 8050
|
hostPort: 8050
|
||||||
listenAddress: "0.0.0.0"
|
listenAddress: "0.0.0.0"
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
extraMounts:
|
||||||
|
- hostPath: /home/mariano/Documents
|
||||||
|
containerPath: /mnt/documents
|
||||||
|
readOnly: true
|
||||||
|
|||||||
@@ -5,9 +5,11 @@ resources:
|
|||||||
- ../../base
|
- ../../base
|
||||||
|
|
||||||
patches:
|
patches:
|
||||||
|
# In-cluster Caddy gateway owns the single NodePort. It routes by Host header
|
||||||
|
# to docs / minio / future services via service DNS inside the cluster.
|
||||||
- target:
|
- target:
|
||||||
kind: Service
|
kind: Service
|
||||||
name: docs
|
name: gateway
|
||||||
patch: |
|
patch: |
|
||||||
- op: replace
|
- op: replace
|
||||||
path: /spec/type
|
path: /spec/type
|
||||||
|
|||||||
3
ctrl/seed.sh
Executable file
3
ctrl/seed.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
kubectl --context kind-eth -n eth exec -i deploy/lambda -- python seed.py /mnt/documents
|
||||||
@@ -23,7 +23,7 @@ async def _run():
|
|||||||
|
|
||||||
async def producer():
|
async def producer():
|
||||||
paginator = s3.get_paginator("list_objects_v2")
|
paginator = s3.get_paginator("list_objects_v2")
|
||||||
async for page in paginator.paginate(Bucket=BUCKET, Prefix=PREFIX):
|
async for page in paginator.paginate(Bucket=BUCKET, Prefix=PREFIX, PaginationConfig={"PageSize": 100}):
|
||||||
for obj in page.get("Contents", []) or []:
|
for obj in page.get("Contents", []) or []:
|
||||||
key = obj["Key"]
|
key = obj["Key"]
|
||||||
if key.lower().endswith(".pdf"):
|
if key.lower().endswith(".pdf"):
|
||||||
|
|||||||
2
seed.py
2
seed.py
@@ -8,7 +8,7 @@ from botocore.exceptions import ClientError
|
|||||||
BUCKET = os.environ.get("BUCKET_NAME", "my-company-reports-bucket")
|
BUCKET = os.environ.get("BUCKET_NAME", "my-company-reports-bucket")
|
||||||
PREFIX = os.environ.get("PREFIX", "2026/04/")
|
PREFIX = os.environ.get("PREFIX", "2026/04/")
|
||||||
ENDPOINT = os.environ.get("S3_ENDPOINT_URL", "http://localhost:9000")
|
ENDPOINT = os.environ.get("S3_ENDPOINT_URL", "http://localhost:9000")
|
||||||
DECOY_EXTS = (".txt", ".csv", ".json")
|
DECOY_EXTS = ()
|
||||||
|
|
||||||
|
|
||||||
def _client():
|
def _client():
|
||||||
|
|||||||
Reference in New Issue
Block a user