Add job type

Signed-off-by: chenliu1993 <cl2037829916@gmail.com>
This commit is contained in:
chenliu1993 2023-08-30 17:28:03 +09:00
parent 9261f26bfe
commit 927974da11
No known key found for this signature in database
GPG Key ID: 9F23BE8AB5505634

View File

@ -73,6 +73,9 @@ func FetchControllerObj(kind, name, namespace string, clientset *kubernetes.Clie
return clientset.AppsV1().ReplicaSets(namespace).Get(context.TODO(), name, metav1.GetOptions{})
case "DaemonSet":
return clientset.AppsV1().DaemonSets(namespace).Get(context.TODO(), name, metav1.GetOptions{})
case "Job":
// Both CronJob-managed and Job-managed pods are of type Job owner
return clientset.BatchV1().Jobs(namespace).Get(context.TODO(), name, metav1.GetOptions{})
default:
return nil, fmt.Errorf("unsupported controller kind %s", kind)
}