Skip to content

Commit c9150cd

Browse files
authored
feat: add HostAliases support to Fluent Bit and Fluentd specifications (fluent#1413)
* feat: add HostAliases support to Fluent Bit and Fluentd specifications Signed-off-by: Tomáš Novák <[email protected]> * feat: autogenerate HostAliases documentation and structure in CRDs Signed-off-by: Tomáš Novák <[email protected]> * feat: add DeepCopy support for HostAliases in Fluent Bit and Fluentd specifications Signed-off-by: Tomáš Novák <[email protected]> --------- Signed-off-by: Tomáš Novák <[email protected]>
1 parent e2f6c80 commit c9150cd

23 files changed

+191
-10
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/fluentbit/v1alpha2/plugins/custom/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentbit/v1alpha2/plugins/filter/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentbit/v1alpha2/plugins/multilineparser/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentbit/v1alpha2/plugins/parser/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentbit/v1alpha2/plugins/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentbit/v1alpha2/zz_generated.deepcopy.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

apis/fluentd/v1alpha1/plugins/common/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/fluentd/v1alpha1/zz_generated.deepcopy.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,27 @@ spec:
13101310
fluentBitConfigName:
13111311
description: Fluentbitconfig object associated with this Fluentbit
13121312
type: string
1313+
hostAliases:
1314+
description: HostAliases is an optional list of IPs and hostnames
1315+
that will be injected into the pod's hosts file if specified.
1316+
items:
1317+
description: |-
1318+
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
1319+
pod's hosts file.
1320+
properties:
1321+
hostnames:
1322+
description: Hostnames for the above IP address.
1323+
items:
1324+
type: string
1325+
type: array
1326+
x-kubernetes-list-type: atomic
1327+
ip:
1328+
description: IP address of the host file entry.
1329+
type: string
1330+
required:
1331+
- ip
1332+
type: object
1333+
type: array
13131334
hostNetwork:
13141335
description: Host networking is requested for this pod. Use the host's
13151336
network namespace. If this option is set, the ports that will be

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,6 +2813,27 @@ spec:
28132813
type: object
28142814
type: object
28152815
type: array
2816+
hostAliases:
2817+
description: HostAliases is an optional list of IPs and hostnames
2818+
that will be injected into the pod's hosts file if specified.
2819+
items:
2820+
description: |-
2821+
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
2822+
pod's hosts file.
2823+
properties:
2824+
hostnames:
2825+
description: Hostnames for the above IP address.
2826+
items:
2827+
type: string
2828+
type: array
2829+
x-kubernetes-list-type: atomic
2830+
ip:
2831+
description: IP address of the host file entry.
2832+
type: string
2833+
required:
2834+
- ip
2835+
type: object
2836+
type: array
28162837
image:
28172838
description: Fluentd image.
28182839
type: string

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,27 @@ spec:
13101310
fluentBitConfigName:
13111311
description: Fluentbitconfig object associated with this Fluentbit
13121312
type: string
1313+
hostAliases:
1314+
description: HostAliases is an optional list of IPs and hostnames
1315+
that will be injected into the pod's hosts file if specified.
1316+
items:
1317+
description: |-
1318+
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
1319+
pod's hosts file.
1320+
properties:
1321+
hostnames:
1322+
description: Hostnames for the above IP address.
1323+
items:
1324+
type: string
1325+
type: array
1326+
x-kubernetes-list-type: atomic
1327+
ip:
1328+
description: IP address of the host file entry.
1329+
type: string
1330+
required:
1331+
- ip
1332+
type: object
1333+
type: array
13131334
hostNetwork:
13141335
description: Host networking is requested for this pod. Use the host's
13151336
network namespace. If this option is set, the ports that will be

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,6 +2813,27 @@ spec:
28132813
type: object
28142814
type: object
28152815
type: array
2816+
hostAliases:
2817+
description: HostAliases is an optional list of IPs and hostnames
2818+
that will be injected into the pod's hosts file if specified.
2819+
items:
2820+
description: |-
2821+
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
2822+
pod's hosts file.
2823+
properties:
2824+
hostnames:
2825+
description: Hostnames for the above IP address.
2826+
items:
2827+
type: string
2828+
type: array
2829+
x-kubernetes-list-type: atomic
2830+
ip:
2831+
description: IP address of the host file entry.
2832+
type: string
2833+
required:
2834+
- ip
2835+
type: object
2836+
type: array
28162837
image:
28172838
description: Fluentd image.
28182839
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

manifests/setup/fluent-operator-crd.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17892,6 +17892,27 @@ spec:
1789217892
fluentBitConfigName:
1789317893
description: Fluentbitconfig object associated with this Fluentbit
1789417894
type: string
17895+
hostAliases:
17896+
description: HostAliases is an optional list of IPs and hostnames
17897+
that will be injected into the pod's hosts file if specified.
17898+
items:
17899+
description: |-
17900+
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
17901+
pod's hosts file.
17902+
properties:
17903+
hostnames:
17904+
description: Hostnames for the above IP address.
17905+
items:
17906+
type: string
17907+
type: array
17908+
x-kubernetes-list-type: atomic
17909+
ip:
17910+
description: IP address of the host file entry.
17911+
type: string
17912+
required:
17913+
- ip
17914+
type: object
17915+
type: array
1789517916
hostNetwork:
1789617917
description: Host networking is requested for this pod. Use the host's
1789717918
network namespace. If this option is set, the ports that will be
@@ -26937,6 +26958,27 @@ spec:
2693726958
type: object
2693826959
type: object
2693926960
type: array
26961+
hostAliases:
26962+
description: HostAliases is an optional list of IPs and hostnames
26963+
that will be injected into the pod's hosts file if specified.
26964+
items:
26965+
description: |-
26966+
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
26967+
pod's hosts file.
26968+
properties:
26969+
hostnames:
26970+
description: Hostnames for the above IP address.
26971+
items:
26972+
type: string
26973+
type: array
26974+
x-kubernetes-list-type: atomic
26975+
ip:
26976+
description: IP address of the host file entry.
26977+
type: string
26978+
required:
26979+
- ip
26980+
type: object
26981+
type: array
2694026982
image:
2694126983
description: Fluentd image.
2694226984
type: string

manifests/setup/setup.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17892,6 +17892,27 @@ spec:
1789217892
fluentBitConfigName:
1789317893
description: Fluentbitconfig object associated with this Fluentbit
1789417894
type: string
17895+
hostAliases:
17896+
description: HostAliases is an optional list of IPs and hostnames
17897+
that will be injected into the pod's hosts file if specified.
17898+
items:
17899+
description: |-
17900+
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
17901+
pod's hosts file.
17902+
properties:
17903+
hostnames:
17904+
description: Hostnames for the above IP address.
17905+
items:
17906+
type: string
17907+
type: array
17908+
x-kubernetes-list-type: atomic
17909+
ip:
17910+
description: IP address of the host file entry.
17911+
type: string
17912+
required:
17913+
- ip
17914+
type: object
17915+
type: array
1789517916
hostNetwork:
1789617917
description: Host networking is requested for this pod. Use the host's
1789717918
network namespace. If this option is set, the ports that will be
@@ -26937,6 +26958,27 @@ spec:
2693726958
type: object
2693826959
type: object
2693926960
type: array
26961+
hostAliases:
26962+
description: HostAliases is an optional list of IPs and hostnames
26963+
that will be injected into the pod's hosts file if specified.
26964+
items:
26965+
description: |-
26966+
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
26967+
pod's hosts file.
26968+
properties:
26969+
hostnames:
26970+
description: Hostnames for the above IP address.
26971+
items:
26972+
type: string
26973+
type: array
26974+
x-kubernetes-list-type: atomic
26975+
ip:
26976+
description: IP address of the host file entry.
26977+
type: string
26978+
required:
26979+
- ip
26980+
type: object
26981+
type: array
2694026982
image:
2694126983
description: Fluentd image.
2694226984
type: string

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
},

pkg/operator/sts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func MakeStatefulSet(fd fluentdv1alpha1.Fluentd) *appsv1.StatefulSet {
112112
LivenessProbe: fd.Spec.LivenessProbe,
113113
},
114114
},
115+
HostAliases: fd.Spec.HostAliases,
115116
NodeSelector: fd.Spec.NodeSelector,
116117
Tolerations: fd.Spec.Tolerations,
117118
Affinity: fd.Spec.Affinity,

0 commit comments

Comments
 (0)