Skip to content

Commit 9568b7d

Browse files
author
Vivek Reddy
committed
comments added
1 parent 2a95c87 commit 9568b7d

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

pkg/splunk/client/azureblobclient.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,23 @@ func NewAzureBlobClient(
178178
scopedLog.Info("Using Azure AD authentication")
179179

180180
// Create a Token Credential using DefaultAzureCredential.
181+
// The Azure SDK uses environment variables to configure authentication when using DefaultAzureCredential.
182+
// For Workload Identity, by adding annotations to the pod's service account:
183+
// azure.workload.identity/client-id: <CLIENT_ID>
184+
// the following environment variables are typically used:
185+
// AZURE_AUTHORITY_HOST: The Azure Active Directory endpoint (default is https://login.microsoftonline.com/).
186+
// AZURE_CLIENT_ID: The client ID of the Azure AD application linked to the pod's service account.
187+
// AZURE_TENANT_ID: The tenant ID of the Azure Active Directory where the Azure AD application resides.
188+
// AZURE_FEDERATED_TOKEN_FILE: The path to the file containing the token issued by Kubernetes, usually mounted as a volume.
189+
// when using Azure AD Pod Identity (deprecated), the following environment variables are typically used:
190+
// AZURE_POD_IDENTITY_AUTHORITY_HOST: The Azure Active Directory endpoint (default is https://login.microsoftonline.com/).
191+
// AZURE_POD_IDENTITY_CLIENT_ID: The client ID of the Azure AD application linked to the pod's service account.
192+
// AZURE_POD_IDENTITY_TENANT_ID: The tenant ID of the Azure Active Directory where the Azure AD application resides.
193+
// AZURE_POD_IDENTITY_TOKEN_FILE: The path to the file containing the token issued by Kubernetes, usually mounted as a volume.
194+
// AZURE_POD_IDENTITY_RESOURCE_ID: The resource ID of the Azure resource to access.
195+
// AZURE_POD_IDENTITY_USE_MSI: Set to "true" to use Managed Service Identity (MSI) for authentication.
196+
// AZURE_POD_IDENTITY_USER_ASSIGNED_ID
197+
181198
tokenCredential, err := azidentity.NewDefaultAzureCredential(nil)
182199
if err != nil {
183200
scopedLog.Error(err, "Failed to create DefaultAzureCredential")

pkg/splunk/client/gcpbucketclient.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ func InitGCSClient(ctx context.Context, gcpCredentials string) (GCSClientInterfa
116116
var err error
117117

118118
if len(gcpCredentials) == 0 {
119+
// The storage.NewClient(ctx) internally uses Application Default Credentials (ADC) to authenticate,
120+
// and ADC works with Workload Identity when the required environment variables and setup are correctly configured.
121+
// If the environment variables are not set, the client will use the default service account credentials.
122+
// To use Google Workload Identity with storage.NewClient(ctx), ensure the following environment variables are properly set in your pod:
123+
// GOOGLE_APPLICATION_CREDENTIALS (Optional):
124+
// If you're not using the default workload identity path (/var/run/secrets/google.cloud/com.google.cloudsecrets/metadata/token),
125+
// you can set GOOGLE_APPLICATION_CREDENTIALS to point to the federated token file manually.
126+
// Otherwise, this can be left unset when Workload Identity is configured correctly.
127+
// GOOGLE_CLOUD_PROJECT (Optional):
128+
// Set this to your Google Cloud project ID if the SDK is not detecting it automatically.
129+
// Additional Kubernetes Setup for Workload Identity:
130+
// The Workload Identity configuration on your cluster ensures that the necessary tokens are automatically mounted for the pod and available without needing GOOGLE_APPLICATION_CREDENTIALS.
119131
client, err = storage.NewClient(ctx)
120132
} else {
121133
client, err = storage.NewClient(ctx, option.WithCredentialsJSON([]byte(gcpCredentials)))

0 commit comments

Comments
 (0)