-
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
Fix handling of unmanaged esRef in Beats Stack Monitoring #6482
Conversation
@@ -100,6 +100,22 @@ func GetUnmanagedAssociationConnectionInfoFromSecret(c k8s.Client, o commonv1.Ob | |||
return &ref, nil | |||
} | |||
|
|||
// Version performs an HTTP GET request to the unmanaged Elastic resource at the given path and returns a string extracted | |||
// from the returned result using the given json path and validates it is a valid semver version. | |||
func (r UnmanagedAssociationConnectionInfo) Version(path string, jsonPath string) (string, error) { |
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.
So I understand what you're doing here, but I'm a bit unsure as to why we're doing it. We are wanting all communications to unmanaged ES clusters in this code path to be explicitly version validated. We were originally doing this for all requests to unmanaged ES clusters. Was this causing an issue?
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.
Not sure if I understand your question here. I just renamed this function because the name was misleading. It was called Request
originally when in fact it was doing more than just "requesting" but also parsing the result of applying the JSON path expression as a semver version.
I have not changed anything with regards to when we to version validation on associations. All I wanted was a way to do a more generic request through this mechanism so that we can extract the UUID from the remote cluster for the Beats configuration.
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.
Let me try to better explain. We now have both Request, and Version, of which Version is exactly the same code path as Request, and Request now just doesn't parse the version. You also updated all association controllers to use Version, which doesn't change the code path, but makes what's happening a bit clearer. But now in associatedESUUID
you call uuid, err := remoteES.Request("/", "{.cluster_uuid}")
, which now does not do version validation. I'm wondering why you're not calling .Version
here instead, as do all of the other code paths, and if that's the case, do we want to un-export Request
?
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 am not doing a version validation because what I am interested in is not the version but the cluster UUID for the Beats config. Version validation is still/already done by the association controller. All I want is to pull a piece of data out of the unmanaged cluster so that we can configure Beats in the same way we do it for ECK managed Elasticsearch clusters.
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.
Okay, so the validation is already being done by the beats controller, which is the piece I was missing here. Thanks again for the explanation
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
Fixes #6230
Fixes #5880
Beats stack monitoring assumed that the associated Elasticsearch cluster is a local cluster managed by ECK. However a Beats definition as follows would break the stack monitoring feature:
Worse still we would silently swallow the error creating the appearance of normalcy when the situation was in fact not normal.
This PR tries to address these issues by:
Known issues: