Commit 97d1355
feat(collector): add hostAliases support to OpenTelemetryCollector and TargetAllocator (#4902)
* feat(collector): add hostAliases support to OpenTelemetryCollector and TargetAllocator
Adds the `hostAliases` field to `OpenTelemetryCommonFields`, which is
embedded by both `OpenTelemetryCollectorSpec` (via `OpenTelemetryCollectorSpec`)
and `TargetAllocatorSpec` (v1alpha1). This allows operators to inject custom
entries into a collector pod's `/etc/hosts` file, which is useful when DNS
resolution for specific hostnames must be overridden within a cluster.
The field maps directly to `corev1.HostAlias` (Kubernetes `hostAliases` on
PodSpec) and is propagated in the Deployment, DaemonSet, and StatefulSet
manifests for the collector, as well as the TargetAllocator Deployment.
The `DeepCopyInto` method in `zz_generated.deepcopy.go` is updated to
include a proper slice deep copy for the new field.
Example usage:
```yaml
spec:
hostAliases:
- ip: "10.0.0.1"
hostnames:
- "internal.registry.local"
```
Closes #986
Signed-off-by: Sakthi Harish <sakthi.harish@edgeverve.com>
* chore: add hostAliases to collector CRD schema
Signed-off-by: Retr0-XD <sakthi.harish@edgeverve.com>
* chore: add hostAliases to targetallocator CRD schema
Signed-off-by: Retr0-XD <sakthi.harish@edgeverve.com>
* test: add TestDeploymentHostAliases for collector deployment
Signed-off-by: Retr0-XD <sakthi.harish@edgeverve.com>
* test: add TestDaemonsetHostAliases for collector daemonset
Signed-off-by: Retr0-XD <sakthi.harish@edgeverve.com>
* test: add TestStatefulSetHostAliases for collector statefulset
Signed-off-by: Retr0-XD <sakthi.harish@edgeverve.com>
* test: add TestDeploymentHostAliases for targetallocator deployment
Signed-off-by: Retr0-XD <sakthi.harish@edgeverve.com>
* Enhance support for hostAliases in pods
Added support for hostAliases in OpenTelemetryCollector and TargetAllocator pods.
* Fix formatting of HostAliases assignment
* Fix formatting of HostAliases assignment
* Add x-kubernetes-list-type to hostnames field
* Add x-kubernetes-list-type to collectors YAML
* Add x-kubernetes-list-type to targetallocators.yaml
* lint fixes
* supression for newMetrics
---------
Signed-off-by: Sakthi Harish <sakthi.harish@edgeverve.com>
Signed-off-by: Retr0-XD <sakthi.harish@edgeverve.com>
Co-authored-by: Mikołaj Świątek <mail+sumo@mikolajswiatek.com>1 parent 9f02b16 commit 97d1355
19 files changed
Lines changed: 347 additions & 0 deletions
File tree
- .chloggen
- apis/v1beta1
- bundle
- community/manifests
- openshift/manifests
- config/crd/bases
- docs/api
- internal/manifests
- collector
- targetallocator
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
247 | 252 | | |
248 | 253 | | |
249 | 254 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6303 | 6303 | | |
6304 | 6304 | | |
6305 | 6305 | | |
| 6306 | + | |
| 6307 | + | |
| 6308 | + | |
| 6309 | + | |
| 6310 | + | |
| 6311 | + | |
| 6312 | + | |
| 6313 | + | |
| 6314 | + | |
| 6315 | + | |
| 6316 | + | |
| 6317 | + | |
| 6318 | + | |
| 6319 | + | |
| 6320 | + | |
6306 | 6321 | | |
6307 | 6322 | | |
6308 | 6323 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1333 | 1333 | | |
1334 | 1334 | | |
1335 | 1335 | | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
1336 | 1351 | | |
1337 | 1352 | | |
1338 | 1353 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6302 | 6302 | | |
6303 | 6303 | | |
6304 | 6304 | | |
| 6305 | + | |
| 6306 | + | |
| 6307 | + | |
| 6308 | + | |
| 6309 | + | |
| 6310 | + | |
| 6311 | + | |
| 6312 | + | |
| 6313 | + | |
| 6314 | + | |
| 6315 | + | |
| 6316 | + | |
| 6317 | + | |
| 6318 | + | |
| 6319 | + | |
6305 | 6320 | | |
6306 | 6321 | | |
6307 | 6322 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1333 | 1333 | | |
1334 | 1334 | | |
1335 | 1335 | | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
1336 | 1351 | | |
1337 | 1352 | | |
1338 | 1353 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6289 | 6289 | | |
6290 | 6290 | | |
6291 | 6291 | | |
| 6292 | + | |
| 6293 | + | |
| 6294 | + | |
| 6295 | + | |
| 6296 | + | |
| 6297 | + | |
| 6298 | + | |
| 6299 | + | |
| 6300 | + | |
| 6301 | + | |
| 6302 | + | |
| 6303 | + | |
| 6304 | + | |
| 6305 | + | |
| 6306 | + | |
6292 | 6307 | | |
6293 | 6308 | | |
6294 | 6309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1331 | 1331 | | |
1332 | 1332 | | |
1333 | 1333 | | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
1334 | 1349 | | |
1335 | 1350 | | |
1336 | 1351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20243 | 20243 | | |
20244 | 20244 | | |
20245 | 20245 | | |
| 20246 | + | |
| 20247 | + | |
| 20248 | + | |
| 20249 | + | |
| 20250 | + | |
| 20251 | + | |
| 20252 | + | |
| 20253 | + | |
20246 | 20254 | | |
20247 | 20255 | | |
20248 | 20256 | | |
| |||
26716 | 26724 | | |
26717 | 26725 | | |
26718 | 26726 | | |
| 26727 | + | |
| 26728 | + | |
| 26729 | + | |
| 26730 | + | |
| 26731 | + | |
| 26732 | + | |
| 26733 | + | |
| 26734 | + | |
| 26735 | + | |
| 26736 | + | |
| 26737 | + | |
| 26738 | + | |
| 26739 | + | |
| 26740 | + | |
| 26741 | + | |
| 26742 | + | |
| 26743 | + | |
| 26744 | + | |
| 26745 | + | |
| 26746 | + | |
| 26747 | + | |
| 26748 | + | |
| 26749 | + | |
| 26750 | + | |
| 26751 | + | |
| 26752 | + | |
| 26753 | + | |
| 26754 | + | |
| 26755 | + | |
| 26756 | + | |
| 26757 | + | |
| 26758 | + | |
| 26759 | + | |
| 26760 | + | |
| 26761 | + | |
26719 | 26762 | | |
26720 | 26763 | | |
26721 | 26764 | | |
| |||
0 commit comments