Skip to content

Commit

Permalink
fix nil pointer reference
Browse files Browse the repository at this point in the history
Signed-off-by: juicer <[email protected]>
  • Loading branch information
cw-Guo committed Jul 5, 2024
1 parent cb16289 commit c5e306f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
3 changes: 3 additions & 0 deletions config/crd/bases/fluentd.fluent.io_outputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,9 @@ spec:
description: 'Specify https if your Opensearch endpoint
supports SSL (default: http).'
type: string
sslVerify:
description: Optional, Force certificate validation
type: boolean
user:
description: Optional, The login credentials to connect
to Opensearch
Expand Down
22 changes: 12 additions & 10 deletions controllers/fluentbitconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,16 +403,18 @@ func (r *FluentBitConfigReconciler) generateRewriteTagConfig(
md5.Sum([]byte(cfg.Namespace)),
),
)
if cfg.Spec.Service.EmitterName != "" {
buf.WriteString(fmt.Sprintf(" Emitter_Name %s\n", cfg.Spec.Service.EmitterName))
} else {
buf.WriteString(fmt.Sprintf(" Emitter_Name re_emitted_%x\n", md5.Sum([]byte(cfg.Namespace))))
}
if cfg.Spec.Service.EmitterStorageType != "" {
buf.WriteString(fmt.Sprintf(" Emitter_Storage.type %s\n", cfg.Spec.Service.EmitterStorageType))
}
if cfg.Spec.Service.EmitterMemBufLimit != "" {
buf.WriteString(fmt.Sprintf(" Emitter_Mem_Buf_Limit %s\n", cfg.Spec.Service.EmitterMemBufLimit))
if cfg.Spec.Service != nil {
if cfg.Spec.Service.EmitterName != "" {
buf.WriteString(fmt.Sprintf(" Emitter_Name %s\n", cfg.Spec.Service.EmitterName))
} else {
buf.WriteString(fmt.Sprintf(" Emitter_Name re_emitted_%x\n", md5.Sum([]byte(cfg.Namespace))))
}
if cfg.Spec.Service.EmitterStorageType != "" {
buf.WriteString(fmt.Sprintf(" Emitter_Storage.type %s\n", cfg.Spec.Service.EmitterStorageType))
}
if cfg.Spec.Service.EmitterMemBufLimit != "" {
buf.WriteString(fmt.Sprintf(" Emitter_Mem_Buf_Limit %s\n", cfg.Spec.Service.EmitterMemBufLimit))
}
}
return buf.String()
}
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/fluentd/output/opensearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ Opensearch defines the parameters for out_opensearch plugin
| logstashPrefix | LogstashPrefix defines the logstash prefix index name to write events when logstash_format is true (default: logstash). | *string |
| user | Optional, The login credentials to connect to Opensearch | *[plugins.Secret](../secret.md) |
| password | Optional, The login credentials to connect to Opensearch | *[plugins.Secret](../secret.md) |
| sslVerify | Optional, Force certificate validation | *bool |
| sslVerify | Optional, Force certificate validation | *bool |
3 changes: 3 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36042,6 +36042,9 @@ spec:
description: 'Specify https if your Opensearch endpoint
supports SSL (default: http).'
type: string
sslVerify:
description: Optional, Force certificate validation
type: boolean
user:
description: Optional, The login credentials to connect
to Opensearch
Expand Down

0 comments on commit c5e306f

Please sign in to comment.