Skip to content
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

Bfs/test ocila #22

Open
wants to merge 6 commits into
base: oracle/release/2.2.0
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions apis/fluentbit/v1alpha2/clusteroutput_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type OutputSpec struct {
PrometheusExporter *output.PrometheusExporter `json:"prometheusExporter,omitempty"`
// PrometheusRemoteWrite_types defines Prometheus Remote Write configuration.
PrometheusRemoteWrite *output.PrometheusRemoteWrite `json:"prometheusRemoteWrite,omitempty"`
OracleLogAnalytics *output.OracleLogAnalytics `json:"oracleLogAnalytics,omitempty"`
// CustomPlugin defines Custom Output configuration.
CustomPlugin *custom.CustomPlugin `json:"customPlugin,omitempty"`
}
Expand Down
100 changes: 100 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/output/oracle_log_analytics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package output

import (
"fmt"
"github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins"
"github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/params"
)

// +kubebuilder:object:generate:=true

type OracleLogAnalytics struct {
Auth *AuthConfig `json:"auth,omitempty"`
OCIConfigInRecord bool `json:"ociConfigInRecord,omitempty"`
ObjectStorageNamespace *string `json:"objectStorageNamespace,omitempty"`
ProfileName *string `json:"profileName,omitempty"`
LogGroupId *string `json:"logGroupId,omitempty"`
LogSourceName *string `json:"logSourceName,omitempty"`
LogEntityId *string `json:"logEntityId,omitempty"`
LogEntityType *string `json:"logEntityType,omitempty"`
LogPath *string `json:"logPath,omitempty"`
LogSet *string `json:"logSetId,omitempty"`
GlobalMetadata map[string]string `json:"globalMetadata,omitempty"`
LogEventMetadata map[string]string `json:"logEventMetadata,omitempty"`
Workers *int32 `json:"Workers,omitempty"`
*plugins.TLS `json:"tls,omitempty"`
}

// +kubebuilder:object:generate:=true

type AuthConfig struct {
Type *string `json:"type,omitempty"`
Region *string `json:"region,omitempty"`
APISecret *string `json:"apiSecret,omitempty"`
ProfileName *string `json:"profileName,omitempty"`
}

func (_ *OracleLogAnalytics) Name() string {
return "oracle_log_analytics"
}

func (o *OracleLogAnalytics) Params(sl plugins.SecretLoader) (*params.KVs, error) {
kvs := params.NewKVs()
if o.Auth.Type != nil {
kvs.Insert("auth_type", *o.Auth.Type)
}
if o.Auth.Region != nil {
kvs.Insert("region", *o.Auth.Region)
}
if o.Auth.APISecret != nil {
kvs.Insert("config_file_location", "/root/.oci/config")
}
if o.Auth.ProfileName != nil {
kvs.Insert("profile_name", *o.Auth.ProfileName)
}
if o.ObjectStorageNamespace != nil {
kvs.Insert("namespace", *o.ObjectStorageNamespace)
}
if o.OCIConfigInRecord {
kvs.Insert("oci_config_in_record", "true")
}
if o.LogGroupId != nil {
kvs.Insert("oci_la_log_group_id", *o.LogGroupId)
}
if o.LogSourceName != nil {
kvs.Insert("oci_la_log_source_name", *o.LogSourceName)
}
if o.LogEntityId != nil {
kvs.Insert("oci_la_log_entity_id", *o.LogEntityId)
}
if o.LogEntityType != nil {
kvs.Insert("oci_la_log_entity_type", *o.LogEntityType)
}
if o.LogPath != nil {
kvs.Insert("oci_la_log_path", *o.LogPath)
}
if o.LogSet != nil {
kvs.Insert("oci_la_log_set_id", *o.LogSet)
}
if o.GlobalMetadata != nil {
for k, v := range o.GlobalMetadata {
kvs.Insert("oci_la_global_metadata", fmt.Sprintf("%s %s", k, v))
}
}
if o.LogEventMetadata != nil {
for k, v := range o.LogEventMetadata {
kvs.Insert("oci_la_metadata", fmt.Sprintf("%s %s", k, v))
}
}
if o.Workers != nil {
kvs.Insert("Workers", fmt.Sprint(*o.Workers))
}
if o.TLS != nil {
tls, err := o.TLS.Params(sl)
if err != nil {
return nil, err
}
kvs.Merge(tls)
}
return kvs, nil
}
119 changes: 119 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/output/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 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 @@ -1757,6 +1757,116 @@ spec:
server, e.g: /something'
type: string
type: object
oracleLogAnalytics:
properties:
Workers:
format: int32
type: integer
auth:
properties:
apiSecret:
type: string
profileName:
type: string
region:
type: string
type:
type: string
type: object
globalMetadata:
additionalProperties:
type: string
type: object
logEntityId:
type: string
logEntityType:
type: string
logEventMetadata:
additionalProperties:
type: string
type: object
logGroupId:
type: string
logPath:
type: string
logSetId:
type: string
logSourceName:
type: string
objectStorageNamespace:
type: string
ociConfigInRecord:
type: boolean
profileName:
type: string
tls:
description: Fluent Bit provides integrated support for Transport
Layer Security (TLS) and it predecessor Secure Sockets Layer
(SSL) respectively.
properties:
caFile:
description: Absolute path to CA certificate file
type: string
caPath:
description: Absolute path to scan for certificate files
type: string
crtFile:
description: Absolute path to Certificate file
type: string
debug:
description: 'Set TLS debug verbosity level. It accept the
following values: 0 (No debug), 1 (Error), 2 (State change),
3 (Informational) and 4 Verbose'
enum:
- 0
- 1
- 2
- 3
- 4
format: int32
type: integer
keyFile:
description: Absolute path to private Key file
type: string
keyPassword:
description: Optional password for tls.key_file file
properties:
valueFrom:
description: ValueSource defines how to find a value's
key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's
namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
verify:
description: Force certificate validation
type: boolean
vhost:
description: Hostname to be used for TLS SNI extension
type: string
type: object
type: object
prometheusExporter:
description: PrometheusExporter_types defines Prometheus exporter
configuration to expose metrics from Fluent Bit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
name: fluentbits.fluentbit.fluent.io
spec:
group: fluentbit.fluent.io
Expand Down
Loading