Skip to content

Added support for deploying multiple fluentbit collector replicas #1561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apis/fluentbit/v1alpha2/collector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ type CollectorSpec struct {
Service CollectorService `json:"service,omitempty"`
// SchedulerName represents the desired scheduler for the Fluentbit collector pods
SchedulerName string `json:"schedulerName,omitempty"`
// Replicas is the number of collector replicas to deploy
Replicas *int32 `json:"replicas,omitempty"`
}

// CollectorService defines the service of the FluentBit
Expand Down
5 changes: 5 additions & 0 deletions apis/fluentbit/v1alpha2/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 @@ -1528,6 +1528,10 @@ spec:
- verbs
type: object
type: array
replicas:
description: Replicas is the number of collector replicas to deploy
format: int32
type: integer
resources:
description: Compute Resources required by container.
properties:
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/fluentbit.fluent.io_collectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,10 @@ spec:
- verbs
type: object
type: array
replicas:
description: Replicas is the number of collector replicas to deploy
format: int32
type: integer
resources:
description: Compute Resources required by container.
properties:
Expand Down
1 change: 1 addition & 0 deletions docs/fluentbit.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ CollectorSpec defines the desired state of FluentBit
| ports | Ports represents the pod's ports. | [][corev1.ContainerPort](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#containerport-v1-core) |
| service | Service represents configurations on the fluent-bit service. | [CollectorService](#collectorservice) |
| schedulerName | SchedulerName represents the desired scheduler for the Fluentbit collector pods | string |
| replicas | Replicas is the number of collector replicas to deploy | *int32 |

[Back to TOC](#table-of-contents)
# Decorder
Expand Down
4 changes: 4 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12557,6 +12557,10 @@ spec:
- verbs
type: object
type: array
replicas:
description: Replicas is the number of collector replicas to deploy
format: int32
type: integer
resources:
description: Compute Resources required by container.
properties:
Expand Down
4 changes: 4 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12557,6 +12557,10 @@ spec:
- verbs
type: object
type: array
replicas:
description: Replicas is the number of collector replicas to deploy
format: int32
type: integer
resources:
description: Compute Resources required by container.
properties:
Expand Down
6 changes: 6 additions & 0 deletions pkg/operator/collector-statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ var (
)

func MakefbStatefulset(co fluentbitv1alpha2.Collector) *appsv1.StatefulSet {
replicas := int32(1)
if co.Spec.Replicas != nil {
replicas = *co.Spec.Replicas
}

statefulset := appsv1.StatefulSet{
ObjectMeta: metav1.ObjectMeta{
Name: co.Name,
Namespace: co.Namespace,
Labels: co.Labels,
},
Spec: appsv1.StatefulSetSpec{
Replicas: &replicas,
Selector: &metav1.LabelSelector{
MatchLabels: co.Labels,
},
Expand Down
Loading