diff --git a/hack/.golint_failures b/hack/.golint_failures index 0ce0e14469..7ea2ff67b7 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -1,16 +1,6 @@ volcano.sh/volcano/pkg/admission -volcano.sh/volcano/pkg/apis/batch/v1alpha1 -volcano.sh/volcano/pkg/apis/bus/v1alpha1 -volcano.sh/volcano/pkg/apis/helpers -volcano.sh/volcano/pkg/cli/job volcano.sh/volcano/pkg/controllers/apis volcano.sh/volcano/pkg/controllers/cache volcano.sh/volcano/pkg/controllers/job -volcano.sh/volcano/pkg/controllers/job/helpers -volcano.sh/volcano/pkg/controllers/job/plugins -volcano.sh/volcano/pkg/controllers/job/plugins/env -volcano.sh/volcano/pkg/controllers/job/plugins/interface -volcano.sh/volcano/pkg/controllers/job/plugins/ssh -volcano.sh/volcano/pkg/controllers/job/plugins/svc volcano.sh/volcano/pkg/controllers/job/state volcano.sh/volcano/test/e2e diff --git a/pkg/apis/batch/v1alpha1/doc.go b/pkg/apis/batch/v1alpha1/doc.go index 1c873db349..890d2ecd95 100644 --- a/pkg/apis/batch/v1alpha1/doc.go +++ b/pkg/apis/batch/v1alpha1/doc.go @@ -15,4 +15,5 @@ limitations under the License. */ // +k8s:deepcopy-gen=package + package v1alpha1 diff --git a/pkg/apis/batch/v1alpha1/job.go b/pkg/apis/batch/v1alpha1/job.go index d636eabd2c..e304ad195d 100644 --- a/pkg/apis/batch/v1alpha1/job.go +++ b/pkg/apis/batch/v1alpha1/job.go @@ -23,6 +23,8 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Job defines the volcano job type Job struct { metav1.TypeMeta `json:",inline"` @@ -98,12 +100,17 @@ type VolumeSpec struct { VolumeClaim *v1.PersistentVolumeClaimSpec `json:"volumeClaim,omitempty" protobuf:"bytes,3,opt,name=volumeClaim"` } +// JobEvent job event type JobEvent string const ( + // CommandIssued command issued event is generated if a command is raised by user CommandIssued JobEvent = "CommandIssued" - PluginError JobEvent = "PluginError" - PVCError JobEvent = "PVCError" + // PluginError plugin error event is generated if error happens + PluginError JobEvent = "PluginError" + // PVCError pvc error event is generated if error happens during IO creation + PVCError JobEvent = "PVCError" + // PodGroupError pod grp error event is generated if error happens during pod grp creation PodGroupError JobEvent = "PodGroupError" ) @@ -111,13 +118,13 @@ const ( type Event string const ( - // AllEvent means all event + // AnyEvent means all event AnyEvent Event = "*" // PodFailedEvent is triggered if Pod was failed PodFailedEvent Event = "PodFailed" // PodEvictedEvent is triggered if Pod was deleted PodEvictedEvent Event = "PodEvicted" - // These below are several events can lead to job 'Unknown' + // JobUnknownEvent These below are several events can lead to job 'Unknown' // 1. Task Unschedulable, this is triggered when part of // pods can't be scheduled while some are already running in gang-scheduling case. JobUnknownEvent Event = "Unknown" @@ -198,6 +205,7 @@ type TaskSpec struct { Policies []LifecyclePolicy `json:"policies,omitempty" protobuf:"bytes,4,opt,name=policies"` } +// JobPhase defines the phase of the job type JobPhase string const ( @@ -285,6 +293,8 @@ type JobStatus struct { } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// JobList defines the list of jobs type JobList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/pkg/apis/batch/v1alpha1/labels.go b/pkg/apis/batch/v1alpha1/labels.go index a0fdfbd1f2..78e01d8a7a 100644 --- a/pkg/apis/batch/v1alpha1/labels.go +++ b/pkg/apis/batch/v1alpha1/labels.go @@ -17,10 +17,16 @@ limitations under the License. package v1alpha1 const ( - TaskSpecKey = "volcano.sh/task-spec" - JobNameKey = "volcano.sh/job-name" + // TaskSpecKey task spec key used in pod annotation + TaskSpecKey = "volcano.sh/task-spec" + // JobNameKey job name key used in pod annotation / labels + JobNameKey = "volcano.sh/job-name" + // JobNamespaceKey job namespace key JobNamespaceKey = "volcano.sh/job-namespace" + // DefaultTaskSpec default task spec value DefaultTaskSpec = "default" - JobVersion = "volcano.sh/job-version" - JobTypeKey = "volcano.sh/job-type" + // JobVersion job version key used in pod annotation + JobVersion = "volcano.sh/job-version" + // JobTypeKey job type key used in labels + JobTypeKey = "volcano.sh/job-type" ) diff --git a/pkg/apis/batch/v1alpha1/register.go b/pkg/apis/batch/v1alpha1/register.go index 0c5b9e96fd..ec3f6aeba7 100644 --- a/pkg/apis/batch/v1alpha1/register.go +++ b/pkg/apis/batch/v1alpha1/register.go @@ -23,8 +23,10 @@ import ( ) var ( + // SchemeBuilder points to a list of functions added to Scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = SchemeBuilder.AddToScheme ) // GroupName is the group name used in this package. diff --git a/pkg/apis/bus/v1alpha1/doc.go b/pkg/apis/bus/v1alpha1/doc.go index 1c873db349..890d2ecd95 100644 --- a/pkg/apis/bus/v1alpha1/doc.go +++ b/pkg/apis/bus/v1alpha1/doc.go @@ -15,4 +15,5 @@ limitations under the License. */ // +k8s:deepcopy-gen=package + package v1alpha1 diff --git a/pkg/apis/bus/v1alpha1/register.go b/pkg/apis/bus/v1alpha1/register.go index 5c03343078..9165cb374d 100644 --- a/pkg/apis/bus/v1alpha1/register.go +++ b/pkg/apis/bus/v1alpha1/register.go @@ -23,8 +23,10 @@ import ( ) var ( + // SchemeBuilder points to a list of functions added to Scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = SchemeBuilder.AddToScheme ) // GroupName is the group name used in this package. diff --git a/pkg/apis/bus/v1alpha1/types.go b/pkg/apis/bus/v1alpha1/types.go index cddb9954da..d7c1543492 100644 --- a/pkg/apis/bus/v1alpha1/types.go +++ b/pkg/apis/bus/v1alpha1/types.go @@ -6,6 +6,8 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Command defines command structure type Command struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -26,6 +28,8 @@ type Command struct { } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CommandList defines list of commands type CommandList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/pkg/apis/helpers/helpers.go b/pkg/apis/helpers/helpers.go index 571d5edb70..21476f3854 100644 --- a/pkg/apis/helpers/helpers.go +++ b/pkg/apis/helpers/helpers.go @@ -32,9 +32,13 @@ import ( vkcorev1 "volcano.sh/volcano/pkg/apis/bus/v1alpha1" ) +// JobKind creates job GroupVersionKind var JobKind = vkbatchv1.SchemeGroupVersion.WithKind("Job") + +// CommandKind creates command GroupVersionKind var CommandKind = vkcorev1.SchemeGroupVersion.WithKind("Command") +// GetController returns the controller uid func GetController(obj interface{}) types.UID { accessor, err := meta.Accessor(obj) if err != nil { @@ -49,6 +53,7 @@ func GetController(obj interface{}) types.UID { return "" } +// ControlledBy controlled by func ControlledBy(obj interface{}, gvk schema.GroupVersionKind) bool { accessor, err := meta.Accessor(obj) if err != nil { @@ -63,6 +68,7 @@ func ControlledBy(obj interface{}, gvk schema.GroupVersionKind) bool { return false } +// CreateConfigMapIfNotExist creates config map resource if not present func CreateConfigMapIfNotExist(job *vkv1.Job, kubeClients kubernetes.Interface, data map[string]string, cmName string) error { // If ConfigMap does not exist, create one for Job. cmOld, err := kubeClients.CoreV1().ConfigMaps(job.Namespace).Get(cmName, metav1.GetOptions{}) @@ -102,15 +108,16 @@ func CreateConfigMapIfNotExist(job *vkv1.Job, kubeClients kubernetes.Interface, return nil } +// DeleteConfigmap deletes the config map resource func DeleteConfigmap(job *vkv1.Job, kubeClients kubernetes.Interface, cmName string) error { if _, err := kubeClients.CoreV1().ConfigMaps(job.Namespace).Get(cmName, metav1.GetOptions{}); err != nil { if !apierrors.IsNotFound(err) { glog.V(3).Infof("Failed to get Configmap for Job <%s/%s>: %v", job.Namespace, job.Name, err) return err - } else { - return nil } + return nil + } if err := kubeClients.CoreV1().ConfigMaps(job.Namespace).Delete(cmName, nil); err != nil { diff --git a/pkg/cli/job/common.go b/pkg/cli/job/common.go index 040b566112..9fa6b209de 100644 --- a/pkg/cli/job/common.go +++ b/pkg/cli/job/common.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package job import ( diff --git a/pkg/cli/job/delete.go b/pkg/cli/job/delete.go index 05789818ec..6662a2c0fa 100644 --- a/pkg/cli/job/delete.go +++ b/pkg/cli/job/delete.go @@ -35,6 +35,7 @@ type deleteFlags struct { var deleteJobFlags = &deleteFlags{} +// InitDeleteFlags init the delete command flags func InitDeleteFlags(cmd *cobra.Command) { initFlags(cmd, &deleteJobFlags.commonFlags) @@ -42,6 +43,7 @@ func InitDeleteFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&deleteJobFlags.JobName, "name", "n", "", "the name of job") } +// DeleteJob delete the job func DeleteJob() error { config, err := buildConfig(deleteJobFlags.Master, deleteJobFlags.Kubeconfig) if err != nil { diff --git a/pkg/cli/job/list.go b/pkg/cli/job/list.go index 534fe6db3d..41dff254b6 100644 --- a/pkg/cli/job/list.go +++ b/pkg/cli/job/list.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package job import ( @@ -36,24 +37,40 @@ type listFlags struct { } const ( - Name string = "Name" - Creation string = "Creation" - Phase string = "Phase" - Replicas string = "Replicas" - Min string = "Min" - Scheduler string = "Scheduler" - Pending string = "Pending" - Running string = "Running" - Succeeded string = "Succeeded" + + // Name name etc below key words are used in job print format + Name string = "Name" + // Creation create + Creation string = "Creation" + // Phase phase + Phase string = "Phase" + // Replicas replicas + Replicas string = "Replicas" + // Min minimum + Min string = "Min" + // Scheduler scheduler + Scheduler string = "Scheduler" + // Pending pending + Pending string = "Pending" + // Running running + Running string = "Running" + // Succeeded success + Succeeded string = "Succeeded" + // Terminating terminating Terminating string = "Terminating" - Version string = "Version" - Failed string = "Failed" - RetryCount string = "RetryCount" - JobType string = "JobType" + // Version version + Version string = "Version" + // Failed failed + Failed string = "Failed" + // RetryCount retry count + RetryCount string = "RetryCount" + // JobType job type + JobType string = "JobType" ) var listJobFlags = &listFlags{} +// InitListFlags init list command flags func InitListFlags(cmd *cobra.Command) { initFlags(cmd, &listJobFlags.commonFlags) @@ -61,6 +78,7 @@ func InitListFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&listJobFlags.SchedulerName, "scheduler", "S", "", "list job with specified scheduler name") } +// ListJobs lists all jobs details func ListJobs() error { config, err := buildConfig(listJobFlags.Master, listJobFlags.Kubeconfig) if err != nil { @@ -82,6 +100,7 @@ func ListJobs() error { return nil } +// PrintJobs prints all jobs details func PrintJobs(jobs *v1alpha1.JobList, writer io.Writer) { maxNameLen := getMaxNameLen(jobs) _, err := fmt.Fprintf(writer, fmt.Sprintf("%%-%ds%%-25s%%-12s%%-12s%%-12s%%-6s%%-10s%%-10s%%-12s%%-10s%%-12s\n", maxNameLen), diff --git a/pkg/cli/job/resume.go b/pkg/cli/job/resume.go index 8779bd70e1..54f6a7853a 100644 --- a/pkg/cli/job/resume.go +++ b/pkg/cli/job/resume.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package job import ( @@ -32,6 +33,7 @@ type resumeFlags struct { var resumeJobFlags = &resumeFlags{} +// InitResumeFlags init resume command flags func InitResumeFlags(cmd *cobra.Command) { initFlags(cmd, &resumeJobFlags.commonFlags) @@ -39,6 +41,7 @@ func InitResumeFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&resumeJobFlags.JobName, "name", "n", "", "the name of job") } +// ResumeJob resumes the job func ResumeJob() error { config, err := buildConfig(resumeJobFlags.Master, resumeJobFlags.Kubeconfig) if err != nil { diff --git a/pkg/cli/job/run.go b/pkg/cli/job/run.go index 4fc8c28afb..1270aa7bff 100644 --- a/pkg/cli/job/run.go +++ b/pkg/cli/job/run.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package job import ( @@ -41,6 +42,7 @@ type runFlags struct { var launchJobFlags = &runFlags{} +// InitRunFlags init the run flags func InitRunFlags(cmd *cobra.Command) { initFlags(cmd, &launchJobFlags.commonFlags) @@ -56,6 +58,7 @@ func InitRunFlags(cmd *cobra.Command) { var jobName = "job.volcano.sh" +// RunJob creates the job func RunJob() error { config, err := buildConfig(launchJobFlags.Master, launchJobFlags.Kubeconfig) if err != nil { diff --git a/pkg/cli/job/suspend.go b/pkg/cli/job/suspend.go index fb0ebf7fd6..3f6ddcc9b2 100644 --- a/pkg/cli/job/suspend.go +++ b/pkg/cli/job/suspend.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package job import ( @@ -31,6 +32,7 @@ type suspendFlags struct { var suspendJobFlags = &suspendFlags{} +// InitSuspendFlags init suspend related flags func InitSuspendFlags(cmd *cobra.Command) { initFlags(cmd, &suspendJobFlags.commonFlags) @@ -38,6 +40,7 @@ func InitSuspendFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&suspendJobFlags.JobName, "name", "n", "", "the name of job") } +// SuspendJob suspends the job func SuspendJob() error { config, err := buildConfig(suspendJobFlags.Master, suspendJobFlags.Kubeconfig) if err != nil { diff --git a/pkg/cli/job/util.go b/pkg/cli/job/util.go index a3c919e609..8a5db6a313 100644 --- a/pkg/cli/job/util.go +++ b/pkg/cli/job/util.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package job import ( diff --git a/pkg/cli/job/view.go b/pkg/cli/job/view.go index a4d9209fc4..68125b18bf 100644 --- a/pkg/cli/job/view.go +++ b/pkg/cli/job/view.go @@ -1,3 +1,19 @@ +/* +Copyright 2019 The Volcano Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package job import ( @@ -23,6 +39,7 @@ type viewFlags struct { var viewJobFlags = &viewFlags{} +// InitViewFlags init the view command flags func InitViewFlags(cmd *cobra.Command) { initFlags(cmd, &viewJobFlags.commonFlags) @@ -30,6 +47,7 @@ func InitViewFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&viewJobFlags.JobName, "name", "n", "", "the name of job") } +// ViewJob gives full details of the job func ViewJob() error { config, err := buildConfig(viewJobFlags.Master, viewJobFlags.Kubeconfig) if err != nil { @@ -54,6 +72,7 @@ func ViewJob() error { return nil } +// PrintJob prints the job details func PrintJob(job *v1alpha1.Job, writer io.Writer) { replicas := int32(0) for _, ts := range job.Spec.Tasks { diff --git a/pkg/controllers/job/helpers/helpers.go b/pkg/controllers/job/helpers/helpers.go index 10fd9a7dde..430a846cc1 100644 --- a/pkg/controllers/job/helpers/helpers.go +++ b/pkg/controllers/job/helpers/helpers.go @@ -25,10 +25,13 @@ import ( ) const ( - PodNameFmt = "%s-%s-%d" + // PodNameFmt pod name format + PodNameFmt = "%s-%s-%d" + // VolumeClaimFmt volume claim name format VolumeClaimFmt = "%s-volume-%s" ) +// GetTaskIndex returns task Index func GetTaskIndex(pod *v1.Pod) string { num := strings.Split(pod.Name, "-") if len(num) >= 3 { @@ -38,6 +41,7 @@ func GetTaskIndex(pod *v1.Pod) string { return "" } +// MakePodName creates pod name func MakePodName(jobName string, taskName string, index int) string { return fmt.Sprintf(PodNameFmt, jobName, taskName, index) } @@ -53,6 +57,7 @@ func genRandomStr(l int) string { return string(result) } +// MakeVolumeClaimName creates volume claim name func MakeVolumeClaimName(jobName string) string { return fmt.Sprintf(VolumeClaimFmt, jobName, genRandomStr(12)) } diff --git a/pkg/controllers/job/plugins/env/env.go b/pkg/controllers/job/plugins/env/env.go index 027fe3ce6f..7254d43e85 100644 --- a/pkg/controllers/job/plugins/env/env.go +++ b/pkg/controllers/job/plugins/env/env.go @@ -31,6 +31,7 @@ type envPlugin struct { Clientset vkinterface.PluginClientset } +// New creates env plugin func New(client vkinterface.PluginClientset, arguments []string) vkinterface.PluginInterface { envPlugin := envPlugin{pluginArguments: arguments, Clientset: client} diff --git a/pkg/controllers/job/plugins/env/types.go b/pkg/controllers/job/plugins/env/types.go index 301b95746b..5f751b5535 100644 --- a/pkg/controllers/job/plugins/env/types.go +++ b/pkg/controllers/job/plugins/env/types.go @@ -17,9 +17,12 @@ limitations under the License. package env const ( + // ConfigMapTaskHostFmt key in config map ConfigMapTaskHostFmt = "%s.host" + // ConfigMapMountPath mount path ConfigMapMountPath = "/etc/volcano" + // TaskVkIndex used as key in container env TaskVkIndex = "VK_TASK_INDEX" ) diff --git a/pkg/controllers/job/plugins/factory.go b/pkg/controllers/job/plugins/factory.go index dc6d2b9ef7..ed87c2489d 100644 --- a/pkg/controllers/job/plugins/factory.go +++ b/pkg/controllers/job/plugins/factory.go @@ -36,15 +36,18 @@ var pluginMutex sync.Mutex // Plugin management var pluginBuilders = map[string]PluginBuilder{} -type PluginBuilder func(_interface.PluginClientset, []string) _interface.PluginInterface +// PluginBuilder func prototype +type PluginBuilder func(pluginsinterface.PluginClientset, []string) pluginsinterface.PluginInterface -func RegisterPluginBuilder(name string, pc func(_interface.PluginClientset, []string) _interface.PluginInterface) { +// RegisterPluginBuilder register plugin builders +func RegisterPluginBuilder(name string, pc func(pluginsinterface.PluginClientset, []string) pluginsinterface.PluginInterface) { pluginMutex.Lock() defer pluginMutex.Unlock() pluginBuilders[name] = pc } +// GetPluginBuilder returns plugin builder for a given plugin name func GetPluginBuilder(name string) (PluginBuilder, bool) { pluginMutex.Lock() defer pluginMutex.Unlock() diff --git a/pkg/controllers/job/plugins/interface/interface.go b/pkg/controllers/job/plugins/interface/interface.go index 8481e70327..8cbef8eb9c 100644 --- a/pkg/controllers/job/plugins/interface/interface.go +++ b/pkg/controllers/job/plugins/interface/interface.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package _interface +package pluginsinterface import ( "k8s.io/api/core/v1" @@ -23,10 +23,12 @@ import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" ) +// PluginClientset clientset type PluginClientset struct { KubeClients kubernetes.Interface } +// PluginInterface interface type PluginInterface interface { // The unique name of Plugin. Name() string diff --git a/pkg/controllers/job/plugins/ssh/ssh.go b/pkg/controllers/job/plugins/ssh/ssh.go index dd3775c4d1..a628762779 100644 --- a/pkg/controllers/job/plugins/ssh/ssh.go +++ b/pkg/controllers/job/plugins/ssh/ssh.go @@ -47,6 +47,7 @@ type sshPlugin struct { noRoot bool } +// New creates ssh plugin func New(client vkinterface.PluginClientset, arguments []string) vkinterface.PluginInterface { sshPlugin := sshPlugin{pluginArguments: arguments, Clientset: client} diff --git a/pkg/controllers/job/plugins/ssh/types.go b/pkg/controllers/job/plugins/ssh/types.go index 2fc2a508b4..50e69cdd9f 100644 --- a/pkg/controllers/job/plugins/ssh/types.go +++ b/pkg/controllers/job/plugins/ssh/types.go @@ -17,11 +17,21 @@ limitations under the License. package ssh const ( - SSHPrivateKey = "id_rsa" - SSHPublicKey = "id_rsa.pub" + // SSHPrivateKey private key + SSHPrivateKey = "id_rsa" + + // SSHPublicKey public key + SSHPublicKey = "id_rsa.pub" + + // SSHAuthorizedKeys authkey SSHAuthorizedKeys = "authorized_keys" - SSHConfig = "config" + // SSHConfig ssh conf + SSHConfig = "config" + + // SSHAbsolutePath ssh abs path SSHAbsolutePath = "/root/.ssh" + + // SSHRelativePath ssh rel path SSHRelativePath = ".ssh" ) diff --git a/pkg/controllers/job/plugins/svc/svc.go b/pkg/controllers/job/plugins/svc/svc.go index 2bbcbcebb0..7856e1b0dd 100644 --- a/pkg/controllers/job/plugins/svc/svc.go +++ b/pkg/controllers/job/plugins/svc/svc.go @@ -40,6 +40,7 @@ type servicePlugin struct { Clientset vkinterface.PluginClientset } +// New creates service plugin func New(client vkinterface.PluginClientset, arguments []string) vkinterface.PluginInterface { servicePlugin := servicePlugin{pluginArguments: arguments, Clientset: client} @@ -156,11 +157,11 @@ func (sp *servicePlugin) createServiceIfNotExist(job *vkv1.Job) error { } if _, e := sp.Clientset.KubeClients.CoreV1().Services(job.Namespace).Create(svc); e != nil { - glog.V(3).Infof("Failed to create Service for Job <%s/%s>: %v", job.Namespace, job.Name, err) + glog.V(3).Infof("Failed to create Service for Job <%s/%s>: %v", job.Namespace, job.Name, e) return e - } else { - job.Status.ControlledResources["plugin-"+sp.Name()] = sp.Name() } + job.Status.ControlledResources["plugin-"+sp.Name()] = sp.Name() + } return nil diff --git a/pkg/controllers/job/plugins/svc/types.go b/pkg/controllers/job/plugins/svc/types.go index 0f91bb52a1..526500468a 100644 --- a/pkg/controllers/job/plugins/svc/types.go +++ b/pkg/controllers/job/plugins/svc/types.go @@ -17,7 +17,9 @@ limitations under the License. package svc const ( + // ConfigMapTaskHostFmt key in config map ConfigMapTaskHostFmt = "%s.host" + // ConfigMapMountPath mount path ConfigMapMountPath = "/etc/volcano" )