-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat(charts): add br-sta chart #1710
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
Open
guimoreirar
wants to merge
11
commits into
main
Choose a base branch
from
feat/br-sta
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eda3727
feat(charts): add br-sta chart
guimoreirar 50e7db3
Merge remote-tracking branch 'origin/main' into feat/br-sta-productize
guimoreirar 3282bf4
feat(br-sta): productize onto lerian-common (multiTenant/otel/datastore)
guimoreirar c7bb884
refactor(br-sta): full #1741 commons pattern — every knob via cfgValu…
guimoreirar b398739
feat(br-sta): close .env coverage gaps (SD + streaming + audit/transf…
guimoreirar a70e4dd
docs(br-sta): generate strict values.schema.json + README params table
guimoreirar a87ca6f
refactor(br-sta): standardize component key br-sta: -> brSta: (de-hyp…
guimoreirar d6e5136
fix(br-sta): open operational blocks in values.schema.json
guimoreirar 1bfe7fc
Merge remote-tracking branch 'origin/main' into feat/br-sta-productize
guimoreirar 56b2278
chore(br-sta): bump lerian-common dependency to 1.4.0
guimoreirar 10ced07
fix(br-sta): address CodeRabbit review on PR #1710
guimoreirar 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,12 @@ | ||
| dependencies: | ||
| - name: postgresql | ||
| repository: https://charts.bitnami.com/bitnami | ||
| version: 16.3.5 | ||
| - name: valkey | ||
| repository: oci://registry-1.docker.io/bitnamicharts | ||
| version: 2.4.7 | ||
| - name: rabbitmq | ||
| repository: https://groundhog2k.github.io/helm-charts | ||
| version: 2.1.11 | ||
| digest: sha256:930a2d793fd5205d6a265b344f6785f4727059476f40bc0dac54350d02ba601a | ||
| generated: "2026-07-01T19:53:22.540418-03:00" |
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,50 @@ | ||
| apiVersion: v2 | ||
| name: br-sta-helm | ||
| description: A Helm chart for br-sta, a Lerian Studio Go/Fiber HTTP service | ||
| (manager) plus its background worker, backed by PostgreSQL and Redis/Valkey. | ||
| type: application | ||
| annotations: | ||
| lerian.studio/chart-type: multi-component | ||
| home: https://github.com/LerianStudio/br-sta | ||
| sources: | ||
| - https://github.com/LerianStudio/helm/tree/main/charts/br-sta | ||
| - https://github.com/LerianStudio/br-sta | ||
| maintainers: | ||
| - name: "Lerian Studio" | ||
| email: "support@lerian.studio" | ||
|
|
||
| # This is the chart version. This version number should be incremented each time you make changes | ||
| # to the chart and its templates, including the app version. | ||
| version: 1.0.0-beta.5 | ||
|
|
||
| # This is the version number of the application being deployed. | ||
| appVersion: "1.0.0-beta.32" | ||
|
|
||
| # A list of keywords about the chart. This helps others discover the chart. | ||
| keywords: | ||
| - br-sta | ||
| - lerian | ||
| - go | ||
| - fiber | ||
| - service | ||
|
|
||
| # The URL to an icon file for this chart. | ||
| icon: https://avatars.githubusercontent.com/u/148895005?s=200&v=4 | ||
|
|
||
| # Dependencies — br-sta requires PostgreSQL (SQL migrations) and Redis/Valkey | ||
| # (caching + rate limiting). RabbitMQ is OPTIONAL and bundled only when | ||
| # rabbitmq.enabled=true (disabled by default). All subcharts are gated by | ||
| # their `.enabled` condition. | ||
| dependencies: | ||
| - name: postgresql | ||
| version: "16.3.5" | ||
| repository: "https://charts.bitnami.com/bitnami" | ||
| condition: postgresql.enabled | ||
| - name: valkey | ||
| version: "2.4.7" | ||
| repository: "oci://registry-1.docker.io/bitnamicharts" | ||
| condition: valkey.enabled | ||
| - name: rabbitmq | ||
| version: "2.1.11" | ||
| repository: "https://groundhog2k.github.io/helm-charts" | ||
| condition: rabbitmq.enabled |
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,149 @@ | ||
| # br-sta-helm | ||
|
|
||
| ## Chart Contract | ||
|
|
||
| - Chart type: `multi-component` | ||
| - Required secrets: `None for default render`. With the bundled PostgreSQL and Valkey subcharts the database and Redis passwords are auto-generated and read via `secretKeyRef`. Only supply `br-sta.secrets.POSTGRES_PASSWORD` / `br-sta.secrets.REDIS_PASSWORD` for external infra without `postgresql.auth.existingSecret` / `valkey.auth.existingSecret`. `br-sta.secrets.MULTI_TENANT_SERVICE_API_KEY` is required only when `MULTI_TENANT_ENABLED=true`. | ||
| - Dependency notes: Bundles two local subcharts — Bitnami `postgresql` (`postgresql.enabled`, default `true`) and Bitnami `valkey` (`valkey.enabled`, default `true`). RabbitMQ is optional, config-only, and NOT bundled (`RABBITMQ_ENABLED=false`). All can be pointed at external services. | ||
| - Production overrides: Disable the bundled subcharts and point `POSTGRES_HOST` / `REDIS_HOST` at managed services; supply credentials via chart secrets or an existing Secret; override image tag, ingress, resources, and persistence. | ||
| - Source/license: Source is in `github.com/LerianStudio/br-sta`; chart license is Apache-2.0. | ||
|
|
||
| A Helm chart for [br-sta](https://github.com/LerianStudio/br-sta) — a Lerian Studio Go/Fiber HTTP service. It ships a manager Deployment running the `/service` binary and an optional worker Deployment running background jobs, backed by PostgreSQL (SQL migrations applied at startup) and Redis/Valkey (caching + rate limiting). | ||
|
|
||
| ## TL;DR | ||
|
|
||
| ```bash | ||
| helm repo add lerian https://lerianstudio.github.io/helm | ||
| helm install my-br-sta lerian/br-sta-helm \ | ||
| --namespace br-sta --create-namespace | ||
| ``` | ||
|
|
||
| The default render brings up br-sta plus an in-cluster PostgreSQL and Valkey, with no operator-provided secrets required. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Kubernetes 1.23+ | ||
| - Helm 3.10+ | ||
| - Either the bundled PostgreSQL/Valkey subcharts (default) or externally managed PostgreSQL 16+ and Redis/Valkey. | ||
|
|
||
| ## Architecture | ||
|
|
||
| The chart deploys a **manager Deployment** (`/service`, a Go/Fiber HTTP server) and an optional **worker Deployment** (`/worker`, background jobs): | ||
|
|
||
| - HTTP API served on port `8080` (`/health`, `/api/v1/...`). | ||
| - PostgreSQL is the primary datastore; SQL migrations are applied at startup from `MIGRATIONS_PATH` (`migrations`). | ||
| - Redis/Valkey provides caching and rate limiting (`REDIS_*`). | ||
|
|
||
| ### Optional integrations (disabled by default) | ||
|
|
||
| | Toggle | Default | Purpose | | ||
| |--------|---------|---------| | ||
| | `RABBITMQ_ENABLED` | `"false"` | Event-driven starter (config-only; broker not bundled). | | ||
| | `OUTBOX_ENABLED` | `"false"` | Transactional outbox dispatcher. | | ||
| | `PLUGIN_AUTH_ENABLED` | `"false"` | lib-auth / plugin-auth integration. | | ||
| | `MULTI_TENANT_ENABLED` | `"false"` | Multi-tenant mode via tenant-manager. | | ||
| | `ENABLE_TELEMETRY` | `"false"` | OpenTelemetry OTLP export. | | ||
|
|
||
| ## Storage | ||
|
|
||
| - **PostgreSQL** — application data + SQL migrations. | ||
| - **Redis/Valkey** — cache + rate-limiting counters. | ||
|
|
||
| ## Single-source infra credentials | ||
|
|
||
| Following [`docs/helm-chart-standard.md`](../../docs/helm-chart-standard.md): | ||
|
|
||
| - With the bundled **PostgreSQL** subchart (default), the password is auto-generated into the subchart's own Secret and read by the app via `secretKeyRef` (key `password`) — leave `br-sta.secrets.POSTGRES_PASSWORD` empty. | ||
| - With the bundled **Valkey** subchart (default), the password is auto-generated into the subchart's own Secret and read via `secretKeyRef` (key `valkey-password`) — leave `br-sta.secrets.REDIS_PASSWORD` empty. | ||
| - For external infra (subchart disabled), supply `br-sta.secrets.POSTGRES_PASSWORD` / `br-sta.secrets.REDIS_PASSWORD`, or set `postgresql.auth.existingSecret` / `valkey.auth.existingSecret`. | ||
|
|
||
| ## Required configuration | ||
|
|
||
| The chart **fails fast** on `helm install` only when an enabled optional integration is missing its inputs: | ||
|
|
||
| | Field | When required | | ||
| |-------|---------------| | ||
| | `br-sta.configmap.MULTI_TENANT_URL` | `MULTI_TENANT_ENABLED=true` | | ||
| | `br-sta.secrets.MULTI_TENANT_SERVICE_API_KEY` | `MULTI_TENANT_ENABLED=true` | | ||
|
|
||
| ## Probes | ||
|
|
||
| | Probe | Path | Notes | | ||
| |-------|------|-------| | ||
| | Liveness | `/health` | HTTP self-probe. | | ||
| | Readiness | `/health` | br-sta exposes a single `/health` endpoint. | | ||
|
|
||
| ## Common values | ||
|
|
||
| | Key | Default | Description | | ||
| |-----|---------|-------------| | ||
| | `br-sta.replicaCount` | `2` | Number of replicas. | | ||
| | `br-sta.image.repository` | `ghcr.io/lerianstudio/br-sta` | Container image. | | ||
| | `br-sta.image.tag` | `""` (Chart `appVersion`) | Image tag. | | ||
| | `br-sta.service.port` | `8080` | Service port. | | ||
| | `br-sta.ingress.enabled` | `false` | Expose via Ingress. | | ||
| | `br-sta.autoscaling.enabled` | `true` | Enable HPA. | | ||
| | `postgresql.enabled` | `true` | Deploy the in-cluster PostgreSQL subchart. | | ||
| | `postgresql.architecture` | `replication` | Primary + read replica. | | ||
| | `valkey.enabled` | `true` | Deploy the in-cluster Valkey subchart. | | ||
| | `valkey.architecture` | `standalone` | Single Valkey primary. | | ||
| | `global.externalPostgresDefinitions.enabled` | `false` | Run a bootstrap Job against an external PostgreSQL. | | ||
| | `otel-collector-lerian.enabled` | `false` | Inject host-level OTLP endpoint env vars. | | ||
|
|
||
| See [`values.yaml`](./values.yaml) for the full list, and [`values-template.yaml`](./values-template.yaml) for a production overlay starter. | ||
|
|
||
| ## Production layout | ||
|
|
||
| 1. **Disable the bundled infra** and point at managed services: | ||
| ```yaml | ||
| postgresql: | ||
| enabled: false | ||
| valkey: | ||
| enabled: false | ||
| br-sta: | ||
| configmap: | ||
| POSTGRES_HOST: my-rds-instance.example.com | ||
| POSTGRES_SSLMODE: require | ||
| REDIS_HOST: my-redis.example.com:6379 | ||
| secrets: | ||
| POSTGRES_PASSWORD: <db password> | ||
| REDIS_PASSWORD: <redis password> | ||
| ``` | ||
|
|
||
| 2. **Use an existing Secret** instead of inline values: | ||
| ```yaml | ||
| br-sta: | ||
| useExistingSecret: true | ||
| existingSecretName: br-sta-secrets | ||
| ``` | ||
|
|
||
| 3. **Optional bootstrap** for a fresh external Postgres (creates DB + role + grants, idempotent): | ||
| ```yaml | ||
| global: | ||
| externalPostgresDefinitions: | ||
| enabled: true | ||
| connection: | ||
| host: my-rds-instance.example.com | ||
| port: "5432" | ||
| postgresAdminLogin: | ||
| username: postgres | ||
| password: <admin password> | ||
| appCredentials: | ||
| password: <br_sta role password> | ||
| ``` | ||
|
|
||
| ## Uninstall | ||
|
|
||
| ```bash | ||
| helm uninstall my-br-sta -n br-sta | ||
| ``` | ||
|
|
||
| If the bundled PostgreSQL was used, its PVCs are NOT deleted automatically: | ||
|
|
||
| ```bash | ||
| kubectl delete pvc -n br-sta -l app.kubernetes.io/instance=my-br-sta | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| [Apache 2.0](../../LICENSE) (chart). | ||
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,92 @@ | ||
| {{- $component := index .Values "br-sta" -}} | ||
| # br-sta | ||
|
|
||
| Thank you for installing {{ .Chart.Name }} v{{ .Chart.Version }}! | ||
|
|
||
| ## Deployment Status | ||
|
|
||
| {{ if .Release.IsUpgrade }} | ||
| The chart has been UPGRADED to version {{ .Chart.Version }} (appVersion {{ .Chart.AppVersion }}). | ||
| {{ else }} | ||
| The chart has been INSTALLED at version {{ .Chart.Version }} (appVersion {{ .Chart.AppVersion }}). | ||
| {{ end }} | ||
|
|
||
| ## Component Deployed | ||
|
|
||
| Manager Deployment ({{ $component.replicaCount }} replica(s)) running the /service binary | ||
| (Go/Fiber HTTP server). | ||
|
|
||
| Service: {{ include "br-sta.fullname" . }}.{{ include "global.namespace" . }}.svc.cluster.local:{{ $component.service.port }} | ||
| Health: /health | ||
| API: /api/v1/... | ||
|
|
||
| {{- if eq (include "br-sta.worker.enabled" .) "true" }} | ||
|
|
||
| Worker Deployment ({{ (.Values.worker | default dict).replicaCount | default 1 }} replica(s)) running the /service binary | ||
| (background jobs: audit outbox publisher/consumer, leader-gated scheduler, credential-recovery-on-boot). | ||
| {{- end }} | ||
|
|
||
| ## Dependencies | ||
|
|
||
| {{- if eq (include "postgresql.enabled" .) "true" }} | ||
| 1. PostgreSQL (in-cluster, Bitnami subchart) | ||
| - Primary: {{ include "common.names.dependency.fullname" (dict "chartName" "postgresql" "chartValues" (index .Values "postgresql") "context" .) }}-primary.{{ include "global.namespace" . }}.svc.cluster.local:5432 | ||
| - Database: {{ .Values.postgresql.auth.database }} | ||
| - User: {{ .Values.postgresql.auth.username }} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| {{- else if .Values.global.externalPostgresDefinitions.enabled }} | ||
| 1. PostgreSQL (external, bootstrapped by Helm) | ||
| - Host: {{ .Values.global.externalPostgresDefinitions.connection.host }}:{{ .Values.global.externalPostgresDefinitions.connection.port }} | ||
| - Database/Role: br_sta | ||
| {{- else }} | ||
| 1. PostgreSQL (external, expected to be pre-provisioned) | ||
| - Configure POSTGRES_HOST/POSTGRES_PORT/POSTGRES_USER/POSTGRES_NAME/POSTGRES_PASSWORD before installing. | ||
| {{- end }} | ||
|
|
||
| {{- if eq (include "valkey.enabled" .) "true" }} | ||
| 2. Redis/Valkey (in-cluster, Bitnami subchart) | ||
| - Host: {{ include "common.names.dependency.fullname" (dict "chartName" "valkey" "chartValues" (index .Values "valkey") "context" .) }}-primary.{{ include "global.namespace" . }}.svc.cluster.local:6379 | ||
| {{- else }} | ||
| 2. Redis/Valkey (external, expected to be pre-provisioned) | ||
| - Configure REDIS_HOST (host:port) and REDIS_PASSWORD before installing. | ||
| {{- end }} | ||
|
|
||
| ## Optional Integrations (disabled by default) | ||
|
|
||
| - RabbitMQ (RABBITMQ_ENABLED) — event-driven starter (config-only; not bundled) | ||
| - Outbox (OUTBOX_ENABLED) — transactional outbox dispatcher | ||
| - plugin-auth (PLUGIN_AUTH_ENABLED) — lib-auth integration | ||
| - Multi-tenant (MULTI_TENANT_ENABLED) — tenant-manager (requires MULTI_TENANT_URL + MULTI_TENANT_SERVICE_API_KEY) | ||
| - Telemetry (ENABLE_TELEMETRY) — OpenTelemetry OTLP export | ||
|
|
||
| ## Required Configuration | ||
|
|
||
| The default render (bundled PostgreSQL + Valkey) requires no operator secrets — | ||
| the infra passwords are auto-generated by the subcharts and read via secretKeyRef. | ||
|
|
||
| When MULTI_TENANT_ENABLED=true, the following become required: | ||
| - br-sta.configmap.MULTI_TENANT_URL | ||
| - br-sta.secrets.MULTI_TENANT_SERVICE_API_KEY | ||
|
|
||
| For an EXTERNAL PostgreSQL / Redis (subchart disabled), supply the passwords via | ||
| br-sta.secrets.POSTGRES_PASSWORD / br-sta.secrets.REDIS_PASSWORD (or existingSecret). | ||
|
|
||
| ## Accessing the API | ||
|
|
||
| {{- if contains "ClusterIP" $component.service.type }} | ||
|
|
||
| Port-forward locally: | ||
|
|
||
| kubectl port-forward -n {{ include "global.namespace" . }} svc/{{ include "br-sta.fullname" . }} {{ $component.service.port }}:{{ $component.service.port }} | ||
|
|
||
| Then access: http://localhost:{{ $component.service.port }}/health | ||
| {{- end }} | ||
|
|
||
| ## Useful Commands | ||
|
|
||
| kubectl get pods -n {{ include "global.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }} | ||
| kubectl logs -n {{ include "global.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }} --tail=200 | ||
|
|
||
| ## Source | ||
|
|
||
| - Service source: https://github.com/LerianStudio/br-sta | ||
| - Chart source: https://github.com/LerianStudio/helm/tree/main/charts/br-sta | ||
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.
Uh oh!
There was an error while loading. Please reload this page.