You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "advancedxy (via GitHub)" <gi...@apache.org> on 2023/02/02 09:03:58 UTC

[GitHub] [incubator-uniffle] advancedxy commented on a diff in pull request #540: [operator] fix error kind of ownerreference

advancedxy commented on code in PR #540:
URL: https://github.com/apache/incubator-uniffle/pull/540#discussion_r1094215919


##########
deploy/kubernetes/operator/pkg/controller/util/util.go:
##########
@@ -44,11 +44,12 @@ func AddOwnerReference(meta *metav1.ObjectMeta, rss *v1alpha1.RemoteShuffleServi
 func generateOwnerReference(rss *v1alpha1.RemoteShuffleService) []metav1.OwnerReference {
 	return []metav1.OwnerReference{
 		{
-			APIVersion: v1alpha1.SchemeGroupVersion.String(),
-			Kind:       "RSS",
-			Name:       rss.Name,
-			UID:        rss.UID,
-			Controller: pointer.Bool(true),
+			APIVersion:         v1alpha1.SchemeGroupVersion.String(),
+			Kind:               "RemoteShuffleService",

Review Comment:
   Could you put the `"RemoteShuffleService"` in the constant package?
   And add a comment for why rss.Kind isn't used.



##########
deploy/kubernetes/operator/pkg/controller/controller/rss.go:
##########
@@ -755,7 +755,7 @@ func (r *rssController) enqueueShuffleServer(obj interface{}) {
 func (r *rssController) removeFinalizer(rss *unifflev1alpha1.RemoteShuffleService) error {
 	rssCopy := rss.DeepCopy()
 	var finalizers []string
-	for _, f := range finalizers {
+	for _, f := range rssCopy.Finalizers {

Review Comment:
   is it possible to add a ut for the removeFinalizer method?



##########
deploy/kubernetes/operator/pkg/controller/util/util.go:
##########
@@ -44,11 +44,12 @@ func AddOwnerReference(meta *metav1.ObjectMeta, rss *v1alpha1.RemoteShuffleServi
 func generateOwnerReference(rss *v1alpha1.RemoteShuffleService) []metav1.OwnerReference {
 	return []metav1.OwnerReference{
 		{
-			APIVersion: v1alpha1.SchemeGroupVersion.String(),
-			Kind:       "RSS",
-			Name:       rss.Name,
-			UID:        rss.UID,
-			Controller: pointer.Bool(true),
+			APIVersion:         v1alpha1.SchemeGroupVersion.String(),
+			Kind:               "RemoteShuffleService",
+			BlockOwnerDeletion: pointer.Bool(true),

Review Comment:
   is this necessary?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org