Skip to content

Commit

Permalink
rpk: sample config to include empty structs
Browse files Browse the repository at this point in the history
Sample config file had empty properties:
pandaproxy and schema_registry; rpk strips them
out due to the omitempty struct tag.

In the past viper assumed the presence of a
property was enough to include it in the file,
that didn't respect the omitempty tag.
  • Loading branch information
r-vasquez committed Jul 18, 2022
1 parent df45155 commit 36fea34
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conf/redpanda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ redpanda:
developer_mode: true

# Enable Pandaproxy
pandaproxy:
pandaproxy: {}

# Enable Schema Registry
schema_registry:
schema_registry: {}

rpk:
# TLS configuration.
Expand Down
79 changes: 79 additions & 0 deletions src/go/rpk/pkg/config/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,85 @@ rpk:
kafka_api:
brokers:
- 127.0.1.1:9647
`,
},
{
name: "read/write sample redpanda.yaml",
inCfg: `organization: ""
cluster_id: ""
license_key: ""
redpanda:
data_directory: "/var/lib/redpanda/data"
node_id: 1
seed_servers: []
rpc_server:
address: "0.0.0.0"
port: 33145
kafka_api:
- address: "0.0.0.0"
port: 9092
admin:
address: "0.0.0.0"
port: 9644
developer_mode: true
pandaproxy: {}
schema_registry: {}
rpk:
enable_usage_stats: true
tune_network: false
tune_disk_scheduler: false
tune_disk_nomerges: false
tune_disk_irq: false
tune_fstrim: false
tune_cpu: false
tune_aio_events: false
tune_clocksource: false
tune_swappiness: false
enable_memory_locking: false
tune_coredump: false
coredump_dir: "/var/lib/redpanda/coredump"
`,
exp: `config_file: /etc/redpanda/redpanda.yaml
redpanda:
data_directory: /var/lib/redpanda/data
node_id: 1
seed_servers: []
rpc_server:
address: 0.0.0.0
port: 33145
kafka_api:
- address: 0.0.0.0
port: 9092
admin:
- address: 0.0.0.0
port: 9644
developer_mode: true
rpk:
kafka_api:
brokers:
- 0.0.0.0:9092
admin_api:
addresses:
- 127.0.0.1:9644
enable_usage_stats: true
tune_network: false
tune_disk_scheduler: false
tune_disk_nomerges: false
tune_disk_write_cache: false
tune_disk_irq: false
tune_fstrim: false
tune_cpu: false
tune_aio_events: false
tune_clocksource: false
tune_swappiness: false
tune_transparent_hugepages: false
enable_memory_locking: false
tune_coredump: false
coredump_dir: /var/lib/redpanda/coredump
tune_ballast_file: false
overprovisioned: false
pandaproxy: {}
schema_registry: {}
`,
},
}
Expand Down

0 comments on commit 36fea34

Please sign in to comment.