diff --git a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go index 9be65078e..a2f2da697 100644 --- a/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/input/zz_generated.deepcopy.go @@ -492,6 +492,11 @@ func (in *Tail) DeepCopyInto(out *Tail) { *out = new(bool) **out = **in } + if in.Threaded != nil { + in, out := &in.Threaded, &out.Threaded + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tail. diff --git a/apis/fluentbit/v1alpha2/plugins/output/kafka_types.go b/apis/fluentbit/v1alpha2/plugins/output/kafka_types.go index f8c2b4c45..d350f06c8 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/kafka_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/kafka_types.go @@ -47,7 +47,7 @@ type Kafka struct { // Limit the maximum number of Chunks in the filesystem for the current output logical destination. TotalLimitSize string `json:"totalLimitSize,omitempty"` // Enables dedicated thread(s) for this output. Default value is set since version 1.8.13. For previous versions is 0. - Workers *int32 `json:"workers,omitempty"` + Workers *int32 `json:"workers,omitempty"` } func (*Kafka) Name() string { diff --git a/apis/fluentbit/v1alpha2/plugins/output/loki_types.go b/apis/fluentbit/v1alpha2/plugins/output/loki_types.go index cd069e9cb..3d7eef792 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/loki_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/loki_types.go @@ -62,7 +62,7 @@ type Loki struct { // Limit the maximum number of Chunks in the filesystem for the current output logical destination. TotalLimitSize string `json:"totalLimitSize,omitempty"` // Enables dedicated thread(s) for this output. Default value is set since version 1.8.13. For previous versions is 0. - Workers *int32 `json:"workers,omitempty"` + Workers *int32 `json:"workers,omitempty"` } // implement Section() method diff --git a/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go index bd36e928e..e7a97b3fe 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go @@ -536,6 +536,11 @@ func (in *Kafka) DeepCopyInto(out *Kafka) { *out = new(int64) **out = **in } + if in.Workers != nil { + in, out := &in.Workers, &out.Workers + *out = new(int32) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Kafka. @@ -621,6 +626,11 @@ func (in *Loki) DeepCopyInto(out *Loki) { *out = new(plugins.Networking) (*in).DeepCopyInto(*out) } + if in.Workers != nil { + in, out := &in.Workers, &out.Workers + *out = new(int32) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Loki. diff --git a/apis/fluentd/v1alpha1/fluentd_types.go b/apis/fluentd/v1alpha1/fluentd_types.go index 664ec5861..1f569404c 100644 --- a/apis/fluentd/v1alpha1/fluentd_types.go +++ b/apis/fluentd/v1alpha1/fluentd_types.go @@ -61,6 +61,8 @@ type FluentdSpec struct { Args []string `json:"args,omitempty"` // EnvVars represent environment variables that can be passed to fluentd pods. EnvVars []corev1.EnvVar `json:"envVars,omitempty"` + // EnvFrom represent environment variables that can be passed to fluentd pods directly from secret or configmap + EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"` // FluentdCfgSelector defines the selectors to select the fluentd config CRs. FluentdCfgSelector metav1.LabelSelector `json:"fluentdCfgSelector,omitempty"` // Buffer definition diff --git a/apis/fluentd/v1alpha1/zz_generated.deepcopy.go b/apis/fluentd/v1alpha1/zz_generated.deepcopy.go index 0e55f2cf3..57ccf0a6c 100644 --- a/apis/fluentd/v1alpha1/zz_generated.deepcopy.go +++ b/apis/fluentd/v1alpha1/zz_generated.deepcopy.go @@ -841,6 +841,13 @@ func (in *FluentdSpec) DeepCopyInto(out *FluentdSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.EnvFrom != nil { + in, out := &in.EnvFrom, &out.EnvFrom + *out = make([]corev1.EnvFromSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } in.FluentdCfgSelector.DeepCopyInto(&out.FluentdCfgSelector) if in.BufferVolume != nil { in, out := &in.BufferVolume, &out.BufferVolume 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 c188cedbc..4ef62ab98 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 @@ -1781,6 +1781,56 @@ spec: description: By default will build the related service according to the globalinputs definition. type: boolean + envFrom: + description: EnvFrom represent environment variables that can be passed + to fluentd pods directly from secret or configmap + items: + description: EnvFromSource represents the source of a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + TODO: Add other useful fields. apiVersion, kind, uid? + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key in + the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + TODO: Add other useful fields. apiVersion, kind, uid? + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array envVars: description: EnvVars represent environment variables that can be passed to fluentd pods. diff --git a/config/crd/bases/fluentd.fluent.io_fluentds.yaml b/config/crd/bases/fluentd.fluent.io_fluentds.yaml index c188cedbc..4ef62ab98 100644 --- a/config/crd/bases/fluentd.fluent.io_fluentds.yaml +++ b/config/crd/bases/fluentd.fluent.io_fluentds.yaml @@ -1781,6 +1781,56 @@ spec: description: By default will build the related service according to the globalinputs definition. type: boolean + envFrom: + description: EnvFrom represent environment variables that can be passed + to fluentd pods directly from secret or configmap + items: + description: EnvFromSource represents the source of a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + TODO: Add other useful fields. apiVersion, kind, uid? + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key in + the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + TODO: Add other useful fields. apiVersion, kind, uid? + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array envVars: description: EnvVars represent environment variables that can be passed to fluentd pods. diff --git a/manifests/setup/fluent-operator-crd.yaml b/manifests/setup/fluent-operator-crd.yaml index abc3f8d3c..142fb196d 100644 --- a/manifests/setup/fluent-operator-crd.yaml +++ b/manifests/setup/fluent-operator-crd.yaml @@ -25963,6 +25963,56 @@ spec: description: By default will build the related service according to the globalinputs definition. type: boolean + envFrom: + description: EnvFrom represent environment variables that can be passed + to fluentd pods directly from secret or configmap + items: + description: EnvFromSource represents the source of a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + TODO: Add other useful fields. apiVersion, kind, uid? + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key in + the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + TODO: Add other useful fields. apiVersion, kind, uid? + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array envVars: description: EnvVars represent environment variables that can be passed to fluentd pods. diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 2b85aa1e6..7c05db7f9 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -25963,6 +25963,56 @@ spec: description: By default will build the related service according to the globalinputs definition. type: boolean + envFrom: + description: EnvFrom represent environment variables that can be passed + to fluentd pods directly from secret or configmap + items: + description: EnvFromSource represents the source of a set of ConfigMaps + properties: + configMapRef: + description: The ConfigMap to select from + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + TODO: Add other useful fields. apiVersion, kind, uid? + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + type: string + optional: + description: Specify whether the ConfigMap must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + description: An optional identifier to prepend to each key in + the ConfigMap. Must be a C_IDENTIFIER. + type: string + secretRef: + description: The Secret to select from + properties: + name: + default: "" + description: |- + Name of the referent. + This field is effectively required, but due to backwards compatibility is + allowed to be empty. Instances of this type with an empty value here are + almost certainly wrong. + TODO: Add other useful fields. apiVersion, kind, uid? + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896. + type: string + optional: + description: Specify whether the Secret must be defined + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array envVars: description: EnvVars represent environment variables that can be passed to fluentd pods. diff --git a/pkg/operator/fluentd-daemonset.go b/pkg/operator/fluentd-daemonset.go index 52511e13c..ae267bf4b 100644 --- a/pkg/operator/fluentd-daemonset.go +++ b/pkg/operator/fluentd-daemonset.go @@ -140,6 +140,10 @@ func MakeFluentdDaemonSet(fd fluentdv1alpha1.Fluentd) *appsv1.DaemonSet { daemonSet.Spec.Template.Spec.Containers[0].Env = append(daemonSet.Spec.Template.Spec.Containers[0].Env, fd.Spec.EnvVars...) } + if fd.Spec.EnvFrom != nil { + daemonSet.Spec.Template.Spec.Containers[0].EnvFrom = append(daemonSet.Spec.Template.Spec.Containers[0].EnvFrom, fd.Spec.EnvFrom...) + } + if fd.Spec.SecurityContext != nil { daemonSet.Spec.Template.Spec.SecurityContext = fd.Spec.SecurityContext } diff --git a/pkg/operator/sts.go b/pkg/operator/sts.go index 6a3097c06..182ae0d3f 100644 --- a/pkg/operator/sts.go +++ b/pkg/operator/sts.go @@ -148,6 +148,10 @@ func MakeStatefulSet(fd fluentdv1alpha1.Fluentd) *appsv1.StatefulSet { sts.Spec.Template.Spec.Containers[0].Env = append(sts.Spec.Template.Spec.Containers[0].Env, fd.Spec.EnvVars...) } + if fd.Spec.EnvFrom != nil { + sts.Spec.Template.Spec.Containers[0].EnvFrom = append(sts.Spec.Template.Spec.Containers[0].EnvFrom, fd.Spec.EnvFrom...) + } + if fd.Spec.SecurityContext != nil { sts.Spec.Template.Spec.SecurityContext = fd.Spec.SecurityContext }