mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
orchestrator: add manage-topic flag and document skip-migrations (#2109)
Some checks failed
CI / 🤖 Check dependabot status (push) Has been cancelled
CI / 🐧 Test on Linux (${{ github.ref_type == 'tag' }}, misc) (push) Has been cancelled
CI / 🐧 Test on Linux (coverage) (push) Has been cancelled
CI / 🐧 Test on Linux (regular) (push) Has been cancelled
CI / ❄️ Build on Nix (push) Has been cancelled
CI / 🍏 Build and test on macOS (push) Has been cancelled
CI / 🧪 End-to-end testing (push) Has been cancelled
CI / 🔍 Upload code coverage (push) Has been cancelled
CI / 🔬 Test only Go (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 20) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 22) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 24) (push) Has been cancelled
CI / ⚖️ Check licenses (push) Has been cancelled
CI / 🐋 Build Docker images (push) Has been cancelled
CI / 🐋 Tag Docker images (push) Has been cancelled
CI / 🚀 Publish release (push) Has been cancelled
Update Nix dependency hashes / Update dependency hashes (push) Has been cancelled
Some checks failed
CI / 🤖 Check dependabot status (push) Has been cancelled
CI / 🐧 Test on Linux (${{ github.ref_type == 'tag' }}, misc) (push) Has been cancelled
CI / 🐧 Test on Linux (coverage) (push) Has been cancelled
CI / 🐧 Test on Linux (regular) (push) Has been cancelled
CI / ❄️ Build on Nix (push) Has been cancelled
CI / 🍏 Build and test on macOS (push) Has been cancelled
CI / 🧪 End-to-end testing (push) Has been cancelled
CI / 🔍 Upload code coverage (push) Has been cancelled
CI / 🔬 Test only Go (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 20) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 22) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 24) (push) Has been cancelled
CI / ⚖️ Check licenses (push) Has been cancelled
CI / 🐋 Build Docker images (push) Has been cancelled
CI / 🐋 Tag Docker images (push) Has been cancelled
CI / 🚀 Publish release (push) Has been cancelled
Update Nix dependency hashes / Update dependency hashes (push) Has been cancelled
This commit is contained in:
committed by
GitHub
parent
75922e6300
commit
f2dfe55d27
@@ -769,7 +769,8 @@ flows. It accepts the following keys:
|
||||
- `tls` defines the TLS configuration to connect to the cluster
|
||||
- `sasl` defines the SASL configuration to connect to the cluster
|
||||
- `topic` defines the base topic name
|
||||
- `topic-cofniguration` describes how the topic should be configured
|
||||
- `manage-topic` controls whether the orchestrator should create/update the Kafka topic (default: `true`). Can be set to `false` when Kafka is not needed (e.g., UI-only setup) or managed externally.
|
||||
- `topic-configuration` describes how the topic should be configured
|
||||
|
||||
The following keys are accepted for the TLS configuration:
|
||||
|
||||
@@ -876,6 +877,7 @@ provided inside `clickhouse`:
|
||||
by ClickHouse (autodetection when not specified)
|
||||
- `orchestrator-basic-auth` enables basic authentication to access the
|
||||
orchestrator URL. It takes two attributes: `username` and `password`.
|
||||
- `skip-migrations` controls whether to skip ClickHouse schema management (default: `false`). Can be set to `true` when the schema is managed externally or by another orchestrator. The outlet requires the schema to match the expected structure; schema mismatches may cause write errors.
|
||||
|
||||
The `resolutions` setting contains a list of resolutions. Each
|
||||
resolution has two keys: `interval` and `ttl`. The first one is the
|
||||
|
||||
@@ -10,6 +10,8 @@ import (
|
||||
// Configuration describes the configuration for the Kafka configurator.
|
||||
type Configuration struct {
|
||||
kafka.Configuration `mapstructure:",squash" yaml:",inline"`
|
||||
// ManageTopic tells if the Kafka topic should be managed (create/update). Default is true.
|
||||
ManageTopic bool
|
||||
// TopicConfiguration describes the topic configuration.
|
||||
TopicConfiguration TopicConfiguration
|
||||
}
|
||||
@@ -30,6 +32,7 @@ type TopicConfiguration struct {
|
||||
func DefaultConfiguration() Configuration {
|
||||
return Configuration{
|
||||
Configuration: kafka.DefaultConfiguration(),
|
||||
ManageTopic: true,
|
||||
TopicConfiguration: TopicConfiguration{
|
||||
NumPartitions: 1,
|
||||
ReplicationFactor: 1,
|
||||
|
||||
@@ -7,12 +7,31 @@ import (
|
||||
"testing"
|
||||
|
||||
"akvorado/common/helpers"
|
||||
"akvorado/common/reporter"
|
||||
"akvorado/common/schema"
|
||||
)
|
||||
|
||||
func TestDefaultConfiguration(t *testing.T) {
|
||||
if err := helpers.Validate.Struct(DefaultConfiguration()); err != nil {
|
||||
config := DefaultConfiguration()
|
||||
if err := helpers.Validate.Struct(config); err != nil {
|
||||
t.Fatalf("validate.Struct() error:\n%+v", err)
|
||||
}
|
||||
if !config.ManageTopic {
|
||||
t.Error("ManageTopic should be true by default")
|
||||
}
|
||||
}
|
||||
|
||||
func TestManageTopicDisabled(t *testing.T) {
|
||||
config := DefaultConfiguration()
|
||||
config.ManageTopic = false
|
||||
c, err := New(reporter.NewMock(t), config, Dependencies{Schema: schema.NewMock(t)})
|
||||
if err != nil {
|
||||
t.Fatalf("New() error:\n%+v", err)
|
||||
}
|
||||
if c != nil {
|
||||
t.Error("Component should be nil when ManageTopic is false")
|
||||
}
|
||||
helpers.StartStop(t, c)
|
||||
}
|
||||
|
||||
func TestShouldAlterConfiguration(t *testing.T) {
|
||||
|
||||
@@ -36,6 +36,11 @@ type Dependencies struct {
|
||||
|
||||
// New creates a new Kafka configurator.
|
||||
func New(r *reporter.Reporter, config Configuration, dependencies Dependencies) (*Component, error) {
|
||||
if !config.ManageTopic {
|
||||
r.Info().Msg("Kafka topic management disabled, skipping Kafka initialization")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
kafkaOpts, err := kafka.NewConfig(r, config.Configuration)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -54,6 +59,9 @@ func New(r *reporter.Reporter, config Configuration, dependencies Dependencies)
|
||||
|
||||
// Start starts Kafka configuration.
|
||||
func (c *Component) Start() error {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
c.r.Info().Msg("starting Kafka component")
|
||||
defer c.r.Info().Msg("Kafka component stopped")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user