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

RUST-1905 Add Kubernetes Support for OIDC #1276

Merged
merged 9 commits into from
Jan 9, 2025

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Jan 7, 2025

RUST-1905

This adds support for the "k8s" environment for OIDC, and tests to exercise it. The driver change is pretty minimal, but the tests required doing some refactoring of the evergreen config for how we were doing OIDC testing to pull out common functionality, and there's some ritual around running things in the k8s providers.

@@ -144,7 +157,7 @@ impl Callback {

/// Create azure callback.
#[cfg(feature = "azure-oidc")]
fn azure_callback(client_id: Option<&str>, resource: &str) -> CallbackInner {
fn azure_callback(client_id: Option<&str>, resource: &str) -> Function {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This signature change wasn't needed for the functionality here, it just gets rid of a level of indentation and means each of the *_callback functions doesn't need to construct its own fresh cache that can be done just as easily at the call site.

@@ -886,3 +916,90 @@ async fn send_sasl_command(
response.auth_response_body(MONGODB_OIDC_STR)?,
)
}

pub(super) fn validate_credential(credential: &Credential) -> Result<()> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is mostly just copied over from its old location, with a few new validation cases to catch things we hadn't been that the newly synced spec tests showed up.

@abr-egn abr-egn marked this pull request as ready for review January 7, 2025 19:34
@abr-egn abr-egn requested a review from isabelatkinson January 7, 2025 19:34
)
}

fn k8s_callback() -> Function {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual "new functionality added" bit.

async fn successfully_authenticates() -> anyhow::Result<()> {
get_env_or_skip!("OIDC");

let client = Client::with_uri_str(mongodb_uri_single!()).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

mongodb_uri_single looks for the "MONGODB_URI_SINGLE" environment var and skips if it's unset - where is this variable being defined? I can't seem to find it anywhere

Copy link
Contributor Author

@abr-egn abr-egn Jan 9, 2025

Choose a reason for hiding this comment

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

It's set in the drivers-evergreen-tools k8s/setup.sh script.

@abr-egn abr-egn merged commit 60b0727 into mongodb:main Jan 9, 2025
17 checks passed
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.

2 participants