Skip to content

Commit

Permalink
Merge pull request #162 from Bharadwajshivam28/Improving_logging
Browse files Browse the repository at this point in the history
Improved logging for clusterrole and clusterbinding
  • Loading branch information
k8s-ci-robot authored Feb 27, 2024
2 parents c5a232b + a92c148 commit a54a903
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions pkg/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,9 @@ func RunE2E(clientset *kubernetes.Clientset) {
} else {
log.Fatal(err)
}
} else {
log.Printf("clusterrole created %s\n", clusterRole.Name)
}
log.Printf("clusterrole created %s\n", clusterRole.Name)

clusterRoleBinding, err := clientset.RbacV1().ClusterRoleBindings().Create(ctx, &conformanceClusterRoleBinding, metav1.CreateOptions{})
if err != nil {
Expand All @@ -257,8 +258,9 @@ func RunE2E(clientset *kubernetes.Clientset) {
} else {
log.Fatal(err)
}
} else {
log.Printf("clusterrolebinding created %s\n", clusterRoleBinding.Name)
}
log.Printf("clusterrolebinding created %s\n", clusterRoleBinding.Name)

if viper.GetString("test-repo-list") != "" {
RepoListData, err := os.ReadFile(viper.GetString("test-repo-list"))
Expand Down Expand Up @@ -340,8 +342,9 @@ func Cleanup(clientset *kubernetes.Clientset) {
} else {
log.Fatal(err)
}
} else {
log.Printf("pod deleted %s\n", common.PodName)
}
log.Printf("pod deleted %s\n", common.PodName)

err = clientset.RbacV1().ClusterRoleBindings().Delete(ctx, common.ClusterRoleBindingName, metav1.DeleteOptions{})
if err != nil {
Expand All @@ -350,8 +353,9 @@ func Cleanup(clientset *kubernetes.Clientset) {
} else {
log.Fatal(err)
}
} else {
log.Printf("clusterrolebinding deleted %s\n", common.ClusterRoleBindingName)
}
log.Printf("clusterrolebinding deleted %s\n", common.ClusterRoleBindingName)

err = clientset.RbacV1().ClusterRoles().Delete(ctx, common.ClusterRoleName, metav1.DeleteOptions{})
if err != nil {
Expand All @@ -360,8 +364,9 @@ func Cleanup(clientset *kubernetes.Clientset) {
} else {
log.Fatal(err)
}
} else {
log.Printf("clusterrole deleted %s\n", common.ClusterRoleName)
}
log.Printf("clusterrole deleted %s\n", common.ClusterRoleName)

err = clientset.CoreV1().ServiceAccounts(namespace).Delete(ctx, common.ServiceAccountName, metav1.DeleteOptions{})
if err != nil {
Expand All @@ -370,8 +375,9 @@ func Cleanup(clientset *kubernetes.Clientset) {
} else {
log.Fatal(err)
}
} else {
log.Printf("serviceaccount deleted %s\n", common.ServiceAccountName)
}
log.Printf("serviceaccount deleted %s\n", common.ServiceAccountName)

err = clientset.CoreV1().Namespaces().Delete(ctx, namespace, metav1.DeleteOptions{})
if err != nil {
Expand All @@ -380,8 +386,9 @@ func Cleanup(clientset *kubernetes.Clientset) {
} else {
log.Fatal(err)
}
} else {
log.Printf("namespace deleted %s\n", namespace)
}
log.Printf("namespace deleted %s\n", namespace)
}

// DryRun returns an environment variable to tell the conformance test to run in dry run mode.
Expand Down

0 comments on commit a54a903

Please sign in to comment.