-
Notifications
You must be signed in to change notification settings - Fork 344
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
Automatically set num shards and replicas from referenced OCP ES #1737
Conversation
var jaegerlog = logf.Log.WithName("jaeger-resource") | ||
var ( | ||
jaegerlog = logf.Log.WithName("jaeger-resource") | ||
cl client.Client |
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 don't like introducing a global state, but another option would be to implement the webhook "manually", which I like even less for validating and defaulting webhooks.
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.
Can we register another object to handle the webhook instead of Jaeger and embed Jaeger?
Just an idea (untested)
type JaegerWebhook struct {
Jaeger
cl client.Client
}
type Jaeger struct {
...
}
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.
that unfortunately does not work. We could add the client to the Jaeger
but that is even worse.
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 is the "less worse" option we have, I don't like it either but I don't see any other possibility so far.
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.
While I was working on something else I became aware of the custom validator[0].
What do you think about using it? The method calls differ only slightly. In the SetupWebhookWithManager
the locale client could be passed to the validator.
func (r *something) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).
WithValidator(newSomethingValidator(mgr.GetClient())).
Complete()
}
} | ||
|
||
// NewElasticsearchReconciler creates a new deployment reconciler controller | ||
func NewElasticsearchReconciler(client client.Client, clientReader client.Reader) *ElasticsearchReconciler { |
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.
To be honest I am not sure whether we should use controller or webook to catch changes on the ES CR. I didn't find any good docs when to use webhook over controller.
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.
@rubenvp8510 any thoughts?
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 for this case it is OK to use a controller, I haven't found a reference for when to use webhooks or controllers, but I tend to think that webhooks are for validation or mutating the resource, which is not the case here. Also this allow us to reenqueue the reconciliation in case of failure.
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 the controller is fine here, the webhooks should be more used for validation or mutating.
I had to make one more important change. The controller can be installed only if Elasticsearch
kind is installed in the cluster (OpenShift Elasticserach operator).
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 seems this is already covered in docs
If you require persistent storage, you must also install the OpenShift Elasticsearch Operator before installing the Red Hat OpenShift distributed tracing platform Operator.
cc) @JStickler
909f70b
to
4af923d
Compare
Codecov Report
@@ Coverage Diff @@
## main #1737 +/- ##
==========================================
+ Coverage 87.53% 87.67% +0.13%
==========================================
Files 99 100 +1
Lines 5946 6003 +57
==========================================
+ Hits 5205 5263 +58
+ Misses 567 563 -4
- Partials 174 177 +3
Continue to review full report at Codecov.
|
} | ||
|
||
// ShouldInjectOpenShiftElasticsearchConfiguration returns true if OpenShift Elasticsearch is used and its configuration should be used. | ||
func ShouldInjectOpenShiftElasticsearchConfiguration(s JaegerStorageSpec) bool { |
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.
What is the difference between this function and https://github.com/jaegertracing/jaeger-operator/blob/master/pkg/storage/elasticsearch.go#L26 ? Can we use the one we already have?
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.
The referenced one moved here to the v1
package.
4ab1501
to
deb93ad
Compare
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
77b89b0
to
039a508
Compare
@rubenvp8510 could you please review? |
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
Signed-off-by: Pavol Loffay [email protected]
Resolves #1720
Notable changes:
Test data: