Skip to content

Commit 978d0e8

Browse files
committed
chore: update docs and attach parent context to timeout
Signed-off-by: Matthew H. Irby <matt.irby@outlook.com>
1 parent 30047c6 commit 978d0e8

File tree

2 files changed

+3
-44
lines changed

2 files changed

+3
-44
lines changed

docs/ambient-providers/google.md

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ For the below steps, configure your environment variables.
6464

6565
```bash
6666
# Get project-level metadata
67-
export PROJECT_ID=$(gcloud config get project) # use "gcloud projects list" to get a list of projects and "gcloud config set project " to set the project
67+
export PROJECT_ID=$(gcloud config get project) # use "gcloud projects list" to get a list of projects and "gcloud config set project <PROJECT_ID>" to set the project
6868
export PROJECT_NUMBER=$(gcloud projects describe ${PROJECT_ID} \
6969
--format="value(projectNumber)")
7070

@@ -356,48 +356,7 @@ The security claim format in Command should be:
356356
357357
---
358358
359-
## Verification and Troubleshooting
360-
361-
### Verify Workload Identity Configuration
362-
363-
Test the complete setup with a temporary pod:
364-
365-
```bash
366-
# Deploy a test pod using your KSA
367-
kubectl run -it --rm test-wi \
368-
--image=google/cloud-sdk:slim \
369-
--serviceaccount=${KSA_NAME} \
370-
--namespace=${KSA_NAMESPACE} \
371-
-- bash
372-
373-
# Inside the pod, verify the service account annotation is working
374-
curl -H "Metadata-Flavor: Google" \
375-
http://metadata/computeMetadata/v1/instance/service-accounts/default/email
376-
377-
# This should return: @.iam.gserviceaccount.com
378-
379-
# Get an ID token for your audience (e.g., your Command instance)
380-
curl -H "Metadata-Flavor: Google" \
381-
"http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=https://your-keyfactor-command-instance.com&format=full"
382-
383-
# You should receive a JWT token
384-
```
385-
386-
### Verify Token Claims
387-
388-
Decode the token to verify it contains the expected claims:
389-
390-
```bash
391-
# Copy the token from the previous step and decode it at https://jwt.io
392-
# Or use a CLI tool:
393-
echo "" | cut -d. -f2 | base64 -d | jq .
394-
```
395-
396-
Expected claims:
397-
- `iss`: Should be `https://accounts.google.com`
398-
- `sub`: Should be the OAuth Client ID of your GSA
399-
- `email`: Should be `<GSA_NAME>@<PROJECT_ID>.iam.gserviceaccount.com`
400-
- `aud`: Should match your audience parameter
359+
## Troubleshooting
401360
402361
### Common Issues
403362

internal/command/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (a *azure) GetAccessToken(ctx context.Context) (string, error) {
109109
log := log.FromContext(ctx)
110110

111111
// Try Azure with a short timeout
112-
timeoutCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
112+
timeoutCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
113113
defer cancel()
114114

115115
// To prevent clogging logs every time JWT is generated

0 commit comments

Comments
 (0)