Skip to content

Commit 55389d2

Browse files
rootclaude
andcommitted
feat: enhance Helm deployment with local CRC registry integration
- Update images.txt with Docker Hub standard services (nginx, redis, minio, chromadb) - Fix load-images.sh to handle Docker Hub URL formats (3 and 4-component paths) - Configure staging values to use local CRC registry for service images - Add comprehensive Helm charts for all OmniPDF services - Update CLAUDE.md with enhanced deployment documentation and shared values system - Successfully deploy and test chat-service health endpoint 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3dbcd22 commit 55389d2

119 files changed

Lines changed: 7134 additions & 19 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,20 @@ All services use FastAPI with consistent structure: main.py imports routers, rou
5050
# Start all services
5151
docker-compose up -d
5252

53-
# Start with GPU support
53+
# Start with GPU support (for vLLM backend)
5454
docker-compose -f docker-compose.gpu.yml up -d
5555

5656
# View logs for specific service
5757
docker-compose logs -f chat_service
5858

5959
# Rebuild and restart service
6060
docker-compose up -d --build chat_service
61+
62+
# Stop all services
63+
docker-compose down
64+
65+
# Stop and remove volumes (full cleanup)
66+
docker-compose down -v
6167
```
6268

6369
### Helm/Kubernetes Operations
@@ -92,6 +98,8 @@ make uninstall CHART_NAME=chat-service
9298
- Helm uses environment-specific values: `values-{dev,staging,prestaging,prod}.yaml`
9399
- Default namespace: `omnipdf`
94100
- Use hyphens (not underscores) in chart names for Kubernetes compliance
101+
- Shared values system provides consistent configuration across environments:
102+
- Values applied in order: `common-base.yaml``common-{env}.yaml``{service}/values-{env}.yaml``{service}/values.yaml`
95103

96104
## Key Implementation Details
97105

@@ -151,4 +159,16 @@ Each service uses minimal dependencies:
151159
- Service-specific requirements in each `{service}/requirements.txt`
152160

153161
### Port Assignments (Development Only)
154-
Development ports are documented in README.md. Production deployments should use proper routing layers (Ingress, Service Mesh, etc.).
162+
Development ports are documented in README.md. Production deployments should use proper routing layers (Ingress, Service Mesh, etc.).
163+
164+
### Shared Values Management
165+
- Use `scripts/update-shared-values.sh` to update configuration across environments
166+
- Example: `./scripts/update-shared-values.sh "networkPolicy.enabled=true" staging`
167+
- Helm shared values directory: `helm/shared-values/`
168+
- Each service can override shared configuration in its own values files
169+
170+
### Branch and Environment Strategy
171+
- Main development branch: `dev`
172+
- Current feature branch: `feat/helm-setup`
173+
- Environments: staging (default), prestaging, prod
174+
- Use `make install ENV=prod` to specify non-default environment

helm/chat-service/values-staging.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ secrets:
2828
create: false
2929
name: chat-service-staging-secrets
3030

31-
# Production-like image handling
31+
# Production-like image handling - using local CRC registry
3232
image:
33-
pullPolicy: Always
33+
repository: default-route-openshift-image-registry.apps-crc.testing/omnipdf/chat_service
34+
tag: "dev-v0.0.1-860e67e"
35+
pullPolicy: IfNotPresent
3436

3537
# Enable ingress for staging testing
3638
ingress:

helm/cleaner/Chart.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: v2
2+
name: cleaner
3+
description: OmniPDF Cleaner Service - Background cleanup service
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "dev-v0.0.0-6653136"
25+
26+
# Chart icon for Helm repositories and UIs - Local static logo
27+
icon: file://assets/logo.svg
28+
29+
# Keywords for chart search
30+
keywords:
31+
- cleaner
32+
- cleanup
33+
- background
34+
- omnipdf

helm/cleaner/templates/NOTES.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
OmniPDF Cleaner Service has been deployed!
2+
3+
1. Check the status of the cleaner:
4+
kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/name={{ include "cleaner.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
5+
6+
2. View Logs:
7+
kubectl --namespace {{ .Release.Namespace }} logs -f deployment/{{ include "cleaner.fullname" . }}
8+
9+
3. Monitor the background cleanup process:
10+
kubectl --namespace {{ .Release.Namespace }} describe deployment/{{ include "cleaner.fullname" . }}
11+
12+
{{- if .Values.networkPolicy.enabled }}
13+
14+
4. Network Security:
15+
- NetworkPolicy is enabled - only authorized traffic is allowed
16+
- Egress allowed to: {{- if .Values.networkPolicy.egress.allowDNS }}DNS, {{- end }}{{- if .Values.networkPolicy.egress.allowHTTP }}Redis{{- end }}
17+
{{- end }}
18+
19+
Note: The cleaner service runs as a background process and does not expose any network ports.
20+
It connects to Redis to monitor and clean up expired sessions and temporary data.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "cleaner.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "cleaner.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "cleaner.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "cleaner.labels" -}}
37+
helm.sh/chart: {{ include "cleaner.chart" . }}
38+
{{ include "cleaner.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "cleaner.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "cleaner.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "cleaner.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "cleaner.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
{{/*
65+
MinIO access and secret keys from secret
66+
*/}}
67+
{{- define "cleaner.secretName" -}}
68+
{{- if .Values.secrets.create }}
69+
{{- include "cleaner.fullname" . }}-secrets
70+
{{- else }}
71+
{{- .Values.secrets.name }}
72+
{{- end }}
73+
{{- end }}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "cleaner.fullname" . }}
5+
labels:
6+
{{- include "cleaner.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
{{- with .Values.deploymentStrategy }}
10+
strategy:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
selector:
14+
matchLabels:
15+
{{- include "cleaner.selectorLabels" . | nindent 6 }}
16+
template:
17+
metadata:
18+
{{- with .Values.podAnnotations }}
19+
annotations:
20+
{{- toYaml . | nindent 8 }}
21+
{{- end }}
22+
labels:
23+
{{- include "cleaner.labels" . | nindent 8 }}
24+
{{- with .Values.podLabels }}
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
spec:
28+
{{- with .Values.imagePullSecrets }}
29+
imagePullSecrets:
30+
{{- toYaml . | nindent 8 }}
31+
{{- end }}
32+
serviceAccountName: {{ include "cleaner.serviceAccountName" . }}
33+
securityContext:
34+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
35+
containers:
36+
- name: {{ .Chart.Name }}
37+
securityContext:
38+
{{- toYaml .Values.securityContext | nindent 12 }}
39+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
40+
imagePullPolicy: {{ .Values.image.pullPolicy }}
41+
# Cleaner is a background Python service, no ports needed
42+
resources:
43+
{{- toYaml .Values.resources | nindent 12 }}
44+
env:
45+
# Additional environment variables
46+
{{- range .Values.env }}
47+
- name: {{ .name }}
48+
value: {{ .value | quote }}
49+
{{- end }}
50+
# Secret environment variables (if secrets are configured)
51+
{{- if .Values.secrets.name }}
52+
- name: SERVICE_API_KEY
53+
valueFrom:
54+
secretKeyRef:
55+
name: {{ .Values.secrets.name }}
56+
key: API_KEY
57+
{{- end }}
58+
{{- with .Values.volumeMounts }}
59+
volumeMounts:
60+
{{- toYaml . | nindent 12 }}
61+
{{- end }}
62+
{{- with .Values.volumes }}
63+
volumes:
64+
{{- toYaml . | nindent 8 }}
65+
{{- end }}
66+
{{- with .Values.nodeSelector }}
67+
nodeSelector:
68+
{{- toYaml . | nindent 8 }}
69+
{{- end }}
70+
{{- with .Values.affinity }}
71+
affinity:
72+
{{- toYaml . | nindent 8 }}
73+
{{- end }}
74+
{{- with .Values.tolerations }}
75+
tolerations:
76+
{{- toYaml . | nindent 8 }}
77+
{{- end }}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{{- if .Values.networkPolicy.enabled }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: {{ include "cleaner.fullname" . }}
6+
labels:
7+
{{- include "cleaner.labels" . | nindent 4 }}
8+
spec:
9+
podSelector:
10+
matchLabels:
11+
{{- include "cleaner.selectorLabels" . | nindent 6 }}
12+
policyTypes:
13+
{{- if .Values.networkPolicy.ingress.enabled }}
14+
- Ingress
15+
{{- end }}
16+
{{- if .Values.networkPolicy.egress.enabled }}
17+
- Egress
18+
{{- end }}
19+
{{- if .Values.networkPolicy.ingress.enabled }}
20+
ingress:
21+
# Allow traffic from ingress controller
22+
{{- if .Values.networkPolicy.ingress.fromIngressController }}
23+
- from:
24+
- namespaceSelector:
25+
matchLabels:
26+
{{- toYaml .Values.networkPolicy.ingress.ingressControllerNamespaceLabels | nindent 14 }}
27+
ports:
28+
- protocol: TCP
29+
port: {{ .Values.service.port }}
30+
{{- end }}
31+
# Allow traffic from same namespace
32+
{{- if .Values.networkPolicy.ingress.fromSameNamespace }}
33+
- from:
34+
- namespaceSelector:
35+
matchLabels:
36+
kubernetes.io/metadata.name: {{ .Release.Namespace }}
37+
ports:
38+
- protocol: TCP
39+
port: {{ .Values.service.port }}
40+
{{- end }}
41+
# Custom ingress rules
42+
{{- with .Values.networkPolicy.ingress.customRules }}
43+
{{- toYaml . | nindent 4 }}
44+
{{- end }}
45+
{{- end }}
46+
{{- if .Values.networkPolicy.egress.enabled }}
47+
egress:
48+
# Allow DNS resolution
49+
{{- if .Values.networkPolicy.egress.allowDNS }}
50+
- to: []
51+
ports:
52+
- protocol: UDP
53+
port: 53
54+
- protocol: TCP
55+
port: 53
56+
{{- end }}
57+
# Allow HTTPS for external APIs
58+
{{- if .Values.networkPolicy.egress.allowHTTPS }}
59+
- to: []
60+
ports:
61+
- protocol: TCP
62+
port: 443
63+
{{- end }}
64+
# Allow HTTP for internal services
65+
{{- if .Values.networkPolicy.egress.allowHTTP }}
66+
- to: []
67+
ports:
68+
- protocol: TCP
69+
port: 80
70+
{{- end }}
71+
# Allow communication to LLM service
72+
{{- if .Values.networkPolicy.egress.allowLLMService }}
73+
{{- range .Values.networkPolicy.egress.llmServiceSelectors }}
74+
- to:
75+
- {{ . | toYaml | nindent 10 }}
76+
ports:
77+
{{- range $.Values.networkPolicy.egress.llmServicePorts }}
78+
- protocol: TCP
79+
port: {{ . }}
80+
{{- end }}
81+
{{- end }}
82+
{{- end }}
83+
# Allow traffic to same namespace
84+
{{- if .Values.networkPolicy.egress.toSameNamespace }}
85+
- to:
86+
- namespaceSelector:
87+
matchLabels:
88+
kubernetes.io/metadata.name: {{ .Release.Namespace }}
89+
{{- end }}
90+
# Custom egress rules
91+
{{- with .Values.networkPolicy.egress.customRules }}
92+
{{- toYaml . | nindent 4 }}
93+
{{- end }}
94+
{{- end }}
95+
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "cleaner.serviceAccountName" . }}
6+
labels:
7+
{{- include "cleaner.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
13+
{{- end }}

0 commit comments

Comments
 (0)