oracleobjectstorage: supports workload identity authentication for OKE

Signed-off-by: Anders Swanson <anders.swanson@oracle.com>
This commit is contained in:
Anders Swanson 2023-10-31 15:04:40 -07:00 committed by Nick Craig-Wood
parent a1e66cc5e8
commit db8fb5ceda
3 changed files with 25 additions and 4 deletions

View file

@ -52,6 +52,8 @@ func getConfigurationProvider(opt *Options) (common.ConfigurationProvider, error
case noAuth: case noAuth:
fs.Infof("client", "using no auth provider") fs.Infof("client", "using no auth provider")
return getNoAuthConfiguration() return getNoAuthConfiguration()
case workloadIdentity:
return auth.OkeWorkloadIdentityConfigurationProvider()
default: default:
} }
return common.DefaultConfigProvider(), nil return common.DefaultConfigProvider(), nil

View file

@ -26,6 +26,7 @@ const (
userPrincipal = "user_principal_auth" userPrincipal = "user_principal_auth"
instancePrincipal = "instance_principal_auth" instancePrincipal = "instance_principal_auth"
resourcePrincipal = "resource_principal_auth" resourcePrincipal = "resource_principal_auth"
workloadIdentity = "workload_identity_auth"
environmentAuth = "env_auth" environmentAuth = "env_auth"
noAuth = "no_auth" noAuth = "no_auth"
@ -37,6 +38,8 @@ https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm`
each instance has its own identity, and authenticates using the certificates that are read from instance metadata. each instance has its own identity, and authenticates using the certificates that are read from instance metadata.
https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm` https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm`
workloadIdentityHelpText = `use workload identity to grant OCI Container Engine for Kubernetes workloads policy-driven access to OCI resources using OCI Identity and Access Management (IAM).
https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contenggrantingworkloadaccesstoresources.htm`
resourcePrincipalHelpText = `use resource principals to make API calls` resourcePrincipalHelpText = `use resource principals to make API calls`
environmentAuthHelpText = `automatically pickup the credentials from runtime(env), first one to provide auth wins` environmentAuthHelpText = `automatically pickup the credentials from runtime(env), first one to provide auth wins`
@ -87,6 +90,9 @@ func newOptions() []fs.Option {
}, { }, {
Value: instancePrincipal, Value: instancePrincipal,
Help: instancePrincipalHelpText, Help: instancePrincipalHelpText,
}, {
Value: workloadIdentity,
Help: workloadIdentityHelpText,
}, { }, {
Value: resourcePrincipal, Value: resourcePrincipal,
Help: resourcePrincipalHelpText, Help: resourcePrincipalHelpText,

View file

@ -63,9 +63,13 @@ Press Enter for the default (env_auth).
3 | each instance has its own identity, and authenticates using the certificates that are read from instance metadata. 3 | each instance has its own identity, and authenticates using the certificates that are read from instance metadata.
| https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm | https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm
\ (instance_principal_auth) \ (instance_principal_auth)
4 / use resource principals to make API calls / use workload identity to grant Kubernetes pods policy-driven access to Oracle Cloud
4 | Infrastructure (OCI) resources using OCI Identity and Access Management (IAM).
| https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contenggrantingworkloadaccesstoresources.htm
\ (workload_identity_auth)
5 / use resource principals to make API calls
\ (resource_principal_auth) \ (resource_principal_auth)
5 / no credentials needed, this is typically for reading public buckets 6 / no credentials needed, this is typically for reading public buckets
\ (no_auth) \ (no_auth)
provider> 2 provider> 2
@ -151,6 +155,7 @@ Rclone supports the following OCI authentication provider.
User Principal User Principal
Instance Principal Instance Principal
Resource Principal Resource Principal
Workload Identity
No authentication No authentication
### User Principal ### User Principal
@ -224,6 +229,14 @@ Sample rclone configuration file for Authentication Provider Resource Principal:
region = us-ashburn-1 region = us-ashburn-1
provider = resource_principal_auth provider = resource_principal_auth
### Workload Identity
Workload Identity auth may be used when running Rclone from Kubernetes pod on a Container Engine for Kubernetes (OKE) cluster.
For more details on configuring Workload Identity, see [Granting Workloads Access to OCI Resources](https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contenggrantingworkloadaccesstoresources.htm).
To use workload identity, ensure Rclone is started with these environment variables set in its process.
export OCI_RESOURCE_PRINCIPAL_VERSION=2.2
export OCI_RESOURCE_PRINCIPAL_REGION=us-ashburn-1
### No authentication ### No authentication
Public buckets do not require any authentication mechanism to read objects. Public buckets do not require any authentication mechanism to read objects.