feat(client/go): extract Go client into a standalone module#4175
feat(client/go): extract Go client into a standalone module#4175ankitk0305 wants to merge 2 commits intoopenmeterio:mainfrom
Conversation
Bitnami stopped publishing versioned images to Docker Hub in Nov 2024. Override image.registry for kafka, postgresql, and redis sub-charts to pull from registry.bitnami.com where the versioned tags remain available. Fixes openmeterio#4172 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixes openmeterio#3152 Previously, importing the Go client required pulling in the entire openmeter root module with 200+ transitive dependencies, causing conflicts and forced upgrades for downstream users. Changes: - Add api/client/go/go.mod as a standalone module (github.com/openmeterio/openmeter/api/client/go) - Add api/client/go/models/ with lightweight Percentage and StatusProblem types that carry no server-side dependencies (removes go-chi and other server deps from the client footprint) - Update codegen.yaml with import-mapping to redirect pkg/models → api/client/go/models at generation time - Update client.gen.go import accordingly (reflects regenerated output) - Remove openmeter/meter internal import from client_test.go; use the generated MeterAggregationSum constant directly The standalone module's direct dependencies are: github.com/alpacahq/alpacadecimal (Percentage type) github.com/cloudevents/sdk-go/v2 (CloudEvents) github.com/getkin/kin-openapi (embedded spec) github.com/oapi-codegen/runtime (generated client runtime) Run `go mod tidy` inside api/client/go/ to generate go.sum. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe pull request adds image registry configuration for three Helm chart services (Kafka, Redis, PostgreSQL) by specifying Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 4❌ Failed checks (4 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
deploy/charts/openmeter/values.yaml (1)
128-231:⚠️ Potential issue | 🔴 Critical
registry.bitnami.comisn't a real Bitnami registry — this will break image pulls. 🚨Same fix needed in three spots: kafka (line ~130), redis (line ~213), postgresql (line ~237). When Kubernetes tries to pull images, it'll hit
ImagePullBackOffbecause that hostname doesn't exist.Bitnami Helm charts build image references as
{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}. The public registries that actually work are:
docker.iowith repositorybitnami/kafka,bitnami/redis, etc. (current Bitnami Secure Images)docker.iowith repositorybitnamilegacy/kafka,bitnamilegacy/redis, etc. (older versions, no longer updated)Here's the fix:
🔧 Update all three sub-charts
kafka: enabled: true image: - registry: registry.bitnami.com + registry: docker.io + repository: bitnami/kafkaSame pattern for
redisandpostgresql— registrydocker.io, repositoriesbitnami/redisandbitnami/postgresqlrespectively.If this was meant to point at an internal mirror or private registry, it should live in user overrides/docs, not the default
values.yaml.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@deploy/charts/openmeter/values.yaml` around lines 128 - 231, The values.yaml currently uses the non-existent registry "registry.bitnami.com" for three image.registry keys; update each image.registry to "docker.io" and ensure the corresponding image.repository values point to the official Bitnami images (e.g., set the Kafka repository to "bitnami/kafka" where the top-level image.registry and image.repository are used, and set redis.image.repository to "bitnami/redis" and postgresql.image.repository to "bitnami/postgresql"); adjust the svix/docker.io override only if you intend to use a private mirror—otherwise leave defaults pointing at docker.io and document mirror usage in overrides.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@deploy/charts/openmeter/values.yaml`:
- Around line 128-231: The values.yaml currently uses the non-existent registry
"registry.bitnami.com" for three image.registry keys; update each image.registry
to "docker.io" and ensure the corresponding image.repository values point to the
official Bitnami images (e.g., set the Kafka repository to "bitnami/kafka" where
the top-level image.registry and image.repository are used, and set
redis.image.repository to "bitnami/redis" and postgresql.image.repository to
"bitnami/postgresql"); adjust the svix/docker.io override only if you intend to
use a private mirror—otherwise leave defaults pointing at docker.io and document
mirror usage in overrides.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7c3753e4-1509-46bc-b86f-669ae50484bc
⛔ Files ignored due to path filters (6)
api/client/go/client.gen.gois excluded by!api/client/**api/client/go/client_test.gois excluded by!api/client/**api/client/go/codegen.yamlis excluded by!api/client/**api/client/go/go.modis excluded by!**/*.mod,!api/client/**api/client/go/models/percentage.gois excluded by!api/client/**api/client/go/models/problem.gois excluded by!api/client/**
📒 Files selected for processing (1)
deploy/charts/openmeter/values.yaml
Summary
Fixes #3152
Previously, importing the Go client forced downstream users to pull in the entire
openmeterroot module with 200+ transitive dependencies, causing version conflicts and unwanted upgrades.This PR extracts the Go client into its own standalone Go module at
github.com/openmeterio/openmeter/api/client/go.Changes
api/client/go/go.mod— new standalone module declarationapi/client/go/models/percentage.go— localPercentagetype (keepsalpacadecimal, eliminates root module)api/client/go/models/problem.go— localStatusProblemtype without the server-sidego-chidependencyapi/client/go/codegen.yaml— addedimport-mappingto redirectpkg/models→ localmodelspackage at generation time, so futurego generateruns produce a self-contained outputapi/client/go/client.gen.go— updated import to local models (reflects whatgo generatenow produces)api/client/go/client_test.go— removedopenmeter/meterinternal import; uses the generatedMeterAggregationSumconstant directlyDependency footprint (before → after)
github.com/openmeterio/openmeter(~200+ deps)Standalone client direct dependencies:
github.com/alpacahq/alpacadecimal—Percentagetypegithub.com/cloudevents/sdk-go/v2— CloudEventsgithub.com/getkin/kin-openapi— embedded spec validationgithub.com/oapi-codegen/runtime— generated client runtimeNotes
go mod tidyshould be run insideapi/client/go/to generatego.sumbefore merging.codegen.yamlimport-mappingensures future regenerations continue to use the local models package.Test Plan
cd api/client/go && go mod tidycompletes without errorscd api/client/go && go build ./...succeedscd api/client/go && go test ./...passesmake test)Summary by CodeRabbit