-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Implement enterprise-grade Kubernetes deployment with Helm charts #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 134 commits
cb1371e
371d562
0f3846b
157e0ef
a421562
76bbc6f
59269a8
0fe818d
f7bc8d8
08849af
b67d611
c97c108
5700cae
63f8ac7
3848d76
77d4fdd
3dbcd22
55389d2
5c9b978
edd9257
5ee6aa7
4f835df
079cc75
1279a79
7ae7a81
78db552
de68400
a36f8f6
9d6de9e
51f86b9
910c75c
d5eca40
80d4deb
067b60b
6dab629
2bc357e
f95832c
fafa732
6e70b07
9609a99
77a06d4
da66831
029248c
de23530
d69d785
92147b2
cb11faa
998c01f
33731e2
ad6824b
d7666e5
68733b4
cd1524d
0577910
d57c7ab
dc3f8e7
e81752a
53b22d0
16cb4ac
a21e16a
0afa7db
0a63875
fe78b73
9ea2167
20302c5
7cb4d9f
d88b9e6
6dc308b
d22adf7
6ac6949
10437a3
d487186
ed63185
dca2192
891f4f2
277f3b2
36b9bc9
1b4c011
1a988e8
720b2a6
88c5ed4
b1c2036
1908e3f
ffc7f85
0585d11
9b69883
03ccdb7
095934c
0144f84
6dec77a
8926fe0
b4db189
3013883
cbadcdb
1faa2f3
ef32118
c603176
6d5e210
1d58d21
c931988
05d8bb3
80fca87
b36272d
81faac8
7d430e0
6302fd6
131ca26
47287d1
43d2989
424198a
cd9b1e3
0a0df4d
522794a
46f32ee
2d95ee2
b21ba8e
daf6dee
36d6da8
2a78a6a
bcdde32
e0a2de0
6c45566
b594bbe
11fab3e
0d3c246
eb60418
328f001
6d35bc5
bbd7521
e898a32
9eb7fdc
5020ff2
9e8e204
ba217a9
e6f56d9
e22a2a0
86ba932
adc1ab9
0bc8e56
7647c78
f6627ca
9515d5d
ae85882
3ebb1c3
251c575
4c49af9
fd9bb0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,3 +56,6 @@ coverage/ | |
| # Code assist tools | ||
| .claude/ | ||
| CLAUDE.md | ||
|
|
||
| # Istio installation directory (downloaded binaries) | ||
| istio-*/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| # Makefile for Helm chart management in OmniPDF | ||
|
|
||
| # Default namespace and configurable chart | ||
| NAMESPACE ?= omnipdf | ||
| CHART_NAME ?= example-service | ||
| CHART_DIR ?= helm/$(CHART_NAME) | ||
| ENV ?= staging | ||
|
|
||
| # Service-specific values files (environment-specific only) | ||
| SERVICE_ENV_VALUES_FILE ?= $(CHART_DIR)/values-$(ENV).yaml | ||
| SERVICE_BASE_VALUES_FILE ?= $(CHART_DIR)/values.yaml | ||
|
|
||
| # Build values file list (prioritize environment-specific, fallback to base for rbac) | ||
| ifneq ($(wildcard $(SERVICE_ENV_VALUES_FILE)),) | ||
| VALUES_FILES = -f $(SERVICE_ENV_VALUES_FILE) | ||
| else ifneq ($(wildcard $(SERVICE_BASE_VALUES_FILE)),) | ||
| VALUES_FILES = -f $(SERVICE_BASE_VALUES_FILE) | ||
| else | ||
| $(error No values file found for $(CHART_NAME). Expected: $(SERVICE_ENV_VALUES_FILE) or $(SERVICE_BASE_VALUES_FILE)) | ||
| endif | ||
|
|
||
| # Default port for port-forwarding (override as needed) | ||
| LOCAL_PORT ?= 8000 | ||
| REMOTE_PORT ?= 8000 | ||
|
|
||
| .PHONY: help install install-all upgrade upgrade-all uninstall uninstall-all lint status port-forward | ||
|
|
||
| help: | ||
| @echo "Makefile commands for Helm chart management:" | ||
| @echo "" | ||
| @echo "Single-service commands:" | ||
| @echo " make install Install chart (CHART_NAME, ENV)" | ||
| @echo " e.g. make install CHART_NAME=chat-service ENV=staging" | ||
| @echo " make upgrade Upgrade chart (CHART_NAME, ENV)" | ||
| @echo " e.g. make upgrade CHART_NAME=embedder-service ENV=prod" | ||
| @echo " make uninstall Uninstall chart (CHART_NAME)" | ||
| @echo " e.g. make uninstall CHART_NAME=pdf-processor" | ||
| @echo " make lint Run helm lint on chart (CHART_NAME)" | ||
| @echo " e.g. make lint CHART_NAME=embedder-service" | ||
| @echo " make lint-all Lint all charts under ./helm/" | ||
| @echo " make status Show status of Helm release (CHART_NAME)" | ||
| @echo " e.g. make status CHART_NAME=chat-service" | ||
| @echo " make port-forward Port-forward a pod to local machine" | ||
| @echo " e.g. make port-forward CHART_NAME=chat-service LOCAL_PORT=8000 REMOTE_PORT=8000" | ||
| @echo "" | ||
| @echo "Multi-service commands:" | ||
| @echo " make install-all Install all charts (ENV)" | ||
| @echo " e.g. make install-all ENV=prod" | ||
| @echo " make upgrade-all Upgrade all charts (ENV)" | ||
| @echo " e.g. make upgrade-all ENV=staging" | ||
| @echo " make uninstall-all Uninstall all charts under ./helm/" | ||
| @echo "" | ||
| @echo "Values System:" | ||
| @echo " Uses explicit environment-specific files only:" | ||
| @echo " 1. helm/{SERVICE}/values-{ENV}.yaml - Environment-specific configuration" | ||
| @echo " 2. helm/{SERVICE}/values.yaml - Fallback for rbac only" | ||
| @echo "" | ||
| @echo "Environment Variables:" | ||
| @echo " ENV Environment (staging, prestaging, prod) - defaults to 'staging'" | ||
| @echo "" | ||
| @echo "Development Environment:" | ||
| @echo " Use docker-compose for local development:" | ||
| @echo " docker-compose up -d # Start all services locally" | ||
| @echo " docker-compose logs -f chat_service # View service logs" | ||
| @echo "" | ||
| @echo "⚠️ IMPORTANT:" | ||
| @echo " Avoid underscores (_) in CHART_NAME or release names." | ||
| @echo " Use hyphens (-) instead to follow Kubernetes naming conventions (RFC 1123)." | ||
| @echo " Example: use chat-service ✅, not chat_service ❌" | ||
|
|
||
| ## Install a single Helm chart | ||
| install: | ||
| @echo "Installing $(CHART_NAME) for environment: $(ENV)" | ||
| @echo "Values files (in order): $(VALUES_FILES)" | ||
| helm upgrade --install $(CHART_NAME) $(CHART_DIR) \ | ||
| --namespace $(NAMESPACE) \ | ||
| --create-namespace \ | ||
| $(VALUES_FILES) | ||
|
|
||
| ## Upgrade a single Helm chart | ||
| upgrade: | ||
| @echo "Upgrading $(CHART_NAME) for environment: $(ENV)" | ||
| @echo "Values files (in order): $(VALUES_FILES)" | ||
| helm upgrade $(CHART_NAME) $(CHART_DIR) \ | ||
| --namespace $(NAMESPACE) \ | ||
| $(VALUES_FILES) | ||
|
|
||
| ## Uninstall a single Helm chart | ||
| uninstall: | ||
| helm uninstall $(CHART_NAME) \ | ||
| --namespace $(NAMESPACE) | ||
|
|
||
| ## Lint all Helm charts under ./helm/ | ||
| lint-all: | ||
| @echo "Linting all Helm charts under ./helm/..." | ||
| @for dir in helm/*/; do \ | ||
| CHART=$$(basename $$dir); \ | ||
| if [ "$$CHART" != "shared-values" ] && [ "$$CHART" != "assets" ]; then \ | ||
| echo "Linting chart: $$CHART"; \ | ||
| helm lint $$dir || exit 1; \ | ||
| else \ | ||
| echo "Skipping non-chart directory: $$dir"; \ | ||
| fi; \ | ||
| done | ||
|
|
||
| ## Run lint check on a chart | ||
| lint: | ||
| helm lint $(CHART_DIR) | ||
|
|
||
| ## Show release status and pod info | ||
| status: | ||
| @echo "=== Helm Release Status ===" | ||
| helm status $(CHART_NAME) -n $(NAMESPACE) | ||
| @echo "" | ||
| @echo "=== Pod Status ===" | ||
| kubectl get pods -n $(NAMESPACE) -l "app.kubernetes.io/name=$(CHART_NAME),app.kubernetes.io/instance=$(CHART_NAME)" | ||
|
|
||
| # Helper function to deploy all charts (used by both install-all and upgrade-all) | ||
| define deploy-all-charts | ||
| @echo "$(1) all Helm charts under ./helm/ for environment: $(ENV)" | ||
| @for dir in helm/*/; do \ | ||
| CHART=$$(basename $$dir); \ | ||
| if [ "$$CHART" != "assets" ]; then \ | ||
|
NotYuSheng marked this conversation as resolved.
NotYuSheng marked this conversation as resolved.
|
||
| echo "$(1) chart: $$CHART"; \ | ||
| if [ -f "helm/$$CHART/values-$(ENV).yaml" ]; then \ | ||
| CHART_VALUES="-f helm/$$CHART/values-$(ENV).yaml"; \ | ||
| elif [ -f "helm/$$CHART/values.yaml" ]; then \ | ||
| CHART_VALUES="-f helm/$$CHART/values.yaml"; \ | ||
| else \ | ||
| echo "Error: No values file found for $$CHART"; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| helm upgrade --install $$CHART helm/$$CHART \ | ||
| --namespace $(NAMESPACE) \ | ||
| --create-namespace \ | ||
| $$CHART_VALUES; \ | ||
| fi; \ | ||
| done | ||
| endef | ||
|
NotYuSheng marked this conversation as resolved.
Comment on lines
+119
to
+139
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The To improve maintainability, consider refactoring this to reuse the existing logic. One approach is to have the
Comment on lines
+119
to
+139
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| ## Install all Helm charts in ./helm/ | ||
| install-all: | ||
| $(call deploy-all-charts,Installing) | ||
|
|
||
| ## Upgrade all Helm charts in ./helm/ | ||
| upgrade-all: | ||
| $(call deploy-all-charts,Upgrading) | ||
|
|
||
| ## Uninstall all Helm charts in ./helm/ | ||
| uninstall-all: | ||
| @echo "Uninstalling all Helm charts under ./helm/..." | ||
| @for dir in helm/*/; do \ | ||
| CHART=$$(basename $$dir); \ | ||
| if [ "$$CHART" != "shared-values" ] && [ "$$CHART" != "assets" ]; then \ | ||
| echo "Uninstalling chart: $$CHART"; \ | ||
| helm uninstall $$CHART \ | ||
| --namespace $(NAMESPACE); \ | ||
| fi; \ | ||
| done | ||
|
|
||
| ## Port-forward a running pod (default 8000:8000) | ||
| port-forward: | ||
| ifeq ($(CHART_NAME),example-service) | ||
| @echo "ERROR: CHART_NAME must be specified. Example usage:" | ||
| @echo " make port-forward CHART_NAME=chat-service LOCAL_PORT=3000 REMOTE_PORT=8000" | ||
| @exit 1 | ||
| else | ||
| kubectl --namespace $(NAMESPACE) port-forward \ | ||
| deployment/$(CHART_NAME) \ | ||
| $(LOCAL_PORT):$(REMOTE_PORT) | ||
| endif | ||
Uh oh!
There was an error while loading. Please reload this page.