Repository navigation
feat: add production Helm chart controls #47
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
Merged
+394
−1
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f6081da
feat: add Helm chart Chart.yaml
CoreyLeath-code e6a9dbc
feat: add Helm chart values.yaml
CoreyLeath-code 750af4b
feat: add Helm chart _helpers.tpl
CoreyLeath-code 365906c
feat: add Helm chart serviceaccount.yaml
CoreyLeath-code 6ed4008
feat: add Helm chart service.yaml
CoreyLeath-code b8ce55f
feat: add Helm deployment.yaml
CoreyLeath-code 3c60375
feat: add Helm hpa.yaml
CoreyLeath-code 10076c8
feat: add Helm pdb.yaml
CoreyLeath-code 0c6aa49
feat: add Helm networkpolicy.yaml
CoreyLeath-code f93115e
ci: validate Helm chart
CoreyLeath-code ea994cc
docs: add Helm deployment guide
CoreyLeath-code be163d3
docs: document production Helm chart
CoreyLeath-code File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }}" | ||
| 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 }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For deployments using the immutable image digests advertised in the chart guide, this template always inserts a tag separator: setting
image.tag=sha256:…producesrepository:sha256:…, while puttingrepository@sha256:…inimage.repositoryappends:0.2.0to the digest. Both are invalid image references, so those pods cannot start. Add a digest-aware rendering path usingrepository@sha256:…, or support a complete image reference without appending a tag.Useful? React with 👍 / 👎.