@@ -45,8 +45,6 @@ import (
45
45
"k8s.io/apimachinery/pkg/types"
46
46
"k8s.io/client-go/kubernetes"
47
47
"sigs.k8s.io/controller-runtime/pkg/client/config"
48
-
49
- "k8s.io/apimachinery/pkg/runtime/schema"
50
48
)
51
49
52
50
func NewKatibUIHandler (dbManagerAddr string ) * KatibUIHandler {
@@ -605,7 +603,7 @@ func (k *KatibUIHandler) FetchTrialLogs(w http.ResponseWriter, r *http.Request)
605
603
return
606
604
}
607
605
608
- user , err = IsAuthorized (consts .ActionTypeList , namespace , "pods" , "" , "" , schema. GroupVersion { Group : "apps" , Version : "v1" } , k .katibClient .GetClient (), r )
606
+ user , err = IsAuthorized (consts .ActionTypeList , namespace , corev1 . ResourcePods . String () , "" , "" , corev1 . SchemeGroupVersion , k .katibClient .GetClient (), r )
609
607
if user == "" && err != nil {
610
608
log .Printf ("No user provided in kubeflow-userid header." )
611
609
http .Error (w , err .Error (), http .StatusUnauthorized )
@@ -638,13 +636,13 @@ func (k *KatibUIHandler) FetchTrialLogs(w http.ResponseWriter, r *http.Request)
638
636
return
639
637
}
640
638
641
- user , err = IsAuthorized (consts .ActionTypeGet , namespace , "pods" , "log" , podName , schema. GroupVersion { Group : "apps" , Version : "v1" } , k .katibClient .GetClient (), r )
639
+ user , err = IsAuthorized (consts .ActionTypeGet , namespace , corev1 . ResourcePods . String () , "log" , podName , corev1 . SchemeGroupVersion , k .katibClient .GetClient (), r )
642
640
if user == "" && err != nil {
643
641
log .Printf ("No user provided in kubeflow-userid header." )
644
642
http .Error (w , err .Error (), http .StatusUnauthorized )
645
643
return
646
644
} else if err != nil {
647
- log .Printf ("The user: %s is not authorized to list pod logs: %s in namespace: %s \n " , user , podName , namespace )
645
+ log .Printf ("The user: %s is not authorized to get pod logs: %s in namespace: %s \n " , user , podName , namespace )
648
646
http .Error (w , err .Error (), http .StatusForbidden )
649
647
return
650
648
}
0 commit comments