clientset操作Service、ServiceMonitor、Endpoints
删除指定的Endpoints:1
2
3
4
5
6
7
8
9
10
11
12var grace int64 = 0
var clientset *kubernetes.Clientset
clientset, err = kubernetes.NewForConfig(util.GetKubeConfig())
if err != nil {
util.Logger.Error(err)
return err
}
if err = clientset.CoreV1().Endpoints(namespace).Delete(strings.ToLower(clusterName), &metav1.DeleteOptions{GracePeriodSeconds: &grace}); err != nil {
if !apierrors.IsNotFound(err) {
return err
}
}
删除指定的Service: