@@ -1266,8 +1266,8 @@ in the MONGODB-OIDC specification, including sections or blocks that specificall
12661266 - ENVIRONMENT
12671267
12681268 Drivers MUST allow the user to specify the name of a built-in OIDC application environment integration to use to
1269- obtain credentials. If provided, the value MUST be one of ` [" test" , " azure" , " gcp" ]` . If both ` ENVIRONMENT ` and an
1270- [OIDC Callback](#oidc-callback) or [OIDC Human Callback](#oidc-human-callback) are provided for the same
1269+ obtain credentials. If provided, the value MUST be one of ` [" test" , " azure" , " gcp" , " k8s " ]` . If both ` ENVIRONMENT `
1270+ and an [OIDC Callback](#oidc-callback) or [OIDC Human Callback](#oidc-human-callback) are provided for the same
12711271 ` MongoClient` , the driver MUST raise an error.
12721272
12731273 - TOKEN_RESOURCE
@@ -1428,6 +1428,35 @@ callback had been provided by the user.
14281428For details on test environment setup, see the README in
14291429[Drivers-Evergreen-Tools](https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/auth_oidc/gcp/README.md).
14301430
1431+ ***Kubernetes***
1432+
1433+ The Kubernetes integration is enabled by setting auth mechanism property ` ENVIRONMENT : k8s` . In this configuration, the
1434+ driver is expected to be running inside a Kubernetes environment with a configured
1435+ [ServiceAccount](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/#bound-service-account-token-volume).
1436+
1437+ If enabled, drivers MUST read the contents of the token from the local file path found using the following algorithm:
1438+
1439+ ` ` ` python
1440+ if ' AZURE_FEDERATED_TOKEN_FILE' in os .environ :
1441+ fname = os .environ [' AZURE_FEDERATED_TOKEN_FILE' ]
1442+ elif ' AWS_WEB_IDENTITY_TOKEN_FILE' in os .environ :
1443+ fname = os .environ [' AWS_WEB_IDENTITY_TOKEN_FILE' ]
1444+ else:
1445+ fname = ' /var/run/secrets/kubernetes.io/serviceaccount/token'
1446+ ` ` `
1447+
1448+ Where ` AZURE_FEDERATED_TOKEN_FILE ` contains the file path on Azure Kubernetes Service (AKS),
1449+ ` AWS_WEB_IDENTITY_TOKEN_FILE ` contains the file path on Elastic Kubernetes Service (EKS), and
1450+ ` / var / run/ secrets/ kubernetes .io / serviceaccount/ token` is the default path for a Kubernetes
1451+ [ServiceAccount token](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/#serviceaccount-admission-controller),
1452+ which is used by Google Kubernetes Engine (GKE).
1453+
1454+ The callback itself MUST not perform any caching, and the driver MUST cache its tokens in the same way as if a custom
1455+ callback had been provided by the user.
1456+
1457+ For details on test environment setup, see the README in
1458+ [Drivers-Evergreen-Tools](https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/auth_oidc/k8s/README.md).
1459+
14311460#### OIDC Callback
14321461
14331462Drivers MUST allow users to provide a callback that returns an OIDC access token. The purpose of the callback is to
@@ -2105,6 +2134,8 @@ practice to avoid this. (See
21052134
21062135## Changelog
21072136
2137+ - 2024-10-02: Add Kubernetes built-in OIDC provider integration.
2138+
21082139- 2024-08-19: Clarify Reauthentication and Speculative Authentication combination behavior.
21092140
21102141- 2024-05-29: Disallow comma character when `TOKEN_RESOURCE` is given in a connection string.
0 commit comments