-
Notifications
You must be signed in to change notification settings - Fork 399
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
Watch ConfigMap to prevent datasources from not being imported. #664
Conversation
Signed-off-by: zoetrope <a.ikezoe@gmail.com>
return ctrl.NewControllerManagedBy(mgr). | ||
For(&integreatlyorgv1alpha1.GrafanaDataSource{}). | ||
Watches(&source.Kind{Type: &v1.ConfigMap{}}, handler.EnqueueRequestsFromMapFunc(cmHandler)). |
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.
Why not use Owns(&v1.ConfigMap{})
instead? That would trigger the normal reconcile function where we could check if it's the right configmap.
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.
@pb82
Unfortunately, the owner of the configmap is not a DataSource resource, but a Grafana resource.
So we cannot use Owns(&v1.ConfigMap{})
in this 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.
Looks good to me, if @pb82 is also happy with it, we can merge
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
Description
If a datasource resource is created before grafana-controller creates a configmap resource, the datasource resource will not be imported.
I fixed it so that datasource-controller triggers configmap changes to reconcile datasources.
Relevant issues/tickets
#652
Type of change
Checklist
Verification steps