Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
- Fix indentation for example
- Update type of verify_ssl to allow user ability to disable

Signed-off-by: Zachary Robichaud <[email protected]>
  • Loading branch information
zrobisho committed Mar 5, 2024
1 parent 82d06da commit 41ad2aa
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 68 deletions.
2 changes: 1 addition & 1 deletion docs/configuration/crds/v1beta1/output_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ OutputSpec defines the desired state of Output
### syslog (*output.SyslogOutputConfig, optional) {#outputspec-syslog}


### vmwareLogIntelligence (*output.VMWareLogIntelligenceOutput, optional) {#outputspec-vmwarelogintelligence}
### vmwareLogIntelligence (*output.VMWareLogIntelligenceOutputConfig, optional) {#outputspec-vmwarelogintelligence}


### vmwareLogInsight (*output.VMwareLogInsightOutput, optional) {#outputspec-vmwareloginsight}
Expand Down
26 changes: 15 additions & 11 deletions docs/configuration/plugins/outputs/vmware_log_intelligence.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ For details, see [https://github.com/vmware/fluent-plugin-vmware-log-intelligenc
spec:
vmwarelogintelligence:
endpoint_url: https://data.upgrade.symphony-dev.com/le-mans/v1/streams/ingestion-pipeline-stream
verify_ssl: true
http_compress: false
headers:
Content-Type: "application/json"
Authorization: "Bearer 12345"
structure: simple
buffer:
chunk_limit_records: 300
flush_interval: 3s
retry_max_times: 3
verify_ssl: true
http_compress: false
headers:
content_type: "application/json"
authorization:
valueFrom:
secretKeyRef:
name: vmware-log-intelligence-token
key: authorization
structure: simple
buffer:
chunk_limit_records: 300
flush_interval: 3s
retry_max_times: 3
```
Expand Down Expand Up @@ -54,7 +58,7 @@ Compress http request https://github.com/vmware/fluent-plugin-vmware-log-intelli
Required headers for sending logs to VMware Log Intelligence https://github.com/vmware/fluent-plugin-vmware-log-intelligence?tab=readme-ov-file#label-3Cheaders-3E
### verify_ssl (bool, required) {#vmwarelogintelligence-verify_ssl}
### verify_ssl (*bool, required) {#vmwarelogintelligence-verify_ssl}
Verify SSL (default: true) https://github.com/vmware/fluent-plugin-vmware-log-intelligence?tab=readme-ov-file#label-verify_ssl
Expand Down
62 changes: 31 additions & 31 deletions pkg/sdk/logging/api/v1beta1/output_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,37 @@ type _metaOutputSpec interface{} //nolint:deadcode,unused

// OutputSpec defines the desired state of Output
type OutputSpec struct {
LoggingRef string `json:"loggingRef,omitempty"`
S3OutputConfig *output.S3OutputConfig `json:"s3,omitempty"`
AzureStorage *output.AzureStorage `json:"azurestorage,omitempty"`
GCSOutput *output.GCSOutput `json:"gcs,omitempty"`
OSSOutput *output.OSSOutput `json:"oss,omitempty"`
ElasticsearchOutput *output.ElasticsearchOutput `json:"elasticsearch,omitempty"`
OpenSearchOutput *output.OpenSearchOutput `json:"opensearch,omitempty"`
LogZOutput *output.LogZOutput `json:"logz,omitempty"`
LokiOutput *output.LokiOutput `json:"loki,omitempty"`
SumologicOutput *output.SumologicOutput `json:"sumologic,omitempty"`
DatadogOutput *output.DatadogOutput `json:"datadog,omitempty"`
ForwardOutput *output.ForwardOutput `json:"forward,omitempty"`
FileOutput *output.FileOutputConfig `json:"file,omitempty"`
NullOutputConfig *output.NullOutputConfig `json:"nullout,omitempty"`
KafkaOutputConfig *output.KafkaOutputConfig `json:"kafka,omitempty"`
CloudWatchOutput *output.CloudWatchOutput `json:"cloudwatch,omitempty"`
KinesisFirehoseOutputConfig *output.KinesisFirehoseOutputConfig `json:"kinesisFirehose,omitempty"`
KinesisStreamOutputConfig *output.KinesisStreamOutputConfig `json:"kinesisStream,omitempty"`
LogDNAOutput *output.LogDNAOutput `json:"logdna,omitempty"`
NewRelicOutputConfig *output.NewRelicOutputConfig `json:"newrelic,omitempty"`
SplunkHecOutput *output.SplunkHecOutput `json:"splunkHec,omitempty"`
HTTPOutput *output.HTTPOutputConfig `json:"http,omitempty"`
AwsElasticsearchOutputConfig *output.AwsElasticsearchOutputConfig `json:"awsElasticsearch,omitempty"`
RedisOutputConfig *output.RedisOutputConfig `json:"redis,omitempty"`
SyslogOutputConfig *output.SyslogOutputConfig `json:"syslog,omitempty"`
GELFOutputConfig *output.GELFOutputConfig `json:"gelf,omitempty"`
SQSOutputConfig *output.SQSOutputConfig `json:"sqs,omitempty"`
MattermostOutputConfig *output.MattermostOutputConfig `json:"mattermost,omitempty"`
RelabelOutputConfig *output.RelabelOutputConfig `json:"relabel,omitempty"`
VMwareLogInsightConfig *output.VMwareLogInsightOutput `json:"vmwareLogInsight,omitempty"`
VMWareLogIntelligenceOutput *output.VMWareLogIntelligenceOutput `json:"vmwareLogIntelligence,omitempty"`
LoggingRef string `json:"loggingRef,omitempty"`
S3OutputConfig *output.S3OutputConfig `json:"s3,omitempty"`
AzureStorage *output.AzureStorage `json:"azurestorage,omitempty"`
GCSOutput *output.GCSOutput `json:"gcs,omitempty"`
OSSOutput *output.OSSOutput `json:"oss,omitempty"`
ElasticsearchOutput *output.ElasticsearchOutput `json:"elasticsearch,omitempty"`
OpenSearchOutput *output.OpenSearchOutput `json:"opensearch,omitempty"`
LogZOutput *output.LogZOutput `json:"logz,omitempty"`
LokiOutput *output.LokiOutput `json:"loki,omitempty"`
SumologicOutput *output.SumologicOutput `json:"sumologic,omitempty"`
DatadogOutput *output.DatadogOutput `json:"datadog,omitempty"`
ForwardOutput *output.ForwardOutput `json:"forward,omitempty"`
FileOutput *output.FileOutputConfig `json:"file,omitempty"`
NullOutputConfig *output.NullOutputConfig `json:"nullout,omitempty"`
KafkaOutputConfig *output.KafkaOutputConfig `json:"kafka,omitempty"`
CloudWatchOutput *output.CloudWatchOutput `json:"cloudwatch,omitempty"`
KinesisFirehoseOutputConfig *output.KinesisFirehoseOutputConfig `json:"kinesisFirehose,omitempty"`
KinesisStreamOutputConfig *output.KinesisStreamOutputConfig `json:"kinesisStream,omitempty"`
LogDNAOutput *output.LogDNAOutput `json:"logdna,omitempty"`
NewRelicOutputConfig *output.NewRelicOutputConfig `json:"newrelic,omitempty"`
SplunkHecOutput *output.SplunkHecOutput `json:"splunkHec,omitempty"`
HTTPOutput *output.HTTPOutputConfig `json:"http,omitempty"`
AwsElasticsearchOutputConfig *output.AwsElasticsearchOutputConfig `json:"awsElasticsearch,omitempty"`
RedisOutputConfig *output.RedisOutputConfig `json:"redis,omitempty"`
SyslogOutputConfig *output.SyslogOutputConfig `json:"syslog,omitempty"`
GELFOutputConfig *output.GELFOutputConfig `json:"gelf,omitempty"`
SQSOutputConfig *output.SQSOutputConfig `json:"sqs,omitempty"`
MattermostOutputConfig *output.MattermostOutputConfig `json:"mattermost,omitempty"`
RelabelOutputConfig *output.RelabelOutputConfig `json:"relabel,omitempty"`
VMwareLogInsightConfig *output.VMwareLogInsightOutput `json:"vmwareLogInsight,omitempty"`
VMWareLogIntelligenceOutputConfig *output.VMWareLogIntelligenceOutputConfig `json:"vmwareLogIntelligence,omitempty"`
}

// OutputStatus defines the observed state of Output
Expand Down
6 changes: 3 additions & 3 deletions pkg/sdk/logging/api/v1beta1/zz_generated.deepcopy.go

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

30 changes: 17 additions & 13 deletions pkg/sdk/logging/model/output/vmware_log_intelligence.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ For details, see [https://github.com/vmware/fluent-plugin-vmware-log-intelligenc
spec:
vmwarelogintelligence:
endpoint_url: https://data.upgrade.symphony-dev.com/le-mans/v1/streams/ingestion-pipeline-stream
verify_ssl: true
http_compress: false
headers:
Content-Type: "application/json"
Authorization: "Bearer 12345"
structure: simple
buffer:
chunk_limit_records: 300
flush_interval: 3s
retry_max_times: 3
verify_ssl: true
http_compress: false
headers:
content_type: "application/json"
authorization:
valueFrom:
secretKeyRef:
name: vmware-log-intelligence-token
key: authorization
structure: simple
buffer:
chunk_limit_records: 300
flush_interval: 3s
retry_max_times: 3
```
*/
type _docVMWareLogIntelligence interface{} //nolint:deadcode,unused
Expand All @@ -54,11 +58,11 @@ type _metaVMWareLogIntelligence interface{} //nolint:deadcode,unused

// +kubebuilder:object:generate=true
// +docName:"VMwareLogIntelligence"
type VMWareLogIntelligenceOutput struct {
type VMWareLogIntelligenceOutputConfig struct {
// Log Intelligence endpoint to send logs to https://github.com/vmware/fluent-plugin-vmware-log-intelligence?tab=readme-ov-file#label-endpoint_url
EndpointURL string `json:"endpoint_url"`
// Verify SSL (default: true) https://github.com/vmware/fluent-plugin-vmware-log-intelligence?tab=readme-ov-file#label-verify_ssl
VerifySSL bool `json:"verify_ssl" plugin:"default:true"`
VerifySSL *bool `json:"verify_ssl" plugin:"default:true"`
// Compress http request https://github.com/vmware/fluent-plugin-vmware-log-intelligence?tab=readme-ov-file#label-http_compress
HTTPCompress *bool `json:"http_compress,omitempty"`
// Required headers for sending logs to VMware Log Intelligence https://github.com/vmware/fluent-plugin-vmware-log-intelligence?tab=readme-ov-file#label-3Cheaders-3E
Expand Down Expand Up @@ -102,7 +106,7 @@ func (l *LogIntelligenceHeadersOut) ToDirective(secretLoader secret.SecretLoader
}, l, secretLoader)
}

func (v *VMWareLogIntelligenceOutput) ToDirective(secretLoader secret.SecretLoader, id string) (types.Directive, error) {
func (v *VMWareLogIntelligenceOutputConfig) ToDirective(secretLoader secret.SecretLoader, id string) (types.Directive, error) {
const pluginType = "vmware_log_intelligence"
vmwli := &types.OutputPlugin{
PluginMeta: types.PluginMeta{
Expand Down
8 changes: 3 additions & 5 deletions pkg/sdk/logging/model/output/vmware_log_intelligence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ buffer:
</buffer>
</match>
`
s := &output.VMWareLogIntelligenceOutput{}
s := &output.VMWareLogIntelligenceOutputConfig{}
require.NoError(t, yaml.Unmarshal(CONFIG, s))
test := render.NewOutputPluginTest(t, s)
test.DiffResult(expected)
Expand All @@ -85,7 +85,6 @@ buffer:
retry_max_times: 3
`)

//TODO: test format block
expected := `
<match **>
@type vmware_log_intelligence
Expand All @@ -111,7 +110,7 @@ buffer:
</buffer>
</match>
`
s := &output.VMWareLogIntelligenceOutput{}
s := &output.VMWareLogIntelligenceOutputConfig{}
require.NoError(t, yaml.Unmarshal(CONFIG, s))
test := render.NewOutputPluginTest(t, s)
test.DiffResult(expected)
Expand All @@ -134,7 +133,6 @@ format:
type: json
`)

//TODO: test format block
expected := `
<match **>
@type vmware_log_intelligence
Expand Down Expand Up @@ -162,7 +160,7 @@ format:
</format>
</match>
`
s := &output.VMWareLogIntelligenceOutput{}
s := &output.VMWareLogIntelligenceOutputConfig{}
require.NoError(t, yaml.Unmarshal(CONFIG, s))
test := render.NewOutputPluginTest(t, s)
test.DiffResult(expected)
Expand Down
13 changes: 9 additions & 4 deletions pkg/sdk/logging/model/output/zz_generated.deepcopy.go

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

0 comments on commit 41ad2aa

Please sign in to comment.