Skip to content

odcds: convert ODCDS over ADS to pre-cluster-single-subscription#41174

Merged
KBaichoo merged 3 commits intoenvoyproxy:mainfrom
adisuissa:odcds_over_ads_fix
Sep 23, 2025
Merged

odcds: convert ODCDS over ADS to pre-cluster-single-subscription#41174
KBaichoo merged 3 commits intoenvoyproxy:mainfrom
adisuissa:odcds_over_ads_fix

Conversation

@adisuissa
Copy link
Copy Markdown
Contributor

Commit Message: odcds: convert ODCDS over ADS to pre-cluster-single-subscription
Additional Description:
Prior to this PR there were issues when using OD-CDS without cds_config.
This PR converts OD-CDS over ADS to use the new XdstpOdCdsApiImpl (that is also used for xDS-federation based OD-CDS subscriptions).

Risk Level: low - only impacts OD-CDS usage
Testing: Added many integration tests. Unit tests were already added for the original OD-CDS implementations.

Docs Changes: N/A
Release Notes: Added.
Platform Specific Features: N/A
Runtime guard: This change is guarded by envoy.reloadable_features.odcds_over_ads_fix to ensure that there's an escape hatch if some unintentional change occurs.

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #41174 was opened by adisuissa.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #41174 was opened by adisuissa.

see: more, trace.

@adisuissa adisuissa marked this pull request as ready for review September 22, 2025 17:33
@adisuissa
Copy link
Copy Markdown
Contributor Author

This is a continuation of #40988 and uses the component introduced there to fix a bug where OD-CDS isn't working when cds_config isn't defined.
/assign @KBaichoo @yanavlasov @nezdolik

Copy link
Copy Markdown
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

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

LGTM from me. Will wait for @KBaichoo or @nezdolik review as well.

/wait-any

Upstream::OdCdsApiHandlePtr);
}
}
if (odcds == nullptr) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this be an else block instead? E.g.:

if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.odcds_over_ads_fix")) {
...
} else {
    odcds = THROW_OR_RETURN_VALUE(cm.allocateOdCdsApi(&Upstream::OdCdsApiImpl::create,
                                                          odcds_config->source(), absl::nullopt,
                                                          validation_visitor),
                                      Upstream::OdCdsApiHandlePtr);
}

Or is it written as intentional fallback in case when flag is enabled and on_demand_cds fails to initialize for some reason?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should be the else of the 2 conditions above, so I could rewrite it as follows:

      if ((Runtime::runtimeFeatureEnabled("envoy.reloadable_features.odcds_over_ads_fix")) && (odcds_config->source().config_source_specifier_case() ==
            envoy::config::core::v3::ConfigSource::ConfigSourceSpecifierCase::kAds)) {
          odcds = THROW_OR_RETURN_VALUE(cm.allocateOdCdsApi(&Upstream::XdstpOdCdsApiImpl::create,
                                                            odcds_config->source(), absl::nullopt,
                                                            validation_visitor),
                                        Upstream::OdCdsApiHandlePtr);
      } else {
...

I'm not against it, and just thought that the first case is more readable, but I'm happy to change this if you think otherwise (I'm really good with both options).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sounds good, i missed that it was else for 2 conditions above


class AdsIntegrationTest : public AdsDeltaSotwIntegrationSubStateParamTest,
public HttpIntegrationTest {
class AdsIntegrationTestBase : public Grpc::BaseGrpcClientIntegrationParamTest,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we expect multiple parallel subclasses of AdsIntegrationTestBase class in future? If not, could just keep is simple with one base class

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question.
There are already multiple sub-classes of AdsIntegrationTest, but they all use the same TestWithParam parameters (although some might not need to). I think the others will need to be refactored (less parameters) to decrease the tests runtime.

KBaichoo
KBaichoo previously approved these changes Sep 23, 2025
Copy link
Copy Markdown
Contributor

@KBaichoo KBaichoo left a comment

Choose a reason for hiding this comment

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

Thank you for working on this. LGTM besides small comments.

was not being properly extracted in the final Prometheus stat name.
- area: odcds
change: |
Fixed a bug where using OD-CDS without cds_config would not workin some
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/workin/ work in/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, thanks, fixed.


// A singleton through which all subscriptions will be processed.
XdstpOdcdsSubscriptionsManagerSharedPtr subscriptions_manager_;
bool old_ads_;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, done.

// TODO(adisuissa): convert the config_source to optional.
bool old_ads = false;
if (config_source.config_source_specifier_case() ==
envoy::config::core::v3::ConfigSource::ConfigSourceSpecifierCase::kAds) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is old_ads not just equal to the test that sets it to true?

e.g.

const bool old_ads = config_source.config_source_specifier_case() ==
      envoy::config::core::v3::ConfigSource::ConfigSourceSpecifierCase::kAds;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, fixed.

@KBaichoo
Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
Signed-off-by: Adi Suissa-Peleg <adip@google.com>
@KBaichoo KBaichoo merged commit d5c7a06 into envoyproxy:main Sep 23, 2025
25 checks passed
botengyao pushed a commit that referenced this pull request Feb 20, 2026
Commit Message: tcp_proxy: fix OD-CDS over ADS
Additional Description:
This PR is similar to #41174 (and uses the same component to achieve the
same goal).
The fix allows proper use of tcp_proxy on-demand cluster discovery when
used over ADS.

Risk Level: low - only impacts OD-CDS over tcp_proxy
Testing: Added integration tests.
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: Added
`envoy.reloadable_features.tcp_proxy_odcds_over_ads_fix` to disable the
behavior.

---------

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
bmjask pushed a commit to bmjask/envoy that referenced this pull request Mar 14, 2026
Commit Message: tcp_proxy: fix OD-CDS over ADS
Additional Description:
This PR is similar to envoyproxy#41174 (and uses the same component to achieve the
same goal).
The fix allows proper use of tcp_proxy on-demand cluster discovery when
used over ADS.

Risk Level: low - only impacts OD-CDS over tcp_proxy
Testing: Added integration tests.
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: Added
`envoy.reloadable_features.tcp_proxy_odcds_over_ads_fix` to disable the
behavior.

---------

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
Signed-off-by: bjmask <11672696+bjmask@users.noreply.github.com>
bvandewalle pushed a commit to bvandewalle/envoy that referenced this pull request Mar 17, 2026
Commit Message: tcp_proxy: fix OD-CDS over ADS
Additional Description:
This PR is similar to envoyproxy#41174 (and uses the same component to achieve the
same goal).
The fix allows proper use of tcp_proxy on-demand cluster discovery when
used over ADS.

Risk Level: low - only impacts OD-CDS over tcp_proxy
Testing: Added integration tests.
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: Added
`envoy.reloadable_features.tcp_proxy_odcds_over_ads_fix` to disable the
behavior.

---------

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
fishcakez pushed a commit to fishcakez/envoy that referenced this pull request Mar 25, 2026
Commit Message: tcp_proxy: fix OD-CDS over ADS
Additional Description:
This PR is similar to envoyproxy#41174 (and uses the same component to achieve the
same goal).
The fix allows proper use of tcp_proxy on-demand cluster discovery when
used over ADS.

Risk Level: low - only impacts OD-CDS over tcp_proxy
Testing: Added integration tests.
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: Added
`envoy.reloadable_features.tcp_proxy_odcds_over_ads_fix` to disable the
behavior.

---------

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
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.

4 participants