Skip to content

Ensure that only "standard" or "experimental" APIs are exposed as dependencies. #135

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

Closed

Conversation

dawid-nowak
Copy link
Contributor

Change is made so only one set of APIs is available as dependencies.
This avoids the situation where the application can import and use objectts from standard and experimental sets:

use gateway_api::apis::standard::gatewayclasses::GatewayClass;
use gateway_api::apis::experimental::gatewayclasses::GatewayClass;

Instead the code should look like :

use gateway_api::gatewayclasses::GatewayClass;

The user can switch between "standard" and "experimental" sets by setting feature "experimental" in their Cargo.

@dawid-nowak dawid-nowak marked this pull request as ready for review April 18, 2025 13:09
@shaneutt
Copy link
Member

Thanks @dawid-nowak, appreciate you taking the time on this! 🙇

Looking it over, there's a nuance that I think is important here: This is change is focused on the presentation and convenience of giving you whichever release channel you require with a consistent import path.

One problem that we've found with Gateway API over the years is that some implementations will just use the Experimental channel, and go straight to production with it regardless of the fact that its labeled
"experimental". As such, I actually think making it more explicit to use the experimental APIs is an overall nuanced, but important thing.

What are your thoughts on this: Instead of swapping in experimental vs standard, we just bring the standard APIs upfront always because 99% of the time that's what people should/will be using. And then for experimental, they are simply not present unless you flag into the feature, and then you do have to import them specifically, and deliberately?

Let me know your thoughts? 🤔

@shaneutt shaneutt linked an issue Apr 19, 2025 that may be closed by this pull request
@shaneutt shaneutt moved this to Review in gateway-api-rs Apr 19, 2025
@shaneutt shaneutt added this to the v0.25.0 milestone Apr 19, 2025
@dawid-nowak
Copy link
Contributor Author

dawid-nowak commented Apr 21, 2025

From the longer-term perspective, I would expect that eventually "experimental" would be merged into the "standard" and it should disappear.

And if as you said projects just stick with "experimental" set to apis then potentially just exposing one set shouldn't make a difference (other than having to update the source code).

The biggest problem we would have is when projects mix "standard" and "experimental" APIs in one codebase...

I think the options are :

  1. We keep the code as is but "experimental" is only enabled when the feature is enabled... Still, this allows "standard" and "experimental" to exist in one codebase.
use gateway_api::apis::standard::gatewayclasses::GatewayClass;
/// only if experimental apis are enabled via a feature flag
use gateway_api::apis::experimental::gatewayclasses::GatewayClass;
  1. We move "gateway_api::apis::standard::*" to just gateway_api::* and keep experimental behind the feature flag... This would force the applications to use:
use gateway_api::gatewayclasses::GatewayClass;
/// only if experimental apis are enabled via a feature flag
use gateway_api::experimental::gatewayclasses::GatewayClass;
  1. As currently implemented in the PR, the applications can't mix "standard" and "experimental" APIs and can only use :
/// there is only one import but this could be "experimental" or "standard" depending on a feature flag
use gateway_api::gatewayclasses::GatewayClass; 

I am equally happy with options 2 and 3 and slightly less happy with option 1 😄 .. but it is yours to decide.

@shaneutt
Copy link
Member

Thanks for your thoughts! Option 2 looks right as it clearly indicates the APIs are experimental and makes it obvious in the usage. It also brings the standard APIs "up", which I think is good (though I prefer keeping them isolated with pub use standard::*; as you had before, to keep generated code very separate and "tucked away"). 👍

@shaneutt
Copy link
Member

Also the DCO is failing, check here.

@dawid-nowak dawid-nowak force-pushed the splitting_standard_from_experimental branch from a8864f9 to b1dd048 Compare April 27, 2025 12:57
dawid-nowak and others added 5 commits April 27, 2025 14:08
Signed-off-by: Dawid Nowak <[email protected]>
At some point we added `default-features = false` for the kube
dependency, but that's not actually the desired behavior, and
it was getting overridden by the workspace dependency anyway,
so this just removes that erroneous config.

Signed-off-by: Shane Utt <[email protected]>
Signed-off-by: Dawid Nowak <[email protected]>
Signed-off-by: Shane Utt <[email protected]>
Signed-off-by: Dawid Nowak <[email protected]>
Signed-off-by: Shane Utt <[email protected]>
Signed-off-by: Dawid Nowak <[email protected]>
@dawid-nowak dawid-nowak force-pushed the splitting_standard_from_experimental branch from 17fc24b to 5c47b7b Compare April 27, 2025 13:09
@dawid-nowak dawid-nowak deleted the splitting_standard_from_experimental branch April 27, 2025 16:54
@github-project-automation github-project-automation bot moved this from Review to Done in gateway-api-rs Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Exporting only "standard" or "experimental" ?
2 participants