Skip to content

Kafka ACL changes for firehoses - #123

Open
shruti-gojek wants to merge 158 commits into
raystack:mainfrom
goto:feat/add-acl-firehose
Open

Kafka ACL changes for firehoses#123
shruti-gojek wants to merge 158 commits into
raystack:mainfrom
goto:feat/add-acl-firehose

Conversation

@shruti-gojek

Copy link
Copy Markdown

No description provided.

spy16 and others added 30 commits March 2, 2023 19:27
fix: kube deployment name-limit handling
chore: change odpf references to goto
* fix: golanci config

* fix: gci lint issues

* fix: lint issues

* fix: remove nosnakecase lint from disable list
* fix: deployment id name
* chore: add better error description

* refactor: merge firehose module files
refactor: reduce firehose package
* feat: implement create, update, reset
* feat: implement upgrade
* feat: implement start, stop, scale
* test: add lots of tests
* feat: implement reset-sync
* refactor: simplify kafka reset flow
* feat: implement log
* refactor: separate client & server CLI
* feat: fix entropy client cli
* fix: use previous telegraf conf
* refactor: remove old firehose module
fix: change commit author to bot
* fix: strip trailing colon in image tag
* feat: add telegraf config templating
FemiNoviaLina and others added 29 commits September 3, 2025 17:07
feat: firehose toleration affinity based on autoscaler
* fix: toleration affinity mode kube

* fix: toleration affinity mode kube
* feat(firehose): sink based autoscaler config

* feat: update custom transformers

* feat: override triggers only

* feat: update trigger override

* feat: remove unused const

* feat: update triggers
Co-authored-by: Ayushi Sharma <ayushi.sharma@gojek.com>
Co-authored-by: Ayushi Sharma <ayushi.sharma@gojek.com>
* feat: otel integration

* fix: resolve non-constant format string issues

- Fix WithCausef calls in pkg/validator/validator.go to use constant format strings
- Fix WithCausef call in pkg/errors/errors.go to use constant format string
- Fix multiple WithCausef calls in pkg/helm/helm.go to use constant format strings
- All format functions now properly use '%s' as constant format with dynamic values as arguments
- Resolves security and linting issues related to format string usage

* fix: resolve all remaining non-constant format string issues

- Applied comprehensive fix across entire codebase
- Fixed WithCausef and WithMsgf calls to use constant format strings
- Used automated script to fix patterns like err.Error() and strings.Join()
- Manual fixes for edge cases in firehose and core modules
- All format functions now properly use '%s' as constant format with dynamic values as arguments
- Resolves all remaining security and linting issues related to format string usage

* chore: update lint option

* chore: update lint option

* feat: enable newrelic

* feat: enable grpc otel

---------

Co-authored-by: Femi Novia Lina <feminovi@gmail.com>
feat: add dagger fs oss endpoint helm values
* feat(dagger): add support for tolerations and node affinity for dagger

* feat: test dagger chart with existing autoscaler tolerations

* add debug logs

* feat: centralize node affinity interface conversion logic

---------

Co-authored-by: Ayushi Sharma <ayushi.sharma@gojek.com>
* feat: make influx variables configurable

---------

Co-authored-by: Ayushi Sharma <ayushi.sharma@gojek.com>
* feat: make telegraf container resource configurable

* refactor: make telegraf resources conditional and use helm chart defaults

Only include telegraf resources in helm values if explicitly specified by user,
allowing the helm chart to provide default values via values.yaml. This ensures
backward compatibility and follows the principle of letting helm charts manage
their own defaults.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: generate unique cluster name per test to prevent conflicts

Previously, TestClusterName was generated once at package load time and reused
across all tests. This caused failures when multiple tests ran in parallel or
in quick succession because KinD would fail with "node(s) already exist" error.

Changes:
- Generate a unique cluster name for each SetupTests() call
- Pass the cluster name as a return value from SetupTests
- Update all test suites to use the unique cluster name instead of global

This ensures each test gets its own isolated cluster and prevents conflicts
in CI environments.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: pass cluster name to BootstrapKubernetesResource function

Update BootstrapKubernetesResource to accept clusterName as a parameter
instead of using the now-removed global TestClusterName variable.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: update kafka_test.go to handle new SetupTests return value

SetupTests now returns the cluster name as the 8th value. Update kafka_test.go
to receive this value even though it doesn't use Kubernetes.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: make UsageSpec fields optional in validation

Remove 'validate:\"required\"' tags from UsageSpec CPU and Memory fields to allow
optional telegraf resources. The main firehose container limits/requests come from
driver defaults and are always set, while telegraf resources are optional and can
be omitted to use Helm chart defaults.

Fixes validation error when creating modules with telegraf configuration.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Mirror the existing Kafka/Influx/BigQuery handling to make CSV a
first-class Dagger sink type:

- allow SINK_TYPE=CSV in the config JSON schema (both enums)
- add SinkTypeCSV, SINK_CSV_* key constants, and the SinkCSV struct
  (embedded in Sink)
- translate SINK_CSV_* into env vars in readConfig; require
  SINK_CSV_BASE_PATH and emit optional keys only when set so the
  Dagger app's own defaults are preserved
- add config_test.go covering translation, the base-path guard, and
  the schema enum

Co-authored-by: rajuGT <raju.gt@gojek.com>
* feat: mask sensitive values in resource and module API responses

Mask configured sensitive values in resource and module API responses so
secrets never leave Entropy in cleartext, while letting consumers detect
when a specific credential changed via a keyed fingerprint.

- pkg/masking: Masker (Mask/Restore/HMAC-SHA256 fingerprint), dot +
  trailing-* path walker, ValidatePaths, request-scoped Provider with
  per-module-URN cache over a narrow ModuleConfigLookup.
- Resource read path: mask spec.configs + state.output across all six
  endpoints on a source-preserving copy; fail-open with warning; revisions
  resolve kind/project from the URN.
- Module read path: mask configs in GetModule/ListModules, keeping
  sensitive_config visible.
- Write path: core.Service WithMasking option restores stored secrets for
  masked-form inputs before Plan; masked-on-create rejected as invalid.
- Module write validation of sensitive_config path syntax.
- MaskingConfig.HMACKey (masking.hmac_key); empty disables masking. Threaded
  through cli/serve.go -> server.Serve.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(masking): simplify config lookup cache and write-path merge

Replace the request-scoped Provider + per-URN cache with a process-level
ConfigCache, evicted explicitly on module Create/Update instead of relying
on per-request/TTL freshness. This removes the cache-object threading
through every resource mapper call and collapses the duplicate
moduleConfigLookup adapter into a single shared instance.

Collapse the write-path merge into one rule with no error branch: a masked
value with nothing stored (e.g. on Create) is now dropped rather than
rejected via ErrMaskedWithoutStored/ErrInvalid.

No change to external behavior: masked format, HMAC change-detection, and
path syntax are unchanged.

* refactor(masking): gate ListResources masking on with_spec_configs, drop state.output masking

maskResource now masks spec.configs only; state.output is no longer masked
since sensitive_config paths target spec.configs. On ListResources, masking
runs only when with_spec_configs is set (spec.configs is not hydrated
otherwise), skipping the per-resource ConfigCache lookup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(masking): rename well-known key sensitive_config to sensitive_configs

Pluralize the module config key parsed by the masking layer and update
validation messages, log lines, and tests accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…172)

* feat(job): add per-container env_variables override in module config

Dex re-dumps masked placeholder values into a new job's env vars on
Create; masking's Restore only recovers a real secret on Update, so
Create ships with no real secret. The job module driver config now
accepts containers.<name>.env_variables overrides that are overlaid
onto the matching container after the existing global env merge, with
the module value always winning regardless of whether the client sent
a real or masked value. Independent of masking/sensitive_configs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(kubernetes,flink): avoid nil-driver panic when module config is empty

DriverFactory unmarshaled into &kd where kd was already *kubeDriver,
so json.Unmarshal received a **kubeDriver. A null/empty module Configs
reset kd itself to nil (per encoding/json's null-pointer semantics),
returning a non-nil module.Driver interface wrapping a nil pointer.
The first field dereference in Output (m.TolerationMode) then
segfaulted — hit in production when a job resource's kube_cluster
dependency forced a live Output call on a kubernetes module whose
registration Configs was empty.

Unmarshal into a local value instead, so the returned driver is always
non-nil even with empty/null config; log a warning in that case.
Applied the same fix to flink's DriverFactory, which had the identical
pattern.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 215 files, which is 115 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a2ec5b7-4b8a-463a-bb6d-0b6ee738e3f7

📥 Commits

Reviewing files that changed from the base of the PR and between 9e4c9be and 1c70275.

⛔ Files ignored due to path filters (10)
  • go.sum is excluded by !**/*.sum
  • proto/gotocompany/common/v1/service.pb.go is excluded by !**/*.pb.go
  • proto/gotocompany/common/v1/service.pb.gw.go is excluded by !**/*.pb.gw.go
  • proto/gotocompany/common/v1/service_grpc.pb.go is excluded by !**/*.pb.go
  • proto/gotocompany/entropy/v1beta1/module.pb.go is excluded by !**/*.pb.go
  • proto/gotocompany/entropy/v1beta1/module.pb.gw.go is excluded by !**/*.pb.gw.go
  • proto/gotocompany/entropy/v1beta1/module_grpc.pb.go is excluded by !**/*.pb.go
  • proto/gotocompany/entropy/v1beta1/resource.pb.go is excluded by !**/*.pb.go
  • proto/gotocompany/entropy/v1beta1/resource.pb.gw.go is excluded by !**/*.pb.gw.go
  • proto/gotocompany/entropy/v1beta1/resource_grpc.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (215)
  • .github/workflows/lint.yml
  • .github/workflows/release.yml
  • .github/workflows/test.yml
  • .gitignore
  • .golangci.yml
  • .goreleaser.yml
  • Makefile
  • README.md
  • buf.gen.yaml
  • cli/action.go
  • cli/cli.go
  • cli/client.go
  • cli/config.go
  • cli/display.go
  • cli/logs.go
  • cli/migrate.go
  • cli/module.go
  • cli/resource.go
  • cli/serve.go
  • cli/utils.go
  • cli/version.go
  • cli/worker.go
  • core/core.go
  • core/core_test.go
  • core/mocks/async_worker.go
  • core/mocks/driver.go
  • core/mocks/loggable_module.go
  • core/mocks/module_registry.go
  • core/mocks/module_service.go
  • core/mocks/module_store.go
  • core/mocks/resource_store.go
  • core/module/action.go
  • core/module/driver.go
  • core/module/module.go
  • core/module/service.go
  • core/module/service_masking_test.go
  • core/read.go
  • core/read_test.go
  • core/resource/resource.go
  • core/resource/resource_test.go
  • core/resource/state.go
  • core/resource/state_test.go
  • core/sync.go
  • core/write.go
  • core/write_test.go
  • docker-compose.yaml
  • docs/concepts/resource-life-cycle.md
  • docs/installation.md
  • docs/modules/firehose.md
  • docs/modules/job.md
  • docs/modules/kubernetes.md
  • entropy.yaml
  • go.mod
  • internal/server/middlewares.go
  • internal/server/server.go
  • internal/server/serverutils/context.go
  • internal/server/serverutils/grpcerror.go
  • internal/server/v1/mocks/module_service.go
  • internal/server/v1/mocks/resource_service.go
  • internal/server/v1/modules/mappers.go
  • internal/server/v1/modules/masking.go
  • internal/server/v1/modules/server.go
  • internal/server/v1/modules/server_test.go
  • internal/server/v1/resources/logwrapper.go
  • internal/server/v1/resources/mappers.go
  • internal/server/v1/resources/masking.go
  • internal/server/v1/resources/server.go
  • internal/server/v1/resources/server_test.go
  • internal/store/postgres/module_model.go
  • internal/store/postgres/module_store.go
  • internal/store/postgres/postgres.go
  • internal/store/postgres/postgres_test.go
  • internal/store/postgres/resource_model.go
  • internal/store/postgres/resource_store.go
  • internal/store/postgres/resource_store_test.go
  • internal/store/postgres/revision_model.go
  • internal/store/postgres/revision_store.go
  • internal/store/postgres/schema.sql
  • internal/store/postgres/testdata/resources.json
  • internal/store/postgres/utils.go
  • main.go
  • modules/dagger/config.go
  • modules/dagger/config_test.go
  • modules/dagger/driver.go
  • modules/dagger/driver_log.go
  • modules/dagger/driver_output.go
  • modules/dagger/driver_plan.go
  • modules/dagger/driver_sync.go
  • modules/dagger/kafka_security.go
  • modules/dagger/kafka_security_test.go
  • modules/dagger/module.go
  • modules/dagger/schema/config.json
  • modules/firehose/autoscaler.go
  • modules/firehose/autoscaler_test.go
  • modules/firehose/config.go
  • modules/firehose/config_test.go
  • modules/firehose/data.go
  • modules/firehose/driver.go
  • modules/firehose/driver_log.go
  • modules/firehose/driver_output.go
  • modules/firehose/driver_output_test.go
  • modules/firehose/driver_plan.go
  • modules/firehose/driver_plan_create_test.go
  • modules/firehose/driver_plan_test.go
  • modules/firehose/driver_plan_update_test.go
  • modules/firehose/driver_sync.go
  • modules/firehose/driver_sync_test.go
  • modules/firehose/driver_test.go
  • modules/firehose/kafka/consumer.go
  • modules/firehose/kafka_security.go
  • modules/firehose/kafka_security_test.go
  • modules/firehose/keda.go
  • modules/firehose/keda_test.go
  • modules/firehose/log.go
  • modules/firehose/module.go
  • modules/firehose/module_test.go
  • modules/firehose/output.go
  • modules/firehose/plan.go
  • modules/firehose/plan_test.go
  • modules/firehose/schema/config.json
  • modules/firehose/schema/reset.json
  • modules/firehose/schema/scale.json
  • modules/firehose/sync.go
  • modules/firehose/test/module-config.json
  • modules/flink/config.go
  • modules/flink/driver.go
  • modules/flink/driver_output.go
  • modules/flink/driver_plan.go
  • modules/flink/driver_sync.go
  • modules/flink/module.go
  • modules/flink/module_test.go
  • modules/flink/schema/config.json
  • modules/job/config/config.go
  • modules/job/config/schema/config.json
  • modules/job/driver/driver.go
  • modules/job/driver/driver_test.go
  • modules/job/driver/log.go
  • modules/job/driver/output.go
  • modules/job/driver/plan.go
  • modules/job/driver/sync.go
  • modules/job/module.go
  • modules/kafka/config.go
  • modules/kafka/driver.go
  • modules/kafka/module.go
  • modules/kafka/schema/config.json
  • modules/kubernetes/config_schema.json
  • modules/kubernetes/config_schema_test.go
  • modules/kubernetes/driver.go
  • modules/kubernetes/kubernetes.go
  • modules/kubernetes/module.go
  • modules/kubernetes/module_test.go
  • modules/kubernetes/output.go
  • modules/registry.go
  • modules/registry_test.go
  • modules/utils.go
  • modules/utils_test.go
  • pkg/common/common.go
  • pkg/errors/errors.go
  • pkg/errors/errors_test.go
  • pkg/helm/client.go
  • pkg/helm/config.go
  • pkg/helm/helm.go
  • pkg/helm/release.go
  • pkg/helm/release_test.go
  • pkg/helm/status.go
  • pkg/kafka/consumer_reset.go
  • pkg/kube/client.go
  • pkg/kube/client_test.go
  • pkg/kube/config.go
  • pkg/kube/container/container.go
  • pkg/kube/container/container_test.go
  • pkg/kube/job/job.go
  • pkg/kube/job/job_test.go
  • pkg/kube/job/processor.go
  • pkg/kube/pod/pod.go
  • pkg/kube/volume/Volume.go
  • pkg/kube/volume/Volume_test.go
  • pkg/logger/logger.go
  • pkg/masking/cache.go
  • pkg/masking/cache_test.go
  • pkg/masking/masking.go
  • pkg/masking/masking_test.go
  • pkg/masking/paths.go
  • pkg/masking/restore.go
  • pkg/telemetry/opencensus.go
  • pkg/telemetry/opentelemetry.go
  • pkg/telemetry/telemetry.go
  • pkg/validator/validator.go
  • pkg/version/version.go
  • pkg/worker/example/main.go
  • pkg/worker/job_test.go
  • pkg/worker/mocks/job_queue.go
  • pkg/worker/pgq/pgq.go
  • pkg/worker/pgq/pgq_utils.go
  • pkg/worker/worker.go
  • pkg/worker/worker_test.go
  • proto/entropy.swagger.yaml
  • proto/gotocompany/common/v1/service.pb.validate.go
  • proto/gotocompany/entropy/v1beta1/module.pb.validate.go
  • proto/gotocompany/entropy/v1beta1/resource.pb.validate.go
  • test/e2e_test/firehose_helper_test.go
  • test/e2e_test/firehose_test.go
  • test/e2e_test/flink_test.go
  • test/e2e_test/kafka_test.go
  • test/e2e_test/worker_test.go
  • test/testbench/bootstrap.go
  • test/testbench/test_data/module/firehose_module.json
  • test/testbench/test_data/module/flink_module.json
  • test/testbench/test_data/module/kafka_module.json
  • test/testbench/test_data/module/kubernetes_module.json
  • test/testbench/test_data/resource/firehose_resource.json
  • test/testbench/test_data/resource/flink_resource.json
  • test/testbench/test_data/resource/kafka_resource.json
  • test/testbench/test_data/resource/kubernetes_resource.json
  • test/testbench/testbench.go

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants