Skip to content

Commit

Permalink
Merge pull request kubeedge#348 from JimmyYang20/fix-kb
Browse files Browse the repository at this point in the history
Fix bug: pods can not connect to kb in LL
  • Loading branch information
kubeedge-bot authored Aug 12, 2022
2 parents 9d27e67 + c74d18e commit 62fbd51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ func (c *Controller) createPod(job *sednav1.LifelongLearningJob, podtype sednav1
// set the default policy instead of Always policy
workerParam.RestartPolicy = v1.RestartPolicyOnFailure
workerParam.HostNetwork = true
workerParam.DNSPolicy = v1.DNSClusterFirstWithHostNet

// create pod based on podtype
_, err = runtime.CreatePodWithTemplate(c.kubeClient, job, podTemplate, workerParam)
Expand Down Expand Up @@ -745,6 +746,7 @@ func (c *Controller) createInferPod(job *sednav1.LifelongLearningJob) error {

workerParam.WorkerType = runtime.InferencePodType
workerParam.HostNetwork = true
workerParam.DNSPolicy = v1.DNSClusterFirstWithHostNet

// create edge pod
_, err = runtime.CreatePodWithTemplate(c.kubeClient, job, &job.Spec.DeploySpec.Template, workerParam)
Expand Down
6 changes: 6 additions & 0 deletions pkg/globalmanager/runtime/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type WorkerParam struct {
ModelHotUpdate ModelHotUpdate

RestartPolicy v1.RestartPolicy

DNSPolicy v1.DNSPolicy
}

type ModelHotUpdate struct {
Expand Down Expand Up @@ -163,6 +165,10 @@ func injectWorkerParam(pod *v1.Pod, workerParam *WorkerParam, object CommonInter
if pod.Spec.RestartPolicy == "" {
pod.Spec.RestartPolicy = workerParam.RestartPolicy
}

if workerParam.DNSPolicy != "" {
pod.Spec.DNSPolicy = workerParam.DNSPolicy
}
}

// CreatePodWithTemplate creates and returns a pod object given a crd object, pod template, and workerParam
Expand Down

0 comments on commit 62fbd51

Please sign in to comment.