Uh oh!
There was an error while loading. Please reload this page.
metadata: add Oracle Cloud IMDSv2 service - #205
Conversation
ader1990
commented
Jul 28, 2026
Hello, I have updated the main tree with the updated pip modules and also the test resources PR has been merged. Can you please rebase on master and then also enable the functional test for Thanks. |
OCI IMDSv2 exposes instance metadata under /opc/v2 and requires an Authorization: Bearer Oracle header on every request [1]. Cloudbase-Init does not have an OCI-specific metadata provider, so it cannot use the OCI IMDSv2 endpoints when legacy IMDSv1 access is disabled. Add OracleCloudService to retrieve the instance ID, hostname, and base64-encoded user data. Add the required authorization header through the service's HTTP request override, following the existing GCE and MaaS patterns. Register the related oraclecloud configuration options, add unit-test coverage for service loading, request headers, and metadata retrieval, and enable the Oracle IMDSv2 functional tests. [1] https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/gettingmetadata.htm AI-assisted contribution: I reviewed the change and submit it under the DCO terms at https://github.com/cloudbase/cloudbase-init/blob/master/DCO#L16 (clause (a) — the contribution is mine). Signed-off-by: Lucas Quinney <lucas.quinney@oracle.com>
a2412dc to
86e3f7aCompareHello, I rebased this PR onto the latest master and enabled the Oracle functional tests in cloudbase_init_tests.yml. |
Uh oh!
There was an error while loading. Please reload this page.
ader1990
commented
Jul 29, 2026
Thank you for the contribution, much appreciated! |
ader1990
commented
Jul 30, 2026
With the merge of the docs PR #209, the documentation is now available at: https://cloudbase-init.readthedocs.io/en/latest/services.html#oracle-cloud-service. |
Summary
Cloudbase-Init did not have a native Oracle Cloud Infrastructure metadata service. OCI Instance Metadata Service v2 exposes metadata under
/opc/v2/and requires every request to include:Without an OCI-specific provider, Cloudbase-Init cannot retrieve OCI metadata through IMDSv2 when legacy IMDSv1 access is disabled. Metadata-dependent operations such as retrieving the instance ID, configuring the hostname, and processing user data are therefore unavailable.
This PR adds
OracleCloudService, which:oraclecloudconfiguration group.The authorization header is added by overriding the service’s HTTP request method, following the existing GCE and MaaS provider patterns. No shared metadata base-class changes are required.
How to reproduce
Launch a Windows instance in OCI with legacy IMDSv1 access disabled.
Configure Cloudbase-Init to use:
An unauthenticated request to the following IMDSv2 endpoint is rejected:
The same request succeeds when it includes:
OCI documents the IMDSv2 endpoints and authorization requirement here:
https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/gettingmetadata.htm
Test plan
New unit tests cover:
Oracle service tests:
Full Python test suite:
Repository-wide lint:
flake8 # PassedDCO sign-off on the commit.
Related