Skip to content

Commit

Permalink
[from now] 2024/07/03 18:40:48
Browse files Browse the repository at this point in the history
diff --git a/e2e/pkg/fixtures/manager.go b/e2e/pkg/fixtures/manager.go
index 8c32b30..1c2096c 100644
--- a/e2e/pkg/fixtures/manager.go
+++ b/e2e/pkg/fixtures/manager.go
@@ -7,6 +7,7 @@ import (
 	corev1 "k8s.io/api/core/v1"
 	rbacv1 "k8s.io/api/rbac/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/klog/v2"
 	utilpointer "k8s.io/utils/pointer"
 	"sigs.k8s.io/controller-runtime/pkg/client"
 )
@@ -52,7 +53,7 @@ func DeleteManager(ctx context.Context, k8sClient client.Client, ns, name string
 			Namespace: ns,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}
 	if err := k8sClient.Delete(ctx, &rbacv1.RoleBinding{
 		ObjectMeta: metav1.ObjectMeta{
@@ -60,7 +61,7 @@ func DeleteManager(ctx context.Context, k8sClient client.Client, ns, name string
 			Namespace: ns,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}
 	if err := k8sClient.Delete(ctx, &rbacv1.Role{
 		ObjectMeta: metav1.ObjectMeta{
@@ -68,21 +69,21 @@ func DeleteManager(ctx context.Context, k8sClient client.Client, ns, name string
 			Namespace: ns,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}
 	if err := k8sClient.Delete(ctx, &rbacv1.ClusterRoleBinding{
 		ObjectMeta: metav1.ObjectMeta{
 			Name: roleName,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}
 	if err := k8sClient.Delete(ctx, &rbacv1.ClusterRole{
 		ObjectMeta: metav1.ObjectMeta{
 			Name: roleName,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}
 	if err := k8sClient.Delete(ctx, &corev1.ServiceAccount{
 		ObjectMeta: metav1.ObjectMeta{
@@ -90,7 +91,7 @@ func DeleteManager(ctx context.Context, k8sClient client.Client, ns, name string
 			Namespace: ns,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}

 	return nil
@@ -140,15 +141,15 @@ func role(name string) *rbacv1.ClusterRole {
 	}
 }

-func clusterRoleBinding(ns, name, role string) *rbacv1.ClusterRoleBinding {
+func clusterRoleBinding(ns, SAName, role string) *rbacv1.ClusterRoleBinding {
 	return &rbacv1.ClusterRoleBinding{
 		ObjectMeta: metav1.ObjectMeta{
-			Name: name,
+			Name: role,
 		},
 		Subjects: []rbacv1.Subject{
 			{
 				Kind:      "ServiceAccount",
-				Name:      name,
+				Name:      SAName,
 				Namespace: ns,
 			},
 		},
diff --git a/e2e/pkg/fixtures/rollout.go b/e2e/pkg/fixtures/rollout.go
index 367e21e..7f0db5a 100644
--- a/e2e/pkg/fixtures/rollout.go
+++ b/e2e/pkg/fixtures/rollout.go
@@ -6,6 +6,7 @@ import (
 	argorolloutsapiv1alpha1 "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/klog/v2"
 	utilpointer "k8s.io/utils/pointer"
 	"sigs.k8s.io/controller-runtime/pkg/client"
 )
@@ -77,7 +78,7 @@ func DeleteRollout(ctx context.Context, k8sClient client.Client, ns, name string
 			Namespace: ns,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}
 	if err := k8sClient.Delete(ctx, &corev1.Service{
 		ObjectMeta: metav1.ObjectMeta{
@@ -85,7 +86,7 @@ func DeleteRollout(ctx context.Context, k8sClient client.Client, ns, name string
 			Namespace: ns,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}
 	if err := k8sClient.Delete(ctx, &argorolloutsapiv1alpha1.Rollout{
 		ObjectMeta: metav1.ObjectMeta{
@@ -93,7 +94,7 @@ func DeleteRollout(ctx context.Context, k8sClient client.Client, ns, name string
 			Namespace: ns,
 		},
 	}); err != nil {
-		return err
+		klog.Error(err)
 	}
 	return nil
 }
  • Loading branch information
h3poteto committed Jul 3, 2024
1 parent 28f6b74 commit 0959b3d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
19 changes: 10 additions & 9 deletions e2e/pkg/fixtures/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog/v2"
utilpointer "k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down Expand Up @@ -52,45 +53,45 @@ func DeleteManager(ctx context.Context, k8sClient client.Client, ns, name string
Namespace: ns,
},
}); err != nil {
return err
klog.Error(err)
}
if err := k8sClient.Delete(ctx, &rbacv1.RoleBinding{
ObjectMeta: metav1.ObjectMeta{
Name: "leader-election",
Namespace: ns,
},
}); err != nil {
return err
klog.Error(err)
}
if err := k8sClient.Delete(ctx, &rbacv1.Role{
ObjectMeta: metav1.ObjectMeta{
Name: "leader-election",
Namespace: ns,
},
}); err != nil {
return err
klog.Error(err)
}
if err := k8sClient.Delete(ctx, &rbacv1.ClusterRoleBinding{
ObjectMeta: metav1.ObjectMeta{
Name: roleName,
},
}); err != nil {
return err
klog.Error(err)
}
if err := k8sClient.Delete(ctx, &rbacv1.ClusterRole{
ObjectMeta: metav1.ObjectMeta{
Name: roleName,
},
}); err != nil {
return err
klog.Error(err)
}
if err := k8sClient.Delete(ctx, &corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: SAName,
Namespace: ns,
},
}); err != nil {
return err
klog.Error(err)
}

return nil
Expand Down Expand Up @@ -140,15 +141,15 @@ func role(name string) *rbacv1.ClusterRole {
}
}

func clusterRoleBinding(ns, name, role string) *rbacv1.ClusterRoleBinding {
func clusterRoleBinding(ns, SAName, role string) *rbacv1.ClusterRoleBinding {
return &rbacv1.ClusterRoleBinding{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Name: role,
},
Subjects: []rbacv1.Subject{
{
Kind: "ServiceAccount",
Name: name,
Name: SAName,
Namespace: ns,
},
},
Expand Down
7 changes: 4 additions & 3 deletions e2e/pkg/fixtures/rollout.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
argorolloutsapiv1alpha1 "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog/v2"
utilpointer "k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down Expand Up @@ -77,23 +78,23 @@ func DeleteRollout(ctx context.Context, k8sClient client.Client, ns, name string
Namespace: ns,
},
}); err != nil {
return err
klog.Error(err)
}
if err := k8sClient.Delete(ctx, &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: previewService,
Namespace: ns,
},
}); err != nil {
return err
klog.Error(err)
}
if err := k8sClient.Delete(ctx, &argorolloutsapiv1alpha1.Rollout{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: ns,
},
}); err != nil {
return err
klog.Error(err)
}
return nil
}
Expand Down

0 comments on commit 0959b3d

Please sign in to comment.