Skip to content

Commit 0604ad5

Browse files
maskarbclaude
andcommitted
feat: add Unleash feature flag server deployment
- Add Unleash deployment with credentials secret management - Add init container patches for RHEL environments (local-dev, production) - Add 10-minute timeout for PostgreSQL readiness check - Source DATABASE_SSL from secret (secure by default) - Add OpenShift Routes for Unleash UI (local-dev, production) - Add documentation for feature flags setup - Register docs in mkdocs.yml navigation - Add Makefile targets for Unleash port-forwarding and status Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 82b9f98 commit 0604ad5

21 files changed

Lines changed: 781 additions & 3 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ reports/
148148
# Secrets (should use .example templates)
149149
**/minio-credentials-secret.yaml
150150
**/postgresql-credentials-secret.yaml
151+
**/unleash-credentials-secret.yaml
151152

152153
# Build artifacts and logs
153154
build.log

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.PHONY: local-test local-test-dev local-test-quick test-all local-url local-troubleshoot local-port-forward local-stop-port-forward
66
.PHONY: push-all registry-login setup-hooks remove-hooks check-minikube check-kind check-kubectl dev-bootstrap
77
.PHONY: e2e-test e2e-setup e2e-clean deploy-langfuse-openshift
8+
.PHONY: unleash-port-forward unleash-status
89
.PHONY: setup-minio minio-console minio-logs minio-status
910
.PHONY: validate-makefile lint-makefile check-shell makefile-health
1011
.PHONY: _create-operator-config _auto-port-forward _show-access-info _build-and-load
@@ -668,6 +669,27 @@ deploy-langfuse-openshift: ## Deploy Langfuse to OpenShift/ROSA cluster
668669
@echo "$(COLOR_BLUE)$(COLOR_RESET) Deploying Langfuse to OpenShift cluster..."
669670
@cd e2e && ./scripts/deploy-langfuse.sh --openshift
670671

672+
##@ Unleash Feature Flags
673+
# Note: Unleash is deployed automatically via 'make deploy' as part of the platform manifests.
674+
# Before deploying, create the unleash-credentials secret from the example:
675+
# cp components/manifests/base/unleash-credentials-secret.yaml.example unleash-credentials-secret.yaml
676+
# # Edit the file to set your credentials
677+
# kubectl apply -f unleash-credentials-secret.yaml -n ambient-code
678+
679+
unleash-port-forward: check-kubectl ## Port-forward Unleash (localhost:4242)
680+
@echo "$(COLOR_BOLD)🔌 Port forwarding Unleash$(COLOR_RESET)"
681+
@echo ""
682+
@echo " Unleash UI: http://localhost:4242"
683+
@echo " Login: admin / unleash4all"
684+
@echo ""
685+
@echo "$(COLOR_YELLOW)Press Ctrl+C to stop$(COLOR_RESET)"
686+
@kubectl port-forward svc/unleash 4242:4242 -n $${NAMESPACE:-ambient-code}
687+
688+
unleash-status: check-kubectl ## Show Unleash deployment status
689+
@echo "$(COLOR_BOLD)Unleash Status$(COLOR_RESET)"
690+
@kubectl get deployment,pod,svc -l 'app.kubernetes.io/name in (unleash,postgresql)' -n $${NAMESPACE:-ambient-code} 2>/dev/null || \
691+
echo "$(COLOR_RED)$(COLOR_RESET) Unleash not found. Run 'make deploy' first."
692+
671693
##@ Internal Helpers (do not call directly)
672694

673695
check-minikube: ## Check if minikube is installed

components/manifests/base/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ resources:
1616
- workspace-pvc.yaml
1717
- minio-deployment.yaml
1818
- postgresql-deployment.yaml
19+
- unleash-deployment.yaml
1920

2021
# Default images (can be overridden by overlays)
2122
images:
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Unleash Credentials Secret
2+
# Copy this file to unleash-credentials-secret.yaml and customize values
3+
#
4+
# To apply: kubectl apply -f unleash-credentials-secret.yaml -n ambient-code
5+
#
6+
# IMPORTANT: Change all credentials for production deployments!
7+
#
8+
# This secret is used by:
9+
# 1. unleash-deployment.yaml - Unleash server configuration
10+
# 2. backend-deployment.yaml - Backend API for feature flag evaluation
11+
# 3. frontend-deployment.yaml - Frontend for flag proxy
12+
#
13+
# NOTE: PostgreSQL credentials are in postgresql-credentials-secret.yaml
14+
#
15+
apiVersion: v1
16+
kind: Secret
17+
metadata:
18+
name: unleash-credentials
19+
labels:
20+
app: unleash
21+
app.kubernetes.io/name: unleash
22+
type: Opaque
23+
stringData:
24+
# ============================================================
25+
# Database connection (uses shared PostgreSQL instance)
26+
# Update password to match postgresql-credentials-secret.yaml
27+
# ============================================================
28+
database-url: "postgres://postgres:CHANGE_ME_IN_PRODUCTION@postgresql:5432/unleash"
29+
# Enable SSL for production database connections
30+
database-ssl: "true"
31+
32+
# ============================================================
33+
# Unleash API URLs (used by backend-deployment.yaml)
34+
# ============================================================
35+
# Client API URL - for flag evaluation
36+
unleash-url: "http://unleash.ambient-code.svc.cluster.local:4242/api"
37+
38+
# Admin API URL - for listing flags and admin operations
39+
unleash-admin-url: "http://unleash.ambient-code.svc.cluster.local:4242"
40+
41+
# ============================================================
42+
# Unleash API Tokens
43+
# Format: <project>:<environment>.<token>
44+
# Use *:* for wildcard (all projects/environments)
45+
# ============================================================
46+
47+
# Admin API token - full admin access
48+
# Used by: UNLEASH_ADMIN_TOKEN in backend
49+
admin-api-token: "*:*.unleash-admin-token"
50+
51+
# Client API token - read-only for flag evaluation
52+
# Used by: UNLEASH_CLIENT_KEY in backend
53+
client-api-token: "default:development.unleash-client-token"
54+
55+
# Frontend API token - for direct browser SDK usage (optional)
56+
frontend-api-token: "default:development.unleash-frontend-token"
57+
58+
# ============================================================
59+
# Unleash Project/Environment (used by backend-deployment.yaml)
60+
# ============================================================
61+
unleash-project: "default"
62+
unleash-environment: "development"
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Unleash Feature Flag Server
2+
# Uses shared PostgreSQL instance from postgresql-deployment.yaml
3+
---
4+
# Unleash Server Deployment
5+
apiVersion: apps/v1
6+
kind: Deployment
7+
metadata:
8+
name: unleash
9+
labels:
10+
app: unleash
11+
app.kubernetes.io/name: unleash
12+
app.kubernetes.io/component: server
13+
spec:
14+
replicas: 1
15+
selector:
16+
matchLabels:
17+
app: unleash
18+
template:
19+
metadata:
20+
labels:
21+
app: unleash
22+
app.kubernetes.io/name: unleash
23+
spec:
24+
containers:
25+
- name: unleash
26+
image: unleashorg/unleash-server:5.11.3
27+
ports:
28+
- containerPort: 4242
29+
name: http
30+
env:
31+
- name: DATABASE_URL
32+
valueFrom:
33+
secretKeyRef:
34+
name: unleash-credentials
35+
key: database-url
36+
- name: DATABASE_SSL
37+
valueFrom:
38+
secretKeyRef:
39+
name: unleash-credentials
40+
key: database-ssl
41+
- name: LOG_LEVEL
42+
value: "info"
43+
# Pre-configured API tokens for development/testing
44+
# Change these in production!
45+
- name: INIT_ADMIN_API_TOKENS
46+
valueFrom:
47+
secretKeyRef:
48+
name: unleash-credentials
49+
key: admin-api-token
50+
- name: INIT_CLIENT_API_TOKENS
51+
valueFrom:
52+
secretKeyRef:
53+
name: unleash-credentials
54+
key: client-api-token
55+
- name: INIT_FRONTEND_API_TOKENS
56+
valueFrom:
57+
secretKeyRef:
58+
name: unleash-credentials
59+
key: frontend-api-token
60+
resources:
61+
requests:
62+
cpu: 100m
63+
memory: 256Mi
64+
limits:
65+
cpu: 500m
66+
memory: 512Mi
67+
readinessProbe:
68+
httpGet:
69+
path: /health
70+
port: 4242
71+
initialDelaySeconds: 30
72+
periodSeconds: 10
73+
timeoutSeconds: 5
74+
livenessProbe:
75+
httpGet:
76+
path: /health
77+
port: 4242
78+
initialDelaySeconds: 60
79+
periodSeconds: 30
80+
timeoutSeconds: 5
81+
---
82+
# Unleash Service
83+
apiVersion: v1
84+
kind: Service
85+
metadata:
86+
name: unleash
87+
labels:
88+
app: unleash
89+
app.kubernetes.io/name: unleash
90+
spec:
91+
type: ClusterIP
92+
ports:
93+
- port: 4242
94+
targetPort: 4242
95+
name: http
96+
selector:
97+
app: unleash

components/manifests/overlays/e2e/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ resources:
1313
- operator-config.yaml
1414
- minio-credentials.yaml
1515
- postgresql-credentials.yaml
16+
- unleash-credentials.yaml
1617
# PostgreSQL init scripts for database creation
1718
- postgresql-init-scripts.yaml
1819

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Unleash credentials for e2e testing
2+
# DO NOT use these credentials in production!
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: unleash-credentials
7+
labels:
8+
app: unleash
9+
app.kubernetes.io/name: unleash
10+
type: Opaque
11+
stringData:
12+
# Database connection (uses shared PostgreSQL instance)
13+
database-url: "postgres://postgres:postgres123@postgresql:5432/unleash"
14+
database-ssl: "false"
15+
16+
# Unleash API URLs
17+
unleash-url: "http://unleash:4242/api"
18+
unleash-admin-url: "http://unleash:4242"
19+
20+
# API Tokens (e2e testing only)
21+
admin-api-token: "*:*.unleash-admin-token"
22+
client-api-token: "default:development.unleash-client-token"
23+
frontend-api-token: "default:development.unleash-frontend-token"
24+
25+
# Project/Environment
26+
unleash-project: "default"
27+
unleash-environment: "development"

components/manifests/overlays/kind/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ resources:
1212
- operator-config.yaml
1313
- minio-credentials.yaml
1414
- postgresql-credentials.yaml
15+
- unleash-credentials.yaml
1516
# PostgreSQL init scripts for database creation (kind only)
1617
- postgresql-init-scripts.yaml
1718

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Unleash credentials for kind local development
2+
# DO NOT use these credentials in production!
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: unleash-credentials
7+
labels:
8+
app: unleash
9+
app.kubernetes.io/name: unleash
10+
type: Opaque
11+
stringData:
12+
# Database connection (uses shared PostgreSQL instance)
13+
database-url: "postgres://postgres:postgres123@postgresql:5432/unleash"
14+
database-ssl: "false"
15+
16+
# Unleash API URLs
17+
unleash-url: "http://unleash:4242/api"
18+
unleash-admin-url: "http://unleash:4242"
19+
20+
# API Tokens (development only)
21+
admin-api-token: "*:*.unleash-admin-token"
22+
client-api-token: "default:development.unleash-client-token"
23+
frontend-api-token: "default:development.unleash-frontend-token"
24+
25+
# Project/Environment
26+
unleash-project: "default"
27+
unleash-environment: "development"

components/manifests/overlays/local-dev/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ resources:
1212
- backend-route.yaml
1313
- frontend-route.yaml
1414
- operator-config-crc.yaml
15+
- unleash-credentials.yaml
16+
- unleash-route.yaml
1517

1618
# Patches for local dev environment
1719
patches:
@@ -22,6 +24,8 @@ patches:
2224
- path: pvc-patch.yaml
2325
- path: backend-clusterrole-patch.yaml
2426
- path: operator-clusterrole-patch.yaml
27+
# Unleash: init container to create database (RHEL doesn't support init scripts)
28+
- path: unleash-init-db-patch.yaml
2529
# PostgreSQL: use RHEL image with proper env vars and mount paths (JSON patch)
2630
- path: postgresql-json-patch.yaml
2731
target:

0 commit comments

Comments
 (0)