Skip to content

Commit 30e77bf

Browse files
committed
feat: add HostAliases support to Fluent Bit and Fluentd specifications
Signed-off-by: Tomáš Novák <[email protected]>
1 parent e2f6c80 commit 30e77bf

File tree

11 files changed

+113
-0
lines changed

11 files changed

+113
-0
lines changed

apis/fluentbit/v1alpha2/fluentbit_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ type FluentBitSpec struct {
107107
SchedulerName string `json:"schedulerName,omitempty"`
108108
// Optional duration in seconds the pod needs to terminate gracefully. Value must be non-negative integer.
109109
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
110+
// HostAliases is an optional list of IPs and hostnames that will be injected into the pod's hosts file if specified.
111+
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
110112
}
111113

112114
// FluentBitService defines the service of the FluentBit

apis/fluentd/v1alpha1/fluentd_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ type FluentdSpec struct {
117117
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty"`
118118
// ReadinessProbe represents the readiness probe for the fluentd container.
119119
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty"`
120+
// HostAliases is an optional list of IPs and hostnames that will be injected into the pod's hosts file if specified.
121+
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
120122
}
121123

122124
// FluentDService the service of the FluentD

charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_fluentbits.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,32 @@ spec:
13151315
network namespace. If this option is set, the ports that will be
13161316
used must be specified. Default to false.
13171317
type: boolean
1318+
hostAliases:
1319+
description: HostAliases is an optional list of IPs and hostnames that will
1320+
be injected into the pod's hosts file if specified.
1321+
items:
1322+
description: HostAlias holds the mapping between IP and hostnames
1323+
properties:
1324+
ip:
1325+
description: IP address of the host file entry.
1326+
pattern: "^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$"
1327+
type: string
1328+
hostnames:
1329+
description: Hostnames for the above IP address.
1330+
items:
1331+
type: string
1332+
pattern: "^[a-zA-Z0-9.-]+$"
1333+
minItems: 1
1334+
type: array
1335+
x-kubernetes-list-type: atomic
1336+
type: object
1337+
required:
1338+
- ip
1339+
- hostnames
1340+
x-kubernetes-list-map-keys:
1341+
- ip
1342+
x-kubernetes-list-type: map
1343+
type: array
13181344
image:
13191345
description: Fluent Bit image.
13201346
type: string

charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_fluentds.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,6 +2813,32 @@ spec:
28132813
type: object
28142814
type: object
28152815
type: array
2816+
hostAliases:
2817+
description: HostAliases is an optional list of IPs and hostnames that will
2818+
be injected into the pod's hosts file if specified.
2819+
items:
2820+
description: HostAlias holds the mapping between IP and hostnames
2821+
properties:
2822+
ip:
2823+
description: IP address of the host file entry.
2824+
pattern: "^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$"
2825+
type: string
2826+
hostnames:
2827+
description: Hostnames for the above IP address.
2828+
items:
2829+
type: string
2830+
pattern: "^[a-zA-Z0-9.-]+$"
2831+
minItems: 1
2832+
type: array
2833+
x-kubernetes-list-type: atomic
2834+
type: object
2835+
required:
2836+
- ip
2837+
- hostnames
2838+
x-kubernetes-list-map-keys:
2839+
- ip
2840+
x-kubernetes-list-type: map
2841+
type: array
28162842
image:
28172843
description: Fluentd image.
28182844
type: string

config/crd/bases/fluentbit.fluent.io_fluentbits.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,32 @@ spec:
13151315
network namespace. If this option is set, the ports that will be
13161316
used must be specified. Default to false.
13171317
type: boolean
1318+
hostAliases:
1319+
description: HostAliases is an optional list of IPs and hostnames that will
1320+
be injected into the pod's hosts file if specified.
1321+
items:
1322+
description: HostAlias holds the mapping between IP and hostnames
1323+
properties:
1324+
ip:
1325+
description: IP address of the host file entry.
1326+
pattern: "^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$"
1327+
type: string
1328+
hostnames:
1329+
description: Hostnames for the above IP address.
1330+
items:
1331+
type: string
1332+
pattern: "^[a-zA-Z0-9.-]+$"
1333+
minItems: 1
1334+
type: array
1335+
x-kubernetes-list-type: atomic
1336+
type: object
1337+
required:
1338+
- ip
1339+
- hostnames
1340+
x-kubernetes-list-map-keys:
1341+
- ip
1342+
x-kubernetes-list-type: map
1343+
type: array
13181344
image:
13191345
description: Fluent Bit image.
13201346
type: string

config/crd/bases/fluentd.fluent.io_fluentds.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,6 +2813,32 @@ spec:
28132813
type: object
28142814
type: object
28152815
type: array
2816+
hostAliases:
2817+
description: HostAliases is an optional list of IPs and hostnames that will
2818+
be injected into the pod's hosts file if specified.
2819+
items:
2820+
description: HostAlias holds the mapping between IP and hostnames
2821+
properties:
2822+
ip:
2823+
description: IP address of the host file entry.
2824+
pattern: "^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$"
2825+
type: string
2826+
hostnames:
2827+
description: Hostnames for the above IP address.
2828+
items:
2829+
type: string
2830+
pattern: "^[a-zA-Z0-9.-]+$"
2831+
minItems: 1
2832+
type: array
2833+
x-kubernetes-list-type: atomic
2834+
type: object
2835+
required:
2836+
- ip
2837+
- hostnames
2838+
x-kubernetes-list-map-keys:
2839+
- ip
2840+
x-kubernetes-list-type: map
2841+
type: array
28162842
image:
28172843
description: Fluentd image.
28182844
type: string

docs/fluentbit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ FluentBitSpec defines the desired state of FluentBit
432432
| service | Service represents configurations on the fluent-bit service. | [FluentBitService](#fluentbitservice) |
433433
| schedulerName | SchedulerName represents the desired scheduler for fluent-bit pods. | string |
434434
| terminationGracePeriodSeconds | Optional duration in seconds the pod needs to terminate gracefully. Value must be non-negative integer. | *int64 |
435+
| hostAliases | HostAliases is an optional list of IPs and hostnames that will be injected into the pod's hosts file if specified. | [][corev1.HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#hostalias-v1-core) |
435436

436437
[Back to TOC](#table-of-contents)
437438
# InputSpec

docs/fluentd.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ FluentdSpec defines the desired state of Fluentd
362362
| positionDB | Storage for position db. You will use it if tail input is enabled. Applicable when the mode is \"agent\", and will be ignored when the mode is \"collector\" | [corev1.VolumeSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#volumesource-v1-core) |
363363
| livenessProbe | LivenessProbe represents the liveness probe for the fluentd container. | *[corev1.Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core) |
364364
| readinessProbe | ReadinessProbe represents the readiness probe for the fluentd container. | *[corev1.Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#probe-v1-core) |
365+
| hostAliases | HostAliases is an optional list of IPs and hostnames that will be injected into the pod's hosts file if specified. | [][corev1.HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#hostalias-v1-core) |
365366

366367
[Back to TOC](#table-of-contents)
367368
# FluentdStatus

pkg/operator/daemonset.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func MakeDaemonSet(fb fluentbitv1alpha2.FluentBit, logPath string) *appsv1.Daemo
9494
SecurityContext: fb.Spec.SecurityContext,
9595
HostNetwork: fb.Spec.HostNetwork,
9696
TerminationGracePeriodSeconds: fb.Spec.TerminationGracePeriodSeconds,
97+
HostAliases: fb.Spec.HostAliases,
9798
},
9899
},
99100
},

pkg/operator/fluentd-daemonset.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ func MakeFluentdDaemonSet(fd fluentdv1alpha1.Fluentd) *appsv1.DaemonSet {
114114
NodeSelector: fd.Spec.NodeSelector,
115115
Tolerations: fd.Spec.Tolerations,
116116
Affinity: fd.Spec.Affinity,
117+
HostAliases: fd.Spec.HostAliases,
117118
},
118119
},
119120
},

0 commit comments

Comments
 (0)