diff --git a/.chloggen/implement-dnsconfig.yaml b/.chloggen/implement-dnsconfig.yaml
new file mode 100755
index 0000000000..534238afb7
--- /dev/null
+++ b/.chloggen/implement-dnsconfig.yaml
@@ -0,0 +1,16 @@
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type: 'enhancement'
+
+# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
+component: collector, target allocator, opamp
+
+# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: Enabling PodDnsConfig for OpenTelemetry Collector, TargetAllocator and OpAMPBridge.
+
+# One or more tracking issues related to the change
+issues: [2658]
+
+# (Optional) One or more lines of additional information to render under the primary note.
+# These lines will be padded with 2 spaces and then inserted directly into the document.
+# Use pipe (|) for multiline entries.
+subtext:
\ No newline at end of file
diff --git a/apis/v1alpha1/opampbridge_types.go b/apis/v1alpha1/opampbridge_types.go
index 0479b10198..e8ee0e52e6 100644
--- a/apis/v1alpha1/opampbridge_types.go
+++ b/apis/v1alpha1/opampbridge_types.go
@@ -105,6 +105,8 @@ type OpAMPBridgeSpec struct {
// https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
// +optional
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
+ // PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.
+ PodDNSConfig v1.PodDNSConfig `json:"podDnsConfig,omitempty"`
}
// OpAMPBridgeStatus defines the observed state of OpAMPBridge.
diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go
index 3918521e75..086fafcfd2 100644
--- a/apis/v1alpha1/zz_generated.deepcopy.go
+++ b/apis/v1alpha1/zz_generated.deepcopy.go
@@ -680,6 +680,7 @@ func (in *OpAMPBridgeSpec) DeepCopyInto(out *OpAMPBridgeSpec) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
+ in.PodDNSConfig.DeepCopyInto(&out.PodDNSConfig)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpAMPBridgeSpec.
diff --git a/apis/v1beta1/common.go b/apis/v1beta1/common.go
index e91b0e6de7..374f5a2a82 100644
--- a/apis/v1beta1/common.go
+++ b/apis/v1beta1/common.go
@@ -224,6 +224,8 @@ type OpenTelemetryCommonFields struct {
//
// +optional
AdditionalContainers []v1.Container `json:"additionalContainers,omitempty"`
+ // PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.
+ PodDNSConfig v1.PodDNSConfig `json:"podDnsConfig,omitempty"`
}
type StatefulSetCommonFields struct {
diff --git a/apis/v1beta1/zz_generated.deepcopy.go b/apis/v1beta1/zz_generated.deepcopy.go
index e5fb8ef086..cff0c978e3 100644
--- a/apis/v1beta1/zz_generated.deepcopy.go
+++ b/apis/v1beta1/zz_generated.deepcopy.go
@@ -476,6 +476,7 @@ func (in *OpenTelemetryCommonFields) DeepCopyInto(out *OpenTelemetryCommonFields
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
+ in.PodDNSConfig.DeepCopyInto(&out.PodDNSConfig)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenTelemetryCommonFields.
diff --git a/bundle/manifests/opentelemetry.io_opampbridges.yaml b/bundle/manifests/opentelemetry.io_opampbridges.yaml
index b9fdbf81db..6e7a42fd34 100644
--- a/bundle/manifests/opentelemetry.io_opampbridges.yaml
+++ b/bundle/manifests/opentelemetry.io_opampbridges.yaml
@@ -600,6 +600,29 @@ spec:
additionalProperties:
type: string
type: object
+ podDnsConfig:
+ properties:
+ nameservers:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ options:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ type: object
+ type: array
+ x-kubernetes-list-type: atomic
+ searches:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ type: object
podSecurityContext:
properties:
appArmorProfile:
diff --git a/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml
index 8696e0ee60..af08b8e91c 100644
--- a/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml
+++ b/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml
@@ -6928,6 +6928,29 @@ spec:
- type: string
x-kubernetes-int-or-string: true
type: object
+ podDnsConfig:
+ properties:
+ nameservers:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ options:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ type: object
+ type: array
+ x-kubernetes-list-type: atomic
+ searches:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ type: object
podSecurityContext:
properties:
appArmorProfile:
diff --git a/config/crd/bases/opentelemetry.io_opampbridges.yaml b/config/crd/bases/opentelemetry.io_opampbridges.yaml
index c554b2b101..181f2f2d1c 100644
--- a/config/crd/bases/opentelemetry.io_opampbridges.yaml
+++ b/config/crd/bases/opentelemetry.io_opampbridges.yaml
@@ -597,6 +597,29 @@ spec:
additionalProperties:
type: string
type: object
+ podDnsConfig:
+ properties:
+ nameservers:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ options:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ type: object
+ type: array
+ x-kubernetes-list-type: atomic
+ searches:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ type: object
podSecurityContext:
properties:
appArmorProfile:
diff --git a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml
index ac1c099f14..445cc211e5 100644
--- a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml
+++ b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml
@@ -6914,6 +6914,29 @@ spec:
- type: string
x-kubernetes-int-or-string: true
type: object
+ podDnsConfig:
+ properties:
+ nameservers:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ options:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ type: object
+ type: array
+ x-kubernetes-list-type: atomic
+ searches:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ type: object
podSecurityContext:
properties:
appArmorProfile:
diff --git a/config/crd/bases/opentelemetry.io_targetallocators.yaml b/config/crd/bases/opentelemetry.io_targetallocators.yaml
index b25aa1a1fc..27e6c74678 100644
--- a/config/crd/bases/opentelemetry.io_targetallocators.yaml
+++ b/config/crd/bases/opentelemetry.io_targetallocators.yaml
@@ -2089,6 +2089,29 @@ spec:
- type: string
x-kubernetes-int-or-string: true
type: object
+ podDnsConfig:
+ properties:
+ nameservers:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ options:
+ items:
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ type: object
+ type: array
+ x-kubernetes-list-type: atomic
+ searches:
+ items:
+ type: string
+ type: array
+ x-kubernetes-list-type: atomic
+ type: object
podSecurityContext:
properties:
appArmorProfile:
diff --git a/controllers/builder_test.go b/controllers/builder_test.go
index 8870910990..12304494bc 100644
--- a/controllers/builder_test.go
+++ b/controllers/builder_test.go
@@ -221,6 +221,7 @@ service:
},
ShareProcessNamespace: ptr.To(false),
DNSPolicy: "ClusterFirst",
+ DNSConfig: &corev1.PodDNSConfig{},
ServiceAccountName: "test-collector",
},
},
@@ -471,6 +472,7 @@ service:
},
ShareProcessNamespace: ptr.To(false),
DNSPolicy: "ClusterFirst",
+ DNSConfig: &corev1.PodDNSConfig{},
ServiceAccountName: "test-collector",
},
},
@@ -757,6 +759,7 @@ service:
},
ShareProcessNamespace: ptr.To(false),
DNSPolicy: "ClusterFirst",
+ DNSConfig: &corev1.PodDNSConfig{},
ServiceAccountName: "my-special-sa",
},
},
@@ -1005,6 +1008,7 @@ func TestBuildAll_OpAMPBridge(t *testing.T) {
},
},
DNSPolicy: "ClusterFirst",
+ DNSConfig: &corev1.PodDNSConfig{},
ServiceAccountName: "test-opamp-bridge",
},
},
@@ -1285,6 +1289,7 @@ service:
},
ShareProcessNamespace: ptr.To(false),
DNSPolicy: "ClusterFirst",
+ DNSConfig: &corev1.PodDNSConfig{},
ServiceAccountName: "test-collector",
},
},
@@ -1496,6 +1501,7 @@ prometheus_cr:
},
},
DNSPolicy: "ClusterFirst",
+ DNSConfig: &corev1.PodDNSConfig{},
ShareProcessNamespace: ptr.To(false),
ServiceAccountName: "test-targetallocator",
},
@@ -1679,6 +1685,7 @@ prometheus_cr:
},
ShareProcessNamespace: ptr.To(false),
DNSPolicy: "ClusterFirst",
+ DNSConfig: &corev1.PodDNSConfig{},
ServiceAccountName: "test-collector",
},
},
@@ -1890,6 +1897,7 @@ prometheus_cr:
},
},
DNSPolicy: "ClusterFirst",
+ DNSConfig: &corev1.PodDNSConfig{},
ShareProcessNamespace: ptr.To(false),
ServiceAccountName: "test-targetallocator",
},
diff --git a/docs/api.md b/docs/api.md
index 462ecb519b..ab8e1a0b02 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -4198,6 +4198,13 @@ typically used to set access tokens or other authorization headers.
OpAMPBridge pods.
Name | +Type | +Description | +Required | +
---|---|---|---|
nameservers | +[]string | +
+ A list of DNS name server IP addresses.
+This will be appended to the base nameservers generated from DNSPolicy.
+Duplicated nameservers will be removed. + |
+ false | +
options | +[]object | +
+ A list of DNS resolver options.
+This will be merged with the base options generated from DNSPolicy.
+Duplicated entries will be removed. Resolution options given in Options
+will override those that appear in the base DNSPolicy. + |
+ false | +
searches | +[]string | +
+ A list of DNS search domains for host-name lookup.
+This will be appended to the base search paths generated from DNSPolicy.
+Duplicated search paths will be removed. + |
+ false | +
Name | +Type | +Description | +Required | +
---|---|---|---|
name | +string | +
+ Required. + |
+ false | +
value | +string | +
+ + |
+ false | +
Name | +Type | +Description | +Required | +
---|---|---|---|
nameservers | +[]string | +
+ A list of DNS name server IP addresses.
+This will be appended to the base nameservers generated from DNSPolicy.
+Duplicated nameservers will be removed. + |
+ false | +
options | +[]object | +
+ A list of DNS resolver options.
+This will be merged with the base options generated from DNSPolicy.
+Duplicated entries will be removed. Resolution options given in Options
+will override those that appear in the base DNSPolicy. + |
+ false | +
searches | +[]string | +
+ A list of DNS search domains for host-name lookup.
+This will be appended to the base search paths generated from DNSPolicy.
+Duplicated search paths will be removed. + |
+ false | +
Name | +Type | +Description | +Required | +
---|---|---|---|
name | +string | +
+ Required. + |
+ false | +
value | +string | +
+ + |
+ false | +