Skip to content

Commit

Permalink
Merge pull request #1574 from grafana/fix/controller-reference
Browse files Browse the repository at this point in the history
fix: use controller reference instead of owner reference
  • Loading branch information
theSuess authored Jun 7, 2024
2 parents 0c7cf92 + 70d0529 commit 0713b0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controllers/model/dashboard_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ func GetPluginsConfigMap(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme) *v1
Namespace: cr.Namespace,
},
}
controllerutil.SetOwnerReference(cr, config, scheme) //nolint:errcheck
controllerutil.SetControllerReference(cr, config, scheme) //nolint:errcheck
return config
}
15 changes: 8 additions & 7 deletions controllers/model/grafana_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func GetGrafanaConfigMap(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme) *v1
Namespace: cr.Namespace,
},
}
controllerutil.SetOwnerReference(cr, config, scheme) //nolint:errcheck
controllerutil.SetControllerReference(cr, config, scheme) //nolint:errcheck
return config
}

Expand All @@ -33,7 +33,7 @@ func GetGrafanaAdminSecret(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme) *
}

if scheme != nil {
controllerutil.SetOwnerReference(cr, secret, scheme) //nolint:errcheck
controllerutil.SetControllerReference(cr, secret, scheme) //nolint:errcheck
}
return secret
}
Expand All @@ -45,6 +45,7 @@ func GetGrafanaDataPVC(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme) *v1.P
Namespace: cr.Namespace,
},
}
// using OwnerReference specifically here to allow admins to change storage variables without the operator complaining
controllerutil.SetOwnerReference(cr, pvc, scheme) //nolint:errcheck
return pvc
}
Expand All @@ -56,7 +57,7 @@ func GetGrafanaServiceAccount(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme
Namespace: cr.Namespace,
},
}
controllerutil.SetOwnerReference(cr, sa, scheme) //nolint:errcheck
controllerutil.SetControllerReference(cr, sa, scheme) //nolint:errcheck
return sa
}

Expand All @@ -67,7 +68,7 @@ func GetGrafanaService(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme) *v1.S
Namespace: cr.Namespace,
},
}
controllerutil.SetOwnerReference(cr, service, scheme) //nolint:errcheck
controllerutil.SetControllerReference(cr, service, scheme) //nolint:errcheck
return service
}

Expand All @@ -78,7 +79,7 @@ func GetGrafanaIngress(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme) *v12.
Namespace: cr.Namespace,
},
}
controllerutil.SetOwnerReference(cr, ingress, scheme) //nolint:errcheck
controllerutil.SetControllerReference(cr, ingress, scheme) //nolint:errcheck
return ingress
}

Expand All @@ -89,7 +90,7 @@ func GetGrafanaRoute(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme) *routev
Namespace: cr.Namespace,
},
}
controllerutil.SetOwnerReference(cr, route, scheme) //nolint:errcheck
controllerutil.SetControllerReference(cr, route, scheme) //nolint:errcheck
return route
}

Expand All @@ -101,7 +102,7 @@ func GetGrafanaDeployment(cr *grafanav1beta1.Grafana, scheme *runtime.Scheme) *v
},
}
if scheme != nil {
controllerutil.SetOwnerReference(cr, deployment, scheme) //nolint:errcheck
controllerutil.SetControllerReference(cr, deployment, scheme) //nolint:errcheck
}
return deployment
}

0 comments on commit 0713b0a

Please sign in to comment.