feat: add Docker, Drone CI, and k8s deployment manifests

- Dockerfile for Python 3.12 FastAPI app
- Drone CI pipeline to build and push to internal registry
- Kubernetes manifests (Deployment, Service, Secret, Namespace)
- ArgoCD Application for GitOps deployment
- Kustomize base configuration
This commit is contained in:
Yaojia Wang
2026-03-09 23:28:31 +01:00
parent e3e9c1986c
commit d05cb55cb0
9 changed files with 170 additions and 0 deletions

56
k8s/base/deployment.yaml Normal file
View File

@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: invest-api
namespace: invest-api
labels:
app: invest-api
spec:
replicas: 1
selector:
matchLabels:
app: invest-api
template:
metadata:
labels:
app: invest-api
spec:
containers:
- name: invest-api
image: 192.168.68.11:30500/invest-api:latest
imagePullPolicy: Always
ports:
- containerPort: 8000
protocol: TCP
env:
- name: INVEST_API_HOST
value: "0.0.0.0"
- name: INVEST_API_PORT
value: "8000"
- name: INVEST_API_LOG_LEVEL
value: "info"
- name: INVEST_API_CORS_ORIGINS
value: '["*"]'
envFrom:
- secretRef:
name: invest-api-secrets
optional: true
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 15
periodSeconds: 30
readinessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 5
periodSeconds: 10

View File

@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: invest-api
resources:
- namespace.yaml
- secret.yaml
- deployment.yaml
- service.yaml

4
k8s/base/namespace.yaml Normal file
View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: invest-api

11
k8s/base/secret.yaml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
name: invest-api-secrets
namespace: invest-api
type: Opaque
stringData:
# Replace with your actual keys before applying, or use sealed-secrets / external-secrets
INVEST_API_FINNHUB_API_KEY: ""
INVEST_API_FRED_API_KEY: ""
INVEST_API_ALPHAVANTAGE_API_KEY: ""

15
k8s/base/service.yaml Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: invest-api
namespace: invest-api
labels:
app: invest-api
spec:
type: ClusterIP
selector:
app: invest-api
ports:
- port: 8000
targetPort: 8000
protocol: TCP