-
Notifications
You must be signed in to change notification settings - Fork 984
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
Set DNSPolicy=ClusterFirstWithHostNet when hostnetwork set #779
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,14 @@ package job | |
|
||
import ( | ||
"fmt" | ||
"volcano.sh/volcano/pkg/apis/bus/v1alpha1" | ||
|
||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"k8s.io/klog" | ||
|
||
batch "volcano.sh/volcano/pkg/apis/batch/v1alpha1" | ||
"volcano.sh/volcano/pkg/apis/bus/v1alpha1" | ||
"volcano.sh/volcano/pkg/apis/helpers" | ||
schedulingv2 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1" | ||
"volcano.sh/volcano/pkg/controllers/apis" | ||
|
@@ -57,6 +57,10 @@ func createJobPod(job *batch.Job, template *v1.PodTemplateSpec, ix int) *v1.Pod | |
if len(pod.Spec.SchedulerName) == 0 { | ||
pod.Spec.SchedulerName = job.Spec.SchedulerName | ||
} | ||
// If dns policy not set when hostNetwork=true, set it to `ClusterFirstWithHostNet` | ||
if pod.Spec.HostNetwork == true && pod.Spec.DNSPolicy == "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add this into admission controller? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, anyway makes sense to me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest the following syntax ?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, i must be drunk at that time |
||
pod.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet | ||
} | ||
|
||
volumeMap := make(map[string]string) | ||
for _, volume := range job.Spec.Volumes { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, admission controller.