Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【ADD】Uniform use processCreateErr func to create resource #828

Merged
merged 14 commits into from
May 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions pkg/yurtctl/util/kubernetes/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,8 @@ func CreateDeployFromYaml(cliSet *kubernetes.Clientset, ns, dplyTmpl string, ctx
if !ok {
return errors.New("fail to assert Deployment")
}
if _, err = cliSet.AppsV1().Deployments(ns).Create(context.Background(), dply, metav1.CreateOptions{}); err != nil {
return err
}
klog.V(4).Infof("the deployment/%s is deployed", dply.Name)
return nil
_, err = cliSet.AppsV1().Deployments(ns).Create(context.Background(), dply, metav1.CreateOptions{})
return processCreateErr("deployment", dply.Name, err)
}

// CreateDaemonSetFromYaml creates the DaemonSet from the yaml template.
Expand All @@ -214,11 +211,7 @@ func CreateDaemonSetFromYaml(cliSet *kubernetes.Clientset, ns, dsTmpl string, ct
return fmt.Errorf("fail to assert daemonset: %v", err)
}
_, err = cliSet.AppsV1().DaemonSets(ns).Create(context.Background(), ds, metav1.CreateOptions{})
if err != nil {
return fmt.Errorf("fail to create the daemonset/%s: %v", ds.Name, err)
}
klog.V(4).Infof("daemonset/%s is created", ds.Name)
return nil
return processCreateErr("daemonset", ds.Name, err)
}

// CreateServiceFromYaml creates the Service from the yaml template.
Expand Down