diff --git a/apis/fluentbit/v1alpha2/fluentbit_types.go b/apis/fluentbit/v1alpha2/fluentbit_types.go index 9f0991347..b57ebf208 100644 --- a/apis/fluentbit/v1alpha2/fluentbit_types.go +++ b/apis/fluentbit/v1alpha2/fluentbit_types.go @@ -96,6 +96,8 @@ type FluentBitSpec struct { MetricsPort int32 `json:"metricsPort,omitempty"` // Service represents configurations on the fluent-bit service. Service FluentBitService `json:"service,omitempty"` + // SchedulerName represents the desired scheduler for fluent-bit pods. + SchedulerName string `json:"schedulerName,omitempty"` } // FluentBitService defines the service of the FluentBit diff --git a/apis/fluentd/v1alpha1/fluentd_types.go b/apis/fluentd/v1alpha1/fluentd_types.go index 91595bf0e..9d47d0fd5 100644 --- a/apis/fluentd/v1alpha1/fluentd_types.go +++ b/apis/fluentd/v1alpha1/fluentd_types.go @@ -93,6 +93,8 @@ type FluentdSpec struct { Service FluentDService `json:"service,omitempty"` // PodSecurityContext represents the security context for the fluentd pods. SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"` + // SchedulerName represents the desired scheduler for fluentd pods. + SchedulerName string `json:"schedulerName,omitempty"` } // FluentDService the service of the FluentD diff --git a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_fluentbits.yaml b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_fluentbits.yaml index 70e5e6da9..3d0a8685e 100644 --- a/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_fluentbits.yaml +++ b/charts/fluent-operator/charts/fluent-bit-crds/crds/fluentbit.fluent.io_fluentbits.yaml @@ -4302,6 +4302,10 @@ spec: runtimeClassName: description: RuntimeClassName represents the container runtime configuration. type: string + schedulerName: + description: SchedulerName represents the desired scheduler for fluent-bit + pods. + type: string secrets: description: The Secrets are mounted into /fluent-bit/secrets/. items: diff --git a/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_fluentds.yaml b/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_fluentds.yaml index 5b18c1e28..83431e3ad 100644 --- a/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_fluentds.yaml +++ b/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_fluentds.yaml @@ -2264,6 +2264,10 @@ spec: runtimeClassName: description: RuntimeClassName represents the container runtime configuration. type: string + schedulerName: + description: SchedulerName represents the desired scheduler for fluentd + pods. + type: string securityContext: description: PodSecurityContext represents the security context for the fluentd pods. diff --git a/charts/fluent-operator/templates/fluentbit-fluentBit.yaml b/charts/fluent-operator/templates/fluentbit-fluentBit.yaml index b538a90a0..b25c292d6 100644 --- a/charts/fluent-operator/templates/fluentbit-fluentBit.yaml +++ b/charts/fluent-operator/templates/fluentbit-fluentBit.yaml @@ -40,6 +40,9 @@ spec: {{- with .Values.fluentbit.affinity }} affinity: {{ toYaml . | indent 4 }} + {{- end }} + {{- if .Values.fluentbit.schedulerName }} + schedulerName: {{ .Values.fluentbit.schedulerName }} {{- end }} {{- if .Values.fluentbit.secrets }} secrets: diff --git a/charts/fluent-operator/templates/fluentd-fluentd.yaml b/charts/fluent-operator/templates/fluentd-fluentd.yaml index 89cb02c39..5f5199cb1 100644 --- a/charts/fluent-operator/templates/fluentd-fluentd.yaml +++ b/charts/fluent-operator/templates/fluentd-fluentd.yaml @@ -18,6 +18,9 @@ spec: fluentdCfgSelector: matchLabels: config.fluentd.fluent.io/enabled: "true" + {{- if .Values.fluentd.schedulerName }} + schedulerName: {{ .Values.fluentd.schedulerName }} + {{- end }} {{- if .Values.fluentd.logLevel }} logLevel: {{ .Values.fluentd.logLevel }} {{- end }} diff --git a/charts/fluent-operator/values.yaml b/charts/fluent-operator/values.yaml index 413aef671..2afeee159 100644 --- a/charts/fluent-operator/values.yaml +++ b/charts/fluent-operator/values.yaml @@ -110,6 +110,7 @@ fluentbit: envVars: [] # - name: FOO # value: "bar" + schedulerName: "" # Remove the above empty volumes and volumesMounts, and then set additionalVolumes and additionalVolumesMounts as below if you want to collect node exporter metrics # additionalVolumes: @@ -240,6 +241,7 @@ fluentd: requests: cpu: 100m memory: 128Mi + schedulerName: "" logLevel: "" # Configure the output plugin parameter in Fluentd. # Fluentd is disabled by default, if you enable it make sure to also set up an output to use. diff --git a/config/crd/bases/fluentbit.fluent.io_fluentbits.yaml b/config/crd/bases/fluentbit.fluent.io_fluentbits.yaml index 70e5e6da9..3d0a8685e 100644 --- a/config/crd/bases/fluentbit.fluent.io_fluentbits.yaml +++ b/config/crd/bases/fluentbit.fluent.io_fluentbits.yaml @@ -4302,6 +4302,10 @@ spec: runtimeClassName: description: RuntimeClassName represents the container runtime configuration. type: string + schedulerName: + description: SchedulerName represents the desired scheduler for fluent-bit + pods. + type: string secrets: description: The Secrets are mounted into /fluent-bit/secrets/. items: diff --git a/config/crd/bases/fluentd.fluent.io_fluentds.yaml b/config/crd/bases/fluentd.fluent.io_fluentds.yaml index 5b18c1e28..83431e3ad 100644 --- a/config/crd/bases/fluentd.fluent.io_fluentds.yaml +++ b/config/crd/bases/fluentd.fluent.io_fluentds.yaml @@ -2264,6 +2264,10 @@ spec: runtimeClassName: description: RuntimeClassName represents the container runtime configuration. type: string + schedulerName: + description: SchedulerName represents the desired scheduler for fluentd + pods. + type: string securityContext: description: PodSecurityContext represents the security context for the fluentd pods. diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index 9b60b1ebb..d8d28c94e 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -15537,6 +15537,10 @@ spec: runtimeClassName: description: RuntimeClassName represents the container runtime configuration. type: string + schedulerName: + description: SchedulerName represents the desired scheduler for fluent-bit + pods. + type: string secrets: description: The Secrets are mounted into /fluent-bit/secrets/. items: @@ -19925,6 +19929,10 @@ spec: runtimeClassName: description: RuntimeClassName represents the container runtime configuration. type: string + schedulerName: + description: SchedulerName represents the desired scheduler for fluentd + pods. + type: string securityContext: description: PodSecurityContext represents the security context for the fluentd pods. diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 49f2f8639..c067f0922 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -15537,6 +15537,10 @@ spec: runtimeClassName: description: RuntimeClassName represents the container runtime configuration. type: string + schedulerName: + description: SchedulerName represents the desired scheduler for fluent-bit + pods. + type: string secrets: description: The Secrets are mounted into /fluent-bit/secrets/. items: @@ -19925,6 +19929,10 @@ spec: runtimeClassName: description: RuntimeClassName represents the container runtime configuration. type: string + schedulerName: + description: SchedulerName represents the desired scheduler for fluentd + pods. + type: string securityContext: description: PodSecurityContext represents the security context for the fluentd pods. diff --git a/pkg/operator/daemonset.go b/pkg/operator/daemonset.go index 645dc6dcd..a3e9c002e 100644 --- a/pkg/operator/daemonset.go +++ b/pkg/operator/daemonset.go @@ -176,6 +176,10 @@ func MakeDaemonSet(fb fluentbitv1alpha2.FluentBit, logPath string) *appsv1.Daemo ds.Spec.Template.Spec.PriorityClassName = fb.Spec.PriorityClassName } + if fb.Spec.SchedulerName != "" { + ds.Spec.Template.Spec.SchedulerName = fb.Spec.SchedulerName + } + if fb.Spec.Volumes != nil { ds.Spec.Template.Spec.Volumes = append(ds.Spec.Template.Spec.Volumes, fb.Spec.Volumes...) } diff --git a/pkg/operator/sts.go b/pkg/operator/sts.go index 59c7e044b..6b8b00342 100644 --- a/pkg/operator/sts.go +++ b/pkg/operator/sts.go @@ -149,6 +149,10 @@ func MakeStatefulset(fd fluentdv1alpha1.Fluentd) *appsv1.StatefulSet { sts.Spec.Template.Spec.SecurityContext = fd.Spec.SecurityContext } + if fd.Spec.SchedulerName != "" { + sts.Spec.Template.Spec.SchedulerName = fd.Spec.SchedulerName + } + // Mount host or emptydir VolumeSource if fd.Spec.BufferVolume != nil && !fd.Spec.BufferVolume.DisableBufferVolume { bufferVolName := fmt.Sprintf("%s-buffer", fd.Name)