Skip to content

Commit

Permalink
feat: add HostAliases support to Fluent Bit and Fluentd specifications (
Browse files Browse the repository at this point in the history
#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]>
  • Loading branch information
MioOgbeni authored Nov 26, 2024
1 parent e2f6c80 commit c9150cd
Show file tree
Hide file tree
Showing 23 changed files with 191 additions and 10 deletions.
2 changes: 2 additions & 0 deletions apis/fluentbit/v1alpha2/fluentbit_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ type FluentBitSpec struct {
SchedulerName string `json:"schedulerName,omitempty"`
// Optional duration in seconds the pod needs to terminate gracefully. Value must be non-negative integer.
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
// HostAliases is an optional list of IPs and hostnames that will be injected into the pod's hosts file if specified.
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
}

// FluentBitService defines the service of the FluentBit
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion apis/fluentbit/v1alpha2/plugins/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion apis/fluentbit/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions apis/fluentd/v1alpha1/fluentd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ type FluentdSpec struct {
LivenessProbe *corev1.Probe `json:"livenessProbe,omitempty"`
// ReadinessProbe represents the readiness probe for the fluentd container.
ReadinessProbe *corev1.Probe `json:"readinessProbe,omitempty"`
// HostAliases is an optional list of IPs and hostnames that will be injected into the pod's hosts file if specified.
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
}

// FluentDService the service of the FluentD
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion apis/fluentd/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,27 @@ spec:
fluentBitConfigName:
description: Fluentbitconfig object associated with this Fluentbit
type: string
hostAliases:
description: HostAliases is an optional list of IPs and hostnames
that will be injected into the pod's hosts file if specified.
items:
description: |-
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
hostNetwork:
description: Host networking is requested for this pod. Use the host's
network namespace. If this option is set, the ports that will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,27 @@ spec:
type: object
type: object
type: array
hostAliases:
description: HostAliases is an optional list of IPs and hostnames
that will be injected into the pod's hosts file if specified.
items:
description: |-
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
image:
description: Fluentd image.
type: string
Expand Down
21 changes: 21 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_fluentbits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,27 @@ spec:
fluentBitConfigName:
description: Fluentbitconfig object associated with this Fluentbit
type: string
hostAliases:
description: HostAliases is an optional list of IPs and hostnames
that will be injected into the pod's hosts file if specified.
items:
description: |-
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
hostNetwork:
description: Host networking is requested for this pod. Use the host's
network namespace. If this option is set, the ports that will be
Expand Down
21 changes: 21 additions & 0 deletions config/crd/bases/fluentd.fluent.io_fluentds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,27 @@ spec:
type: object
type: object
type: array
hostAliases:
description: HostAliases is an optional list of IPs and hostnames
that will be injected into the pod's hosts file if specified.
items:
description: |-
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
image:
description: Fluentd image.
type: string
Expand Down
1 change: 1 addition & 0 deletions docs/fluentbit.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ FluentBitSpec defines the desired state of FluentBit
| service | Service represents configurations on the fluent-bit service. | [FluentBitService](#fluentbitservice) |
| schedulerName | SchedulerName represents the desired scheduler for fluent-bit pods. | string |
| terminationGracePeriodSeconds | Optional duration in seconds the pod needs to terminate gracefully. Value must be non-negative integer. | *int64 |
| 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) |

[Back to TOC](#table-of-contents)
# InputSpec
Expand Down
1 change: 1 addition & 0 deletions docs/fluentd.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ FluentdSpec defines the desired state of Fluentd
| 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) |
| 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) |
| 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) |
| 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) |

[Back to TOC](#table-of-contents)
# FluentdStatus
Expand Down
42 changes: 42 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17892,6 +17892,27 @@ spec:
fluentBitConfigName:
description: Fluentbitconfig object associated with this Fluentbit
type: string
hostAliases:
description: HostAliases is an optional list of IPs and hostnames
that will be injected into the pod's hosts file if specified.
items:
description: |-
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
hostNetwork:
description: Host networking is requested for this pod. Use the host's
network namespace. If this option is set, the ports that will be
Expand Down Expand Up @@ -26937,6 +26958,27 @@ spec:
type: object
type: object
type: array
hostAliases:
description: HostAliases is an optional list of IPs and hostnames
that will be injected into the pod's hosts file if specified.
items:
description: |-
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
image:
description: Fluentd image.
type: string
Expand Down
42 changes: 42 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17892,6 +17892,27 @@ spec:
fluentBitConfigName:
description: Fluentbitconfig object associated with this Fluentbit
type: string
hostAliases:
description: HostAliases is an optional list of IPs and hostnames
that will be injected into the pod's hosts file if specified.
items:
description: |-
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
hostNetwork:
description: Host networking is requested for this pod. Use the host's
network namespace. If this option is set, the ports that will be
Expand Down Expand Up @@ -26937,6 +26958,27 @@ spec:
type: object
type: object
type: array
hostAliases:
description: HostAliases is an optional list of IPs and hostnames
that will be injected into the pod's hosts file if specified.
items:
description: |-
HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
pod's hosts file.
properties:
hostnames:
description: Hostnames for the above IP address.
items:
type: string
type: array
x-kubernetes-list-type: atomic
ip:
description: IP address of the host file entry.
type: string
required:
- ip
type: object
type: array
image:
description: Fluentd image.
type: string
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func MakeDaemonSet(fb fluentbitv1alpha2.FluentBit, logPath string) *appsv1.Daemo
SecurityContext: fb.Spec.SecurityContext,
HostNetwork: fb.Spec.HostNetwork,
TerminationGracePeriodSeconds: fb.Spec.TerminationGracePeriodSeconds,
HostAliases: fb.Spec.HostAliases,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/fluentd-daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func MakeFluentdDaemonSet(fd fluentdv1alpha1.Fluentd) *appsv1.DaemonSet {
NodeSelector: fd.Spec.NodeSelector,
Tolerations: fd.Spec.Tolerations,
Affinity: fd.Spec.Affinity,
HostAliases: fd.Spec.HostAliases,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/sts.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func MakeStatefulSet(fd fluentdv1alpha1.Fluentd) *appsv1.StatefulSet {
LivenessProbe: fd.Spec.LivenessProbe,
},
},
HostAliases: fd.Spec.HostAliases,
NodeSelector: fd.Spec.NodeSelector,
Tolerations: fd.Spec.Tolerations,
Affinity: fd.Spec.Affinity,
Expand Down

0 comments on commit c9150cd

Please sign in to comment.