Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [ ] Plugin Fees
- [ ] Plugin BR PIX Direct JD
- [ ] Plugin BR PIX Indirect BTG
- [ ] Plugin BR PIX Switch
- [ ] Otel Collector
- [ ] Pipeline
- [ ] Documentation
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gptchangelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
charts/plugin-access-manager
charts/plugin-br-pix-direct-jd
charts/plugin-br-pix-indirect-btg
charts/plugin-br-pix-switch
charts/plugin-crm
charts/plugin-fees
charts/product-console
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
plugin-fees
plugin-br-pix-direct-jd
plugin-br-pix-indirect-btg
plugin-br-pix-switch
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add matching labeler rule for plugin-br-pix-switch.

Line 41 updates PR title scope validation, but .github/configs/labeler.yaml:25-31 still lacks a plugin-br-pix-switch path rule. This can cause PRs to pass title lint while missing expected auto-labeling for charts/plugin-br-pix-switch/**.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-title.yml at line 41, The PR title scope validation was
updated to include "plugin-br-pix-switch" but the labeler rules weren't updated;
add a matching labeler rule in the labeler configuration to map changes under
charts/plugin-br-pix-switch/** to the same label used by other plugins. Update
the labeler.yaml entry (the rules block that contains plugin-* patterns) to
include a new rule for "plugin-br-pix-switch" pointing to the appropriate label,
mirroring the existing plugin rule format so PRs that touch
charts/plugin-br-pix-switch/** are auto-labeled.

plugin-br-bank-transfer-jd
templates
dependencies
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ For implementation and configuration details, see the [README](https://charts.le
| `1.2.6` | 1.2.1-beta.7 | 1.2.1-beta.7 |
-----------------

### Plugin BR Pix Switch

For implementation and configuration details, see the [README](https://charts.lerian.studio/charts/plugin-br-pix-switch).

#### Application Version Mapping

| Chart Version | App Version |
| :---: | :---: |
| `1.0.0` | 1.0.0-beta.1 |
-----------------

### Plugin BR Pix Indirect BTG

See the [official documentation](https://docs.lerian.studio/en/midaz/plugins/pix/indirect-pix-btg) for details.
Expand Down
13 changes: 13 additions & 0 deletions charts/plugin-br-pix-switch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog

## [1.0.0] - 2026-03-27

### Added

- Initial chart release for plugin-br-pix-switch
- Single Go service deployment (HTTP port 4000, gRPC port 7001)
- PostgreSQL dependency (Bitnami subchart v16.3)
- Valkey dependency (Bitnami subchart v2.4.6)
- HPA, PDB, Ingress support
- OpenTelemetry integration
- Readiness and liveness probes
44 changes: 44 additions & 0 deletions charts/plugin-br-pix-switch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: v2
name: plugin-br-pix-switch-helm
description: A Helm chart for Kubernetes
type: application

home: https://github.com/LerianStudio/helm

# A list of maintainers who are responsible for the chart
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

# This is the version number of the application being deployed.
appVersion: "1.0.0-beta.1"

# A list of keywords about the chart. This helps others discover the chart.
keywords:
- midaz
- lerian
- ledger
- plugins
- pix
- switch

# The URL to an icon file for this chart. Or the icon data.
icon: https://avatars.githubusercontent.com/u/148895005?s=200&v=4

# This Helm chart includes multiple dependencies required for the application.
# To understand the purpose and configuration of each dependency, visit:
# https://docs.lerian.studio/docs/midaz-components
dependencies:
- name: postgresql
version: "16.3"
repository: "https://charts.bitnami.com/bitnami"
condition: postgresql.enabled
- name: valkey
version: "2.4.6"
repository: "oci://registry-1.docker.io/bitnamicharts"
condition: valkey.enabled
Comment thread
bedatty marked this conversation as resolved.
92 changes: 92 additions & 0 deletions charts/plugin-br-pix-switch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Plugin BR Pix Switch Helm Chart

Helm chart for deploying the Plugin BR Pix Switch service on Kubernetes.

## Overview

This chart deploys a single Go microservice for PIX switching operations, along with its dependencies:

- **Plugin BR Pix Switch** - Main API service (HTTP port 4000, gRPC port 7001)
- **PostgreSQL** - Primary database (Bitnami subchart)
- **Valkey** - Redis-compatible cache (Bitnami subchart)
- **OpenTelemetry Collector** - Observability (Lerian subchart)

## Prerequisites

- Kubernetes 1.19+
- Helm 3.x
Comment on lines +16 to +17
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify API versions used by this chart's templates to confirm minimum Kubernetes version.
rg -n '^\s*apiVersion:\s*' charts/plugin-br-pix-switch/templates -g '*.yaml'
rg -n '^\s*kind:\s*(HorizontalPodAutoscaler|PodDisruptionBudget|Ingress)\s*$' charts/plugin-br-pix-switch/templates -g '*.yaml' -C2

Repository: LerianStudio/helm

Length of output: 2533


Update the Kubernetes minimum version in the prerequisite from 1.19+ to 1.25+.

The chart uses policy/v1 for PodDisruptionBudget (introduced in K8s 1.25) and autoscaling/v2 for HorizontalPodAutoscaler (introduced in K8s 1.23). When these features are enabled, the cluster must support K8s 1.25 or later.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/plugin-br-pix-switch/README.md` around lines 16 - 17, Update the
README prerequisite that currently lists "Kubernetes 1.19+" to "Kubernetes
1.25+" to reflect required API versions; locate the prerequisites section in
README.md where the lines "Kubernetes 1.19+" and "Helm 3.x" appear and replace
the Kubernetes version string, and optionally add a short note that policy/v1
(PodDisruptionBudget) and autoscaling/v2 (HorizontalPodAutoscaler) require K8s
1.25+ (and 1.23+ respectively) to justify the change.


## Installation

```bash
# Add dependencies
helm dependency build

# Install the chart
helm install plugin-br-pix-switch . -n midaz-plugins --create-namespace
```

## Configuration

### Key Values

| Parameter | Description | Default |
|-----------|-------------|---------|
| `pixSwitch.image.repository` | Container image repository | `ghcr.io/lerianstudio/plugin-br-pix-switch` |
| `pixSwitch.image.tag` | Container image tag | `1.0.0-beta.1` |
| `pixSwitch.service.port` | HTTP service port | `4000` |
| `pixSwitch.service.grpcPort` | gRPC service port | `7001` |
| `pixSwitch.replicaCount` | Number of replicas | `1` |
| `pixSwitch.autoscaling.enabled` | Enable HPA | `true` |
| `pixSwitch.ingress.enabled` | Enable ingress | `false` |
| `postgresql.enabled` | Enable PostgreSQL subchart | `true` |
| `valkey.enabled` | Enable Valkey subchart | `true` |

### Health Endpoints

The service exposes the following health endpoints:

- `/health` - General health check
- `/ready` - Readiness probe (used by Kubernetes)
- `/live` - Liveness probe (used by Kubernetes)

### Using External Database

To use an external PostgreSQL database instead of the bundled subchart:

```yaml
postgresql:
enabled: false

pixSwitch:
configmap:
DB_HOST: "your-external-db-host"
DB_USER: "your-db-user"
DB_NAME: "your-db-name"
DB_PORT: "5432"
secrets:
DB_PASSWORD: "your-db-password"
```

### Using External Cache

To use an external Redis/Valkey instance:

```yaml
valkey:
enabled: false

pixSwitch:
configmap:
VALKEY_HOST: "your-external-cache-host"
VALKEY_PORT: "6379"
secrets:
VALKEY_PASSWORD: "your-cache-password"
```

## Production Notes

- The bundled PostgreSQL and Valkey subcharts are intended for **development only**
- For production, use managed database and cache services
- Configure `pixSwitch.useExistingSecrets: true` to use pre-existing Kubernetes secrets
- Enable ingress and TLS for external access
107 changes: 107 additions & 0 deletions charts/plugin-br-pix-switch/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
============================================================
Plugin BR Pix Switch - Helm Chart Deployment Summary
============================================================

Release Name: {{ .Release.Name }}
Namespace: {{ .Release.Namespace }}
Chart: {{ .Chart.Name }}-{{ .Chart.Version }}
App Version: {{ .Chart.AppVersion }}

------------------------------------------------------------
Main API Service (pixSwitch)
------------------------------------------------------------
Service: {{ include "plugin-br-pix-switch.fullname" . }}
HTTP Port: {{ .Values.pixSwitch.service.port }}
gRPC Port: {{ .Values.pixSwitch.service.grpcPort }}
Type: {{ .Values.pixSwitch.service.type }}

In-cluster access (HTTP):
curl http://{{ include "plugin-br-pix-switch.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.pixSwitch.service.port }}/health
Comment on lines +18 to +19
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Health endpoint path may be incorrect.

The NOTES show curl http://...{{ .Values.pixSwitch.service.port }}/health, but the deployment.yaml defines probes for /ready and /live endpoints. Verify that /health exists, or update to use /ready for consistency.

✏️ Proposed fix
   In-cluster access (HTTP):
-    curl http://{{ include "plugin-br-pix-switch.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.pixSwitch.service.port }}/health
+    curl http://{{ include "plugin-br-pix-switch.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.pixSwitch.service.port }}/ready
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
In-cluster access (HTTP):
curl http://{{ include "plugin-br-pix-switch.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.pixSwitch.service.port }}/health
In-cluster access (HTTP):
curl http://{{ include "plugin-br-pix-switch.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.pixSwitch.service.port }}/ready
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/plugin-br-pix-switch/templates/NOTES.txt` around lines 18 - 19, The
NOTES template currently points users to /health but the container
readiness/liveness probes are defined as /ready and /live; update the NOTES.txt
line that constructs the curl URL (the template using include
"plugin-br-pix-switch.fullname" and .Values.pixSwitch.service.port) to use
/ready (or /live if you prefer liveness) to match the probe paths, or
alternatively add/verify a /health handler in the application; ensure the URL
path in the template and the probes in Deployment (readiness/liveness) are
consistent.


In-cluster access (gRPC):
{{ include "plugin-br-pix-switch.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.pixSwitch.service.grpcPort }}

{{- if .Values.pixSwitch.ingress.enabled }}

Ingress: Enabled
{{- range .Values.pixSwitch.ingress.hosts }}
Host: {{ .host }}
{{- end }}
{{- else }}
Ingress: Disabled
{{- end }}

------------------------------------------------------------
Autoscaling & Availability
------------------------------------------------------------
{{- if .Values.pixSwitch.autoscaling.enabled }}
HPA: Enabled
Min Replicas: {{ .Values.pixSwitch.autoscaling.minReplicas }}
Max Replicas: {{ .Values.pixSwitch.autoscaling.maxReplicas }}
CPU Target: {{ .Values.pixSwitch.autoscaling.targetCPUUtilizationPercentage | default "N/A" }}%
Memory Target: {{ .Values.pixSwitch.autoscaling.targetMemoryUtilizationPercentage | default "N/A" }}%
{{- else }}
HPA: Disabled
Replicas: {{ .Values.pixSwitch.replicaCount }}
{{- end }}
{{- if .Values.pixSwitch.pdb.enabled }}
PDB: Enabled (maxUnavailable: {{ .Values.pixSwitch.pdb.maxUnavailable }})
{{- else }}
PDB: Disabled
{{- end }}

------------------------------------------------------------
Secrets & Configuration
------------------------------------------------------------
ConfigMap: {{ include "plugin-br-pix-switch.fullname" . }}
{{- if .Values.pixSwitch.useExistingSecrets }}
Secret: {{ .Values.pixSwitch.existingSecretName }} (existing)
{{- else }}
Secret: {{ include "plugin-br-pix-switch.fullname" . }}
{{- end }}

------------------------------------------------------------
PostgreSQL
------------------------------------------------------------
{{- if .Values.postgresql.enabled }}
Status: Enabled (Bitnami subchart)
Database: {{ .Values.postgresql.auth.database }}
Username: {{ .Values.postgresql.auth.username }}
In-cluster: {{ .Release.Name }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local:5432

WARNING: Bitnami PostgreSQL is intended for development only.
For production, use an external managed database and set postgresql.enabled=false.
{{- else }}
Status: Disabled (using external database)
{{- end }}

------------------------------------------------------------
Valkey (Redis-compatible)
------------------------------------------------------------
{{- if .Values.valkey.enabled }}
Status: Enabled (Bitnami subchart)
Architecture: {{ .Values.valkey.architecture }}
In-cluster: {{ .Release.Name }}-valkey-primary.{{ .Release.Namespace }}.svc.cluster.local:6379

WARNING: Bitnami Valkey is intended for development only.
For production, use an external managed cache and set valkey.enabled=false.
{{- else }}
Status: Disabled (using external cache)
{{- end }}

------------------------------------------------------------
Useful Commands
------------------------------------------------------------
# Get all resources
kubectl get all -l app.kubernetes.io/instance={{ .Release.Name }} -n {{ .Release.Namespace }}

# Check pod status
kubectl get pods -l app.kubernetes.io/instance={{ .Release.Name }} -n {{ .Release.Namespace }}

# View logs
kubectl logs -l app.kubernetes.io/name={{ include "plugin-br-pix-switch.name" . }} -n {{ .Release.Namespace }} -f

# Describe service
kubectl describe svc {{ include "plugin-br-pix-switch.fullname" . }} -n {{ .Release.Namespace }}

============================================================
68 changes: 68 additions & 0 deletions charts/plugin-br-pix-switch/templates/helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{/*
Expand the name of the chart and plugin pix-switch.
*/}}
{{- define "plugin-br-pix-switch.name" -}}
{{- default (default .Values.pixSwitch.name) | trunc 63 | trimSuffix "-" }}
{{- end }}
Comment thread
bedatty marked this conversation as resolved.

{{/*
Create chart name and version as used by the chart label for plugin pix-switch.
*/}}
{{- define "plugin-br-pix-switch.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name pix-switch.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "plugin-br-pix-switch.fullname" -}}
{{- default .Values.pixSwitch.name | trunc 63 | trimSuffix "-" }}
{{- end }}
Comment thread
bedatty marked this conversation as resolved.

{{/*
Create app version.
*/}}
{{- define "plugin.version" -}}
{{- printf "%s" .Chart.AppVersion | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
plugin-br-pix-switch Selector labels
*/}}
{{- define "plugin-br-pix-switch.selectorLabels" -}}
{{- if .name -}}
app.kubernetes.io/name: {{ include "plugin-br-pix-switch.name" .context }}
{{- end }}
app.kubernetes.io/instance: {{ .context.Release.Name }}
{{- end }}
Comment thread
bedatty marked this conversation as resolved.

{{/*
pix-switch Common labels
*/}}
{{- define "plugin-br-pix-switch.labels" -}}
helm.sh/chart: {{ include "plugin-br-pix-switch.chart" .context }}
{{ include "plugin-br-pix-switch.selectorLabels" (dict "context" .context "name" .name) }}
app.kubernetes.io/version: {{ include "plugin.version" .context }}
app.kubernetes.io/managed-by: {{ .context.Release.Service }}
{{- end }}

{{/*
Create the name of the plugin-br-pix-switch service account to use
*/}}
{{- define "plugin-br-pix-switch.serviceAccountName" -}}
{{- if .Values.pixSwitch.serviceAccount.create }}
{{- default (include "plugin-br-pix-switch.fullname" .) .Values.pixSwitch.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.pixSwitch.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Expand the namespace of the release.
Allows overriding it for multi-namespace deployments in combined charts.
*/}}
{{- define "global.namespace" -}}
{{- default .Release.Namespace .Values.pixSwitch.namespaceOverride | trunc 63 | trimSuffix "-" -}}
{{- end }}
Loading
Loading