Skip to content

Commit 9affc62

Browse files
authored
don't treat missing datasource as an error when deleting datasource (#1879)
1 parent 10b863e commit 9affc62

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

controllers/datasource_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ func (r *GrafanaDatasourceReconciler) syncDatasources(ctx context.Context) (ctrl
114114
instanceDatasource, err := grafanaClient.Datasources.GetDataSourceByUID(uid)
115115
if err != nil {
116116
var notFound *datasources.GetDataSourceByUIDNotFound
117-
if errors.As(err, &notFound) {
117+
if !errors.As(err, &notFound) {
118118
return ctrl.Result{}, err
119119
}
120120
log.Info("datasource no longer exists", "namespace", namespace, "name", name)
121121
} else {
122122
_, err = grafanaClient.Datasources.DeleteDataSourceByUID(instanceDatasource.Payload.UID) //nolint
123123
if err != nil {
124124
var notFound *datasources.DeleteDataSourceByUIDNotFound
125-
if errors.As(err, &notFound) {
125+
if !errors.As(err, &notFound) {
126126
return ctrl.Result{}, err
127127
}
128128
}

controllers/grafanafolder_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (r *GrafanaFolderReconciler) syncFolders(ctx context.Context) (ctrl.Result,
101101
for _, folder := range existingFolders {
102102
// avoid bombarding the grafana instance with a large number of requests at once, limit
103103
// the sync to a certain number of folders per cycle. This means that it will take longer to sync
104-
// a large number of deleted dashboard crs, but that should be an edge case.
104+
// a large number of deleted folders crs, but that should be an edge case.
105105
if foldersSynced >= syncBatchSize {
106106
return ctrl.Result{Requeue: true}, nil
107107
}

0 commit comments

Comments
 (0)