Skip to content

Commit

Permalink
feat: match pod dnspolicy to hostNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
gai6948 committed Feb 6, 2022
1 parent e8d6f8b commit 450766b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/collector/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ func DaemonSet(cfg config.Config, logger logr.Logger, otelcol v1alpha1.OpenTelem

annotations := Annotations(otelcol)
podAnnotations := PodAnnotations(otelcol)

dnsPolicy := corev1.DNSClusterFirst
if otelcol.Spec.HostNetwork {
dnsPolicy = corev1.DNSClusterFirstWithHostNet
}
return appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Name: naming.Collector(otelcol),
Expand All @@ -55,6 +58,7 @@ func DaemonSet(cfg config.Config, logger logr.Logger, otelcol v1alpha1.OpenTelem
Volumes: Volumes(cfg, otelcol),
Tolerations: otelcol.Spec.Tolerations,
HostNetwork: otelcol.Spec.HostNetwork,
DNSPolicy: dnsPolicy,
SecurityContext: otelcol.Spec.PodSecurityContext,
},
},
Expand Down

0 comments on commit 450766b

Please sign in to comment.