Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpk: support advertised addresses in rpk redpanda config bootstrap #16652

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

r-vasquez
Copy link
Contributor

Fixes #16623

This PR introduces both Advertised RPC and Kafka addresses to our defaults. Given that these values are now added to our default config file (see #14600) we must handle them properly during bootstrap.

Now bootstrap supports overriding the default address with the private IP or the one passed via --self flag.

Also, it adds flags to override this behavior and lets the user select which address:port to use in the advertised addresses.

rpk will preemptively fail if the resulting advertised host is 0.0.0.0 to avoid a validation error during startup.

Example:

Starting with the default Redpanda configuration file (https://github.com/redpanda-data/redpanda/blob/dev/conf/redpanda.yaml):

$ rpk redpanda config bootstrap --self 192.168.1.70 --advertised-kafka "redpanda-0.redpanda.redpanda.svc.cluster.local.:9093"

$ cat /etc/redpanda/redpanda.yaml
redpanda:
    data_directory: /var/lib/redpanda/data
    seed_servers: []
    rpc_server:
        address: 192.168.1.70
        port: 33145
    kafka_api:
        - address: 192.168.1.70
          port: 9092
    admin:
        - address: 192.168.1.70
          port: 9644
    advertised_rpc_api:
        address: 192.168.1.70
        port: 33145
    advertised_kafka_api:
        - address: redpanda-0.redpanda.redpanda.svc.cluster.local.
          port: 9093
    developer_mode: true
rpk:
    coredump_dir: /var/lib/redpanda/coredump
pandaproxy: {}
schema_registry: {}

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x
  • v23.1.x

Release Notes

Features

  • rpk redpanda config bootstrap now support bootstrapping your advertised addresses configuration.

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Feb 21, 2024

new failures in https://buildkite.com/redpanda/redpanda/builds/45170#018dc934-5c2b-4da4-90b1-922299a9e442:

"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_bootstrap_then_start"
"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_simple_start_three_with_root"

new failures in https://buildkite.com/redpanda/redpanda/builds/45170#018dc934-5c27-489b-b37c-70ec651c241b:

"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_rpc_tls_enable"

new failures in https://buildkite.com/redpanda/redpanda/builds/45170#018dc934-5c2e-4c71-baaf-5a29bc9aa4cb:

"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_rpc_tls_start"
"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_simple_start_three_with_seeds"

new failures in https://buildkite.com/redpanda/redpanda/builds/45170#018dc95c-9ae7-444b-8cb6-82ea46cf0bd3:

"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_rpc_tls_start"
"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_simple_start_three_with_seeds"

new failures in https://buildkite.com/redpanda/redpanda/builds/45170#018dc95c-9aef-48e2-92bd-25af9b2754d0:

"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_rpc_tls_enable"

new failures in https://buildkite.com/redpanda/redpanda/builds/45170#018dc95c-9ae3-402c-8601-f303e71f1e54:

"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_bootstrap_then_start"
"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_simple_start_three_with_root"

new failures in https://buildkite.com/redpanda/redpanda/builds/45218#018dce76-2bb1-4317-abcf-e338eb7f2fdb:

"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_bootstrap_then_start"

new failures in https://buildkite.com/redpanda/redpanda/builds/45218#018dce87-9c2b-41f4-9a5b-99ce68364d54:

"rptest.tests.rpk_start_test.RpkRedpandaStartTest.test_bootstrap_then_start"

@r-vasquez r-vasquez force-pushed the rpk-bootstrap-advertised branch 2 times, most recently from 163f820 to a86992b Compare February 22, 2024 03:26
gene-redpanda
gene-redpanda previously approved these changes Feb 22, 2024
@r-vasquez
Copy link
Contributor Author

r-vasquez commented Feb 22, 2024

The failures mentioned here: #16652 (comment) were fixed.

Initial Green CI build: https://buildkite.com/redpanda/redpanda/builds/45223#_
Ci-Repeat (30) rpk_start_test: https://buildkite.com/redpanda/redpanda/builds/45250#_
CDT: https://buildkite.com/redpanda/redpanda/builds/45255

@r-vasquez
Copy link
Contributor Author

/ci-repeat 3
skip-units
dt-repeat=10
tests/rptest/tests/rpk_start_test.py

@r-vasquez
Copy link
Contributor Author

/cdt

DefaultAdminPort = 9644
DefaultRPCPort = 33145
DefaultListenAddress = "0.0.0.0"
DefaultAdvertisedAddress = "127.0.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can this be named something like Localhost or LoopbackIP?

The other default variables are defaults that we add internally (in params.go). This one here is only a default externally, in the repo level redpanda.yaml file. I was confused / looking up where this default is coming from -- it isn't rpk, rpk isn't defaulting this. The PR is to guard against behavior that may be set externally.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I may be wrong. Where is this being set to 127.0.0.1? I thought that example file was only used for testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is used for testing. But for some Redpanda images this is the starting redpanda.yaml.

But yeah, I agree. We can change the name to localhost but I wanted to make sure that I was using default as in "this comes from somewhere else" and not just only: "we will replace localhost".

Copy link
Contributor

Choose a reason for hiding this comment

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

Approved but lmk if you change the name and I'll re-+1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

twmb
twmb previously approved these changes Feb 23, 2024
@r-vasquez
Copy link
Contributor Author

This commit introduces 2 new flags and a new
behavior to `rpk redpanda config bootstrap`.

By default, now advertised addresses (kafka/rpc)
are included in our configuration file. So, now
`bootstrap` supports overriding the default address
with the private IP or the one passed via `--self`
flag.

Also, adds flags to override this behavior and let
the user select which address:port to use in the
advertised addresses.
We better error here than later during startup.

See redpanda-data#12395
@r-vasquez r-vasquez merged commit 2bec9ed into redpanda-data:dev Feb 26, 2024
23 checks passed
@r-vasquez
Copy link
Contributor Author

/backport v23.3.x

@r-vasquez r-vasquez deleted the rpk-bootstrap-advertised branch April 12, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rpk redpanda config bootstrap to bootstrap advertised addresses
5 participants