-
Notifications
You must be signed in to change notification settings - Fork 304
Add flag to include api server audit logs in support bundle #9701
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
Add flag to include api server audit logs in support bundle #9701
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9701 +/- ##
==========================================
+ Coverage 69.78% 69.85% +0.06%
==========================================
Files 672 672
Lines 49679 49810 +131
==========================================
+ Hits 34669 34794 +125
- Misses 13230 13234 +4
- Partials 1780 1782 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4fe3edc
to
d6341d2
Compare
pkg/diagnostics/diagnostic_bundle.go
Outdated
@@ -122,7 +122,8 @@ func newDiagnosticBundleFromSpec(af AnalyzerFactory, cf CollectorFactory, spec * | |||
WithDefaultCollectors(). | |||
WithFileCollectors([]string{logger.GetOutputFilePath()}). | |||
WithPackagesCollectors(). | |||
WithLogTextAnalyzers() | |||
WithLogTextAnalyzers(). | |||
WithAuditLogs(auditLogs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to do
if auditLogs {
b = b.WithAuditLogs()
}
The WithAuditLogs function will be used to add AuditLogCollector, not checking if we need to add it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in WithAuditLogs we already have this check
if !auditLogs {
return e
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I'm suggesting moving this if
from WithAuditLogs to newDiagnosticBundleFromSpec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will move the logic outside the method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was basing this flow off other examples like
func (e *EksaDiagnosticBundle) WithManagementCluster(isSelfManaged bool) *EksaDiagnosticBundle {
if isSelfManaged {
e.bundle.Spec.Analyzers = append(e.bundle.Spec.Analyzers, e.analyzerFactory.ManagementClusterAnalyzers()...)
e.bundle.Spec.Collectors = append(e.bundle.Spec.Collectors, e.collectorFactory.ManagementClusterCollectors()...)
}
return e
}
d6341d2
to
6789e71
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rajeshvenkata The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue #, if available:
https://github.com/aws/eks-anywhere-internal/issues/3210
Description of changes:
Adds a flag
--audit-logs
togenerate support-bundle
command. When specified, will include the latest api server audit log file in the support bundle.It achieves this by using troubleshoot, with the RunDaemonSet collector. It only runs on control plane nodes, via a node selector. Only the latest log file will be collected, which can be up to 512MB due to
audit-log-maxsize: "512"
on api server pods. With multiple control plane nodes, the max size of these logs included could be a few GB.Example run
Example output from my support bundle
Testing (if applicable):
Tested on Ubuntu, RHEL and Bottlerocket
Documentation added/planned (if applicable):
Flag has been added to public docs
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.