Files
FusionAGI/k8s/templates/bluegreen.yaml
Devin AI 94ee9a2ee5
Some checks failed
CI / lint (pull_request) Failing after 49s
CI / test (3.10) (pull_request) Failing after 32s
CI / test (3.11) (pull_request) Failing after 34s
CI / test (3.12) (pull_request) Successful in 1m22s
CI / docker (pull_request) Has been skipped
feat: implement 15 production items (SSE, security, observability, features, infra)
Performance:
- SSE dashboard streaming endpoint (GET /v1/admin/status/stream)
- Web Worker for markdown rendering (offload from main thread)
- IndexedDB chat persistence (replace localStorage, 500msg support)

Security:
- CSRF protection middleware (Origin/Referer validation)
- Content Security Policy + security headers middleware
- API key rotation endpoint (POST /v1/admin/keys/rotate)

Observability:
- OpenTelemetry tracing with graceful NoOp fallback
- Structured error codes (FAGI-xxxx taxonomy with ErrorResponse schema)
- Audit log export (CSV + JSON at /v1/admin/audit/export/*)

Features:
- Multi-session management hook (parallel conversations)
- Conversation export (markdown/JSON/text download + clipboard)
- Head customization UI (enable/disable + weight sliders for 12 heads)

Infrastructure:
- Kubernetes Helm chart (Deployment, Service, HPA, Ingress)
- Database migration versioning (generate, verify commands)
- Blue-green deployment manifests (color-based traffic switching)

Tests: 598 Python + 56 frontend = 654 total, 0 ruff errors
Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-05-02 04:17:21 +00:00

126 lines
3.3 KiB
YAML

{{- if .Values.bluegreen.enabled }}
# Blue-Green Deployment Strategy
#
# Two full deployments (blue/green) run simultaneously.
# A Service selector switches traffic between them.
#
# Workflow:
# 1. Deploy new version to inactive color (e.g., green)
# 2. Run health checks and smoke tests
# 3. Switch Service selector to green
# 4. Monitor; rollback by switching back to blue
#
# Usage:
# helm upgrade --set bluegreen.active=green fusionagi ./k8s
# helm upgrade --set bluegreen.active=blue fusionagi ./k8s # rollback
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-api-blue
labels:
app: {{ .Release.Name }}
component: api
color: blue
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Release.Name }}
component: api
color: blue
template:
metadata:
labels:
app: {{ .Release.Name }}
component: api
color: blue
spec:
containers:
- name: api
image: "{{ .Values.image.repository }}:{{ .Values.bluegreen.blueTag | default .Values.image.tag }}"
ports:
- containerPort: 8000
env:
- name: DEPLOYMENT_COLOR
value: blue
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- with .Values.healthCheck.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.healthCheck.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources.api | nindent 12 }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-api-green
labels:
app: {{ .Release.Name }}
component: api
color: green
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Release.Name }}
component: api
color: green
template:
metadata:
labels:
app: {{ .Release.Name }}
component: api
color: green
spec:
containers:
- name: api
image: "{{ .Values.image.repository }}:{{ .Values.bluegreen.greenTag | default .Values.image.tag }}"
ports:
- containerPort: 8000
env:
- name: DEPLOYMENT_COLOR
value: green
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- with .Values.healthCheck.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.healthCheck.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources.api | nindent 12 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-api-bluegreen
labels:
app: {{ .Release.Name }}
component: api
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 8000
protocol: TCP
name: http
selector:
app: {{ .Release.Name }}
component: api
color: {{ .Values.bluegreen.active | default "blue" }}
{{- end }}