-
Notifications
You must be signed in to change notification settings - Fork 435
Closed
Copy link
Labels
triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
Describe the bug
Namespace information is not tracked in the plugin ConfigMap
keys.
Resources in other namespaces with the same name will collide and overwrite each other if they match the same instances.
If the two or more resources have different plugins listed, alternating reconciles will trigger a restart of the matching Grafana instances.
Came up while reviewing the improved handling plugins in #2162.
Version
v5.19.x
To Reproduce
Steps to reproduce the behavior:
- Create two datasources with the same name, must be done in different namespaces.
kubectl get grafanadatasources.grafana.integreatly.org -A
NAMESPACE NAME NO MATCHING INSTANCES LAST RESYNC AGE
default example-grafanadatasource 80s 31m
grafana-crds example-grafanadatasource 2m8s 31m
- Make sure the pluginlist between the datasources are different, either different versions or one having an empty list etc.
- Create a Grafana instance which satisfies the instanceSelector of both datasources.
- Make sure one or both datasources have
.spec.allowCrossNamespaceImport=true
to match across namespaces. - Observe the deployment being modified back and forth by the operator depending on which datasource was last reconciled.
Expected behavior
The plugin list to be stable across namespaces regardless of the name of resources.
Suspect component/Location where the bug might be occurring
Dashboard:
err = ReconcilePlugins(ctx, r.Client, r.Scheme, &grafana, cr.Spec.Plugins, fmt.Sprintf("%v-dashboard", cr.Name)) |
err = ReconcilePlugins(ctx, r.Client, r.Scheme, &grafana, nil, fmt.Sprintf("%v-dashboard", cr.Name)) |
Datasource:
err = ReconcilePlugins(ctx, r.Client, r.Scheme, &grafana, cr.Spec.Plugins, fmt.Sprintf("%v-datasource", cr.Name)) |
err = ReconcilePlugins(ctx, r.Client, r.Scheme, &grafana, nil, fmt.Sprintf("%v-datasource", cr.Name)) |
Library Panel:
err := ReconcilePlugins(ctx, r.Client, r.Scheme, instance, cr.Spec.Plugins, fmt.Sprintf("%v-librarypanel", cr.Name)) |
Example of the resulting ConfigMap:
kubectl get cm grafana-plugins -o yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-plugins
namespace: default
binaryData:
# The below value is changed on every alternate reconciliation triggering a restart.
example-grafanadatasource-datasource: W3sibmFtZSI6ImdyYWZhbmEtY2xvY2stcGFuZWwiLCJ2ZXJzaW9uIjoiMS4zLjAifV0=
Metadata
Metadata
Assignees
Labels
triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.