Skip to content

Commit

Permalink
Add missing fluent-bit config parameters
Browse files Browse the repository at this point in the history
Added fluent-bit config parameters which are not yet exposed in the CRD.

Signed-off-by: Zoltán Reegn <[email protected]>
  • Loading branch information
reegnz committed Jul 17, 2024
1 parent e0d936d commit b2fb860
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
29 changes: 29 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/filter/kubernetes_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ type Kubernetes struct {
// configurable 'time to live' for the K8s token. By default, it is set to 600 seconds.
// After this time, the token is reloaded from Kube_Token_File or the Kube_Token_Command.
KubeTokenTTL string `json:"kubeTokenTTL,omitempty"`
// Command to get Kubernetes authorization token.
// By default, it will be NULL and we will use token file to get token.
KubeTokenCommand string `json:"kubeTokenCommand,omitempty"`
// Configurable TTL for K8s cached namespace metadata.
// By default, it is set to 900 which means a 15min TTL for namespace cache entries.
// Setting this to 0 will mean entries are evicted at random once the cache is full.
KubeMetaNamespaceCacheTTL *int32 `json:"kubeMetaNamespaceCacheTTL,omitempty"`
// Include Kubernetes namespace resource labels in the extra metadata.
NamespaceLabels *bool `json:"namespaceLabels,omitempty"`
// Include Kubernetes namespace resource annotations in the extra metadata.
NamespaceAnnotations *bool `json:"namespaceAnnotations,omitempty"`
// Include Kubernetes namespace metadata only and no pod metadata.
// If this is set, the values of Labels and Annotations are ignored.
NamespaceMetadataOnly *bool `json:"namespaceMetadataOnly,omitempty"`
}

func (_ *Kubernetes) Name() string {
Expand Down Expand Up @@ -188,6 +202,21 @@ func (k *Kubernetes) Params(_ plugins.SecretLoader) (*params.KVs, error) {
if k.KubeTokenTTL != "" {
kvs.Insert("Kube_Token_TTL", k.KubeTokenTTL)
}
if k.KubeTokenCommand != "" {
kvs.Insert("Kube_Token_Command", fmt.Sprint(k.KubeTokenCommand))
}
if k.KubeMetaNamespaceCacheTTL != nil {
kvs.Insert("Kube_Meta_Namespace_Cache_TTL", fmt.Sprint(*k.KubeMetaNamespaceCacheTTL))
}
if k.NamespaceLabels != nil {
kvs.Insert("Namespace_Labels", fmt.Sprint(*k.NamespaceLabels))
}
if k.NamespaceAnnotations != nil {
kvs.Insert("Namespace_Annotations", fmt.Sprint(*k.NamespaceAnnotations))
}
if k.NamespaceMetadataOnly != nil {
kvs.Insert("Namespace_Metadata_Only", fmt.Sprint(*k.NamespaceMetadataOnly))
}
return kvs, nil
}

Expand Down
20 changes: 20 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/filter/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions docs/plugins/fluentbit/filter/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ Kubernetes filter allows to enrich your log files with Kubernetes metadata. <br
| kubeletHost | kubelet host using for HTTP request, this only works when Use_Kubelet set to On. | string |
| kubeMetaCacheTTL | configurable TTL for K8s cached metadata. By default, it is set to 0 which means TTL for cache entries is disabled and cache entries are evicted at random when capacity is reached. In order to enable this option, you should set the number to a time interval. For example, set this value to 60 or 60s and cache entries which have been created more than 60s will be evicted. | string |
| kubeTokenTTL | configurable 'time to live' for the K8s token. By default, it is set to 600 seconds. After this time, the token is reloaded from Kube_Token_File or the Kube_Token_Command. | string |
| kubeTokenCommand | Command to get Kubernetes authorization token. By default, it will be NULL and we will use token file to get token. | string |
| kubeMetaNamespaceCacheTTL | Configurable TTL for K8s cached namespace metadata. By default, it is set to 900 which means a 15min TTL for namespace cache entries. Setting this to 0 will mean entries are evicted at random once the cache is full. | *int32 |
| namespaceLabels | Include Kubernetes namespace resource labels in the extra metadata. | *bool |
| namespaceAnnotations | Include Kubernetes namespace resource annotations in the extra metadata. | *bool |
| namespaceMetadataOnly | Include Kubernetes namespace metadata only and no pod metadata. If this is set, the values of Labels and Annotations are ignored. | *bool |

0 comments on commit b2fb860

Please sign in to comment.