Skip to content

Commit

Permalink
simplify the return in k8s clientset
Browse files Browse the repository at this point in the history
  • Loading branch information
songjiaxun committed Dec 21, 2023
1 parent 98b850a commit 5e14b88
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/cloud_provider/clientset/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,11 @@ func New(kubeconfigPath string) (Interface, error) {
}

func (c *Clientset) GetPod(ctx context.Context, namespace, name string) (*v1.Pod, error) {
pod, err := c.k8sClients.CoreV1().Pods(namespace).Get(ctx, name, metav1.GetOptions{})
if err != nil {
return nil, err
}

return pod, nil
return c.k8sClients.CoreV1().Pods(namespace).Get(ctx, name, metav1.GetOptions{})
}

func (c *Clientset) GetDaemonSet(ctx context.Context, namespace, name string) (*appsv1.DaemonSet, error) {
ds, err := c.k8sClients.AppsV1().DaemonSets(namespace).Get(ctx, name, metav1.GetOptions{})
if err != nil {
return nil, err
}

return ds, nil
return c.k8sClients.AppsV1().DaemonSets(namespace).Get(ctx, name, metav1.GetOptions{})
}

func (c *Clientset) CreateServiceAccountToken(ctx context.Context, namespace, name string, tokenRequest *authenticationv1.TokenRequest) (*authenticationv1.TokenRequest, error) {
Expand Down

0 comments on commit 5e14b88

Please sign in to comment.