fix(ec2): add error logging for credential failures in EC2 discovery - #11117
Open
wkrause13 wants to merge 1 commit into
Open
fix(ec2): add error logging for credential failures in EC2 discovery#11117wkrause13 wants to merge 1 commit into
wkrause13 wants to merge 1 commit into
Conversation
|
Issues linked to changelog: |
wkrause13
force-pushed
the
fix/ec2-credential-error-logging
branch
from
January 29, 2026 00:14
1b96d69 to
4eea16f
Compare
When an EC2 upstream is configured with invalid or missing AWS credentials, the discovery would fail silently without clear error logs. This made it difficult to diagnose issues where EC2 instances became inaccessible. This change adds explicit ERROR level logging in eds.go when: - Secret listing fails for EC2 upstream discovery - EC2 instance fetching fails (e.g., invalid credentials, access denied) The error message now clearly indicates "failed to fetch EC2 instances for upstream discovery" with the underlying error details. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
wkrause13
force-pushed
the
fix/ec2-credential-error-logging
branch
from
January 29, 2026 00:22
4eea16f to
0d64f4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an EC2 upstream is configured with invalid or missing AWS credentials, the discovery would fail silently without clear error logs. This made it difficult to diagnose issues where EC2 instances became inaccessible.
This change adds explicit ERROR level logging in eds.go when:
The error message now clearly indicates "failed to fetch EC2 instances for upstream discovery" with the underlying error details.
Description
API changes
Code changes
CI changes
Docs changes
Context
Interesting decisions
Testing steps
Testing EC2 Credential Error Logging
This document describes how to test the error logging fix for EC2 upstream discovery when AWS credentials are invalid or missing.
Background
When an EC2 upstream is configured with invalid or empty
secretRef, the discovery fails silently without clear error logs. This fix adds explicit ERROR-level logging ineds.goto make credential failures visible.Prerequisites
# Verify prerequisites docker version kind version kubectl version --client glooctl version go versionStep 1: Create a Kind Cluster
Step 2: Install Gloo OSS (Released Version)
This step installs the current released version to observe the baseline behavior.
glooctl install gateway # Wait for pods to be ready kubectl -n gloo-system get pods -wExpected output:
Step 3: Create EC2 Upstream with Invalid Credentials
Create an EC2 upstream with empty
secretRefto trigger the error condition:Step 4: Observe Baseline Behavior (Before Fix)
Wait a few seconds for the EDS polling to trigger, then check logs:
Expected baseline behavior:
"received error and cannot aggregate it"discovery/discovery.go:215# Verify glooctl check shows no problems (this is the issue!) glooctl checkExpected: "No problems detected" even though the upstream is broken.
Step 5: Build Patched Gloo Image
Build Gloo with the error logging fix:
This will:
quay.io/solo-io/gloo:1.0.1-devStep 6: Deploy Patched Image
Update the gloo deployment to use the patched image:
Step 7: Verify the Fix
Check logs for the new ERROR-level logging:
Expected output with fix:
{ "level": "error", "caller": "ec2/eds.go:104", "msg": "failed to fetch EC2 instances for upstream discovery", "error": "unable to get aws client: unable to create a session with credentials taken from secret ref: secrets not found for secret ref .: list did not find secret ." }Key improvements:
warnerrordiscovery/discovery.goec2/eds.go:104The error will repeat every 30 seconds (EDS polling interval), providing continuous visibility.
Step 8: Test with Real AWS Credentials (Optional)
To test with real but invalid AWS credentials:
This should show an error about AWS rejecting the credentials.
Cleanup
# Delete the kind cluster kind delete cluster --name gloo-testNotes for reviewers
Checklist: