-
Notifications
You must be signed in to change notification settings - Fork 707
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
Validating policy ID only when running in Fleet mode for Elastic Agent #6938
Validating policy ID only when running in Fleet mode for Elastic Agent #6938
Conversation
@@ -38,7 +38,7 @@ func (a *Agent) GetWarnings() []string { | |||
if a == nil { | |||
return nil | |||
} | |||
if len(a.Spec.PolicyID) == 0 { | |||
if a.Spec.Mode == AgentFleetMode && len(a.Spec.PolicyID) == 0 { |
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 this change makes perfect sense, but I also think it's a perfect opportunity for a set of unit tests around this function.
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.
There are existing unit tests, will fix those and add a new one
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 only looking for a webhooks_test.go
file and didn't see it. My apologies.
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.
LGTM
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.
also lgtm now
The Agent webhook attempts to check if PolicyID is set whether or not the Agent is running in fleet or standalone mode, This check should only be done in fleet mode. Fixes #6903