Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Helm

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint-and-template:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: azure/setup-helm@v4
- run: helm lint charts/logsight-ai
- run: helm template logsight-ai charts/logsight-ai --namespace logsight > rendered-manifests.yaml
- uses: actions/upload-artifact@v7
with:
name: helm-manifests
path: rendered-manifests.yaml
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ pip install -e ".[api,kafka,observability,ai,parsing,redis]"

The optional integrations are deliberately separated so a developer can use the original local-first CLI without downloading heavyweight ML or infrastructure clients.

### Helm deployment

The production chart at `charts/logsight-ai` deploys the API with an HPA, PDB,
hardened pod/container settings, and a default-deny NetworkPolicy. It requires an
immutable image reference and explicit egress rules for deployment-owned
dependencies. See the [Helm chart guide](charts/logsight-ai/README.md).

### Distributed inference workers

The enterprise Compose stack includes an idle Celery embedding worker. Its task
Expand Down Expand Up @@ -238,7 +245,7 @@ Pull requests retain the existing formatting, linting, strict typing, unit/integ
- [x] Redis-backed deduplication/rate limiting
- [x] OTel Collector deployment and trace-log correlation pipeline
- [x] Celery/Ray distributed inference workers
- [ ] Helm chart with HPA/PDB/network policies
- [x] Helm chart with HPA/PDB/network policies
- [ ] RAG incident investigator with versioned runbooks/commits
- [ ] Labeled benchmark corpus with precision/recall and alert-burden metrics

Expand All @@ -248,6 +255,7 @@ Pull requests retain the existing formatting, linting, strict typing, unit/integ
- [Architecture](docs/architecture.md)
- [Collector correlation](docs/OTEL_COLLECTOR.md)
- [Celery inference workers](docs/CELERY_WORKERS.md)
- [Helm chart](charts/logsight-ai/README.md)
- [Deployment and rollback checklist](docs/DEPLOYMENT.md)
- [Benchmark methodology](docs/BENCHMARKING.md)
- [Mathematical foundations](docs/MATHEMATICAL_FOUNDATIONS.md)
Expand Down
12 changes: 12 additions & 0 deletions charts/logsight-ai/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: logsight-ai
description: Production-focused Helm chart for the LogSight-AI API
type: application
version: 0.1.0
appVersion: "0.2.0"
keywords:
- logs
- observability
- anomaly-detection
maintainers:
- name: CoreyLeath-code
27 changes: 27 additions & 0 deletions charts/logsight-ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# LogSight-AI Helm chart

This chart deploys the LogSight API as a hardened Kubernetes workload. It expects
the image to contain the `api` extra and leaves Redis, OTLP, and distributed
inference services as deployment-owned dependencies.

## Install

```bash
helm upgrade --install logsight-ai ./charts/logsight-ai \
--namespace logsight --create-namespace \
--set image.repository=registry.example/logsight-ai \
--set image.tag=IMMUTABLE_DIGEST_OR_TAG
```

## Production configuration

The chart defaults to two replicas, an HPA, a PDB, non-root/read-only container
security, a dedicated service account without a token, and a restrictive
NetworkPolicy. The default NetworkPolicy permits only ingress from the
`ingress-nginx` namespace and DNS egress. Add explicit `networkPolicy.extraEgress`
rules before configuring Redis, OTLP, Kafka, ClickHouse, or Qdrant endpoints.

Pass credentials through `extraEnvFrom` references to externally managed Secrets;
do not place connection credentials in values files. Use immutable image tags or
digests, tune resource requests from measured workload behavior, and test
autoscaling/disruption behavior in a non-production namespace before promotion.
40 changes: 40 additions & 0 deletions charts/logsight-ai/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- define "logsight-ai.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "logsight-ai.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := include "logsight-ai.name" . }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{- define "logsight-ai.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "logsight-ai.labels" -}}
helm.sh/chart: {{ include "logsight-ai.chart" . }}
{{ include "logsight-ai.selectorLabels" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "logsight-ai.selectorLabels" -}}
app.kubernetes.io/name: {{ include "logsight-ai.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "logsight-ai.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "logsight-ai.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
88 changes: 88 additions & 0 deletions charts/logsight-ai/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "logsight-ai.fullname" . }}
labels:
{{- include "logsight-ai.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "logsight-ai.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "logsight-ai.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "logsight-ai.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: logsight-api
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Support digest-qualified image references

For deployments using the immutable image digests advertised in the chart guide, this template always inserts a tag separator: setting image.tag=sha256:… produces repository:sha256:…, while putting repository@sha256:… in image.repository appends :0.2.0 to the digest. Both are invalid image references, so those pods cannot start. Add a digest-aware rendering path using repository@sha256:…, or support a complete image reference without appending a tag.

Useful? React with 👍 / 👎.

imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["uvicorn"]
args: ["logsight.api:app", "--host", "0.0.0.0", "--port", "8000"]
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
ports:
- name: http
containerPort: 8000
protocol: TCP
env:
{{- range $name, $value := .Values.env }}
- name: {{ $name }}
value: {{ $value | quote }}
{{- end }}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraEnvFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
livenessProbe:
httpGet:
path: /health
port: http
{{- toYaml .Values.probes.liveness | nindent 12 }}
readinessProbe:
httpGet:
path: /health
port: http
{{- toYaml .Values.probes.readiness | nindent 12 }}
volumeMounts:
- name: tmp
mountPath: /tmp
volumes:
- name: tmp
emptyDir:
sizeLimit: 64Mi
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
30 changes: 30 additions & 0 deletions charts/logsight-ai/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "logsight-ai.fullname" . }}
labels:
{{- include "logsight-ai.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "logsight-ai.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/logsight-ai/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.networkPolicy.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "logsight-ai.fullname" . }}
labels:
{{- include "logsight-ai.labels" . | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "logsight-ai.selectorLabels" . | nindent 6 }}
policyTypes:
- Ingress
- Egress
ingress:
{{- toYaml .Values.networkPolicy.ingress | nindent 4 }}
egress:
{{- toYaml (concat .Values.networkPolicy.egress .Values.networkPolicy.extraEgress) | nindent 4 }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/logsight-ai/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "logsight-ai.fullname" . }}
labels:
{{- include "logsight-ai.labels" . | nindent 4 }}
spec:
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
selector:
matchLabels:
{{- include "logsight-ai.selectorLabels" . | nindent 6 }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/logsight-ai/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "logsight-ai.fullname" . }}
labels:
{{- include "logsight-ai.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "logsight-ai.selectorLabels" . | nindent 4 }}
13 changes: 13 additions & 0 deletions charts/logsight-ai/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "logsight-ai.serviceAccountName" . }}
labels:
{{- include "logsight-ai.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- end }}
Loading
Loading