Skip to content
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

fix: use controller reference instead of owner reference #1574

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading