Skip to content
Merged
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
2 changes: 1 addition & 1 deletion api/observability/v1/output_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ type LokiStackAuthentication struct {

// LokiStack provides optional extra properties for `type: lokistack`
// +kubebuilder:validation:XValidation:rule="!has(self.labelKeys) || !has(self.dataModel) || self.dataModel == 'Viaq'", message="'labelKeys' cannot be set when data model is 'Otel'"
// +kubebuilder:validation:XValidation:rule="!has(self.tuning) || self.tuning.compression != 'snappy' || !has(self.dataModel) || self.dataModel == 'Viaq'", message="'snappy' compression cannot be used when data model is 'Otel'"
// +kubebuilder:validation:XValidation:rule="!has(self.tuning) || !has(self.tuning.compression) || self.tuning.compression != 'snappy' || !has(self.dataModel) || self.dataModel == 'Viaq'", message="'snappy' compression cannot be used when data model is 'Otel'"
type LokiStack struct {
// Authentication sets credentials for authenticating the requests.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2052,8 +2052,9 @@ spec:
== ''Viaq'''
- message: '''snappy'' compression cannot be used when data
model is ''Otel'''
rule: '!has(self.tuning) || self.tuning.compression != ''snappy''
|| !has(self.dataModel) || self.dataModel == ''Viaq'''
rule: '!has(self.tuning) || !has(self.tuning.compression)
|| self.tuning.compression != ''snappy'' || !has(self.dataModel)
|| self.dataModel == ''Viaq'''
name:
description: Name used to refer to the output from a `pipeline`.
pattern: ^[a-z][a-z0-9-]*[a-z0-9]$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2052,8 +2052,9 @@ spec:
== ''Viaq'''
- message: '''snappy'' compression cannot be used when data
model is ''Otel'''
rule: '!has(self.tuning) || self.tuning.compression != ''snappy''
|| !has(self.dataModel) || self.dataModel == ''Viaq'''
rule: '!has(self.tuning) || !has(self.tuning.compression)
|| self.tuning.compression != ''snappy'' || !has(self.dataModel)
|| self.dataModel == ''Viaq'''
name:
description: Name used to refer to the output from a `pipeline`.
pattern: ^[a-z][a-z0-9-]*[a-z0-9]$
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/collection/apivalidations/api_validations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ var _ = Describe("", func() {
_, err = buffer.ReadFrom(reader)
assert(buffer.String(), err)
},
Entry("should pass for LokiStack with empty tuning", "lokistack-empty-tuning.yaml", func(out string, err error) {
Expect(err).ToNot(HaveOccurred())
}),
Entry("should fail for LokiStack with snappy compression", "lokistack-snappy-compression-otel.yaml", func(out string, err error) {
Expect(err.Error()).To(MatchRegexp(".'snappy' compression cannot be used when data model is 'Otel'"))
}),
Entry("should pass for syslog with valid udp URL", "syslog_valid_url_udp.yaml", func(out string, err error) {
Expect(err).ToNot(HaveOccurred())
}),
Expand Down
51 changes: 51 additions & 0 deletions test/e2e/collection/apivalidations/lokistack-empty-tuning.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: observability.openshift.io/v1
kind: ClusterLogForwarder
metadata:
name: clf-validation-test
spec:
outputs:
- lokiStack:
authentication:
token:
from: serviceAccount
target:
name: lokistack-dev
namespace: openshift-logging
tuning: { }
dataModel: Otel
name: logging-loki-otel
tls:
ca:
configMapName: openshift-service-ca.crt
key: service-ca.crt
type: lokiStack
- lokiStack:
authentication:
token:
from: serviceAccount
target:
name: lokistack-dev
namespace: openshift-logging
tuning: { }
dataModel: Viaq
name: logging-loki-viaq
tls:
ca:
configMapName: openshift-service-ca.crt
key: service-ca.crt
type: lokiStack
pipelines:
- inputRefs:
- application
- infrastructure
- audit
name: logs-to-loki-otel
outputRefs:
- logging-loki-otel
- inputRefs:
- application
name: logs-to-loki-viaq
outputRefs:
- logging-loki-viaq
serviceAccount:
name: clf-validation-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: observability.openshift.io/v1
kind: ClusterLogForwarder
metadata:
name: clf-validation-test
spec:
outputs:
- lokiStack:
authentication:
token:
from: serviceAccount
target:
name: lokistack-dev
namespace: openshift-logging
tuning:
compression: snappy
dataModel: Otel
name: logging-loki
tls:
ca:
configMapName: openshift-service-ca.crt
key: service-ca.crt
type: lokiStack
pipelines:
- inputRefs:
- application
- infrastructure
- audit
name: logs-to-loki
outputRefs:
- logging-loki
serviceAccount:
name: clf-validation-test