Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix event recorder initialization and add check to log #2467

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

jdn5126
Copy link
Contributor

@jdn5126 jdn5126 commented Jul 13, 2023

What type of PR is this?
bug

Which issue does this PR fix:
#2466
#2448

What does this PR do / Why do we need it:
For #2466 , this PR fixes an issue with creating events when IAM permissions are missing. The EventRecorder object was not being properly initialized. Also, the EventRecorder package is now more modular, so dependent packages can simply call eventrecorder.Get() to get the object. Initialization is left to aws-k8s-agent on startup.

For #2448 , this PR fixes a logging issue where a malformed EC2 response (missing Attachment) was trying to access the missing field in order to log.

If an issue # is not available please add repro steps and logs from IPAMD/CNI showing the issue:
N/A

Testing done on this change:
Manually verified that integration tests pass. Scheduling runner against this PR.

Automation added to e2e:
N/A

Will this PR introduce any new dependencies?:
No

Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No, Yes

Does this change require updates to the CNI daemonset config files to work?:
No

Does this PR introduce any user-facing change?:
Yes

Fix issue where missing IAM permissions did not generate Event; handle malformed EC2 response

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jdn5126 jdn5126 requested a review from a team as a code owner July 13, 2023 21:59
@jdn5126
Copy link
Contributor Author

jdn5126 commented Jul 13, 2023

pkg/awsutils/awsutils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jayanthvn jayanthvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jdn5126
Copy link
Contributor Author

jdn5126 commented Jul 14, 2023

@jayanthvn jayanthvn merged commit 8a74ca7 into aws:master Jul 14, 2023
@jdn5126 jdn5126 deleted the iam_event branch July 14, 2023 23:06
@@ -89,3 +94,16 @@ func findMyPod(cachedK8SClient client.Client) (corev1.Pod, error) {
}
return pod, err
}

// Functions used for mocking package
func InitMockEventRecorder() *events.FakeRecorder {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post merge review; a mock recorder could be test files as, I hope, we don't use this in real code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants