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

support configuring initial broker tags even when single-tenant mode is enabled #14824

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -512,22 +512,21 @@ private void updateInstanceConfigAndBrokerResourceIfNeeded() {
boolean shouldUpdateBrokerResource = false;
List<String> instanceTags = instanceConfig.getTags();
if (instanceTags.isEmpty()) {
// This is a new broker (first time joining the cluster)
if (ZKMetadataProvider.getClusterTenantIsolationEnabled(_propertyStore)) {
// This is a new broker (first time joining the cluster). We allow configuring initial broker tags regardless of
// tenant isolation mode since it defaults to true and is relatively obscure.
String instanceTagsConfig = _brokerConf.getProperty(Broker.CONFIG_OF_BROKER_INSTANCE_TAGS);
if (StringUtils.isNotEmpty(instanceTagsConfig)) {
for (String instanceTag : StringUtils.split(instanceTagsConfig, ',')) {
Preconditions.checkArgument(TagNameUtils.isBrokerTag(instanceTag), "Illegal broker instance tag: %s",
instanceTag);
instanceConfig.addTag(instanceTag);
}
shouldUpdateBrokerResource = true;
} else if (ZKMetadataProvider.getClusterTenantIsolationEnabled(_propertyStore)) {
instanceConfig.addTag(TagNameUtils.getBrokerTagForTenant(null));
shouldUpdateBrokerResource = true;
} else {
String instanceTagsConfig = _brokerConf.getProperty(Broker.CONFIG_OF_BROKER_INSTANCE_TAGS);
if (StringUtils.isNotEmpty(instanceTagsConfig)) {
for (String instanceTag : StringUtils.split(instanceTagsConfig, ',')) {
Preconditions.checkArgument(TagNameUtils.isBrokerTag(instanceTag), "Illegal broker instance tag: %s",
instanceTag);
instanceConfig.addTag(instanceTag);
}
shouldUpdateBrokerResource = true;
} else {
instanceConfig.addTag(Helix.UNTAGGED_BROKER_INSTANCE);
}
instanceConfig.addTag(Helix.UNTAGGED_BROKER_INSTANCE);
}
instanceTags = instanceConfig.getTags();
updated = true;
Expand Down
Loading