From 10d50c5bb8c92793b9bc891d716c37bec9edeed3 Mon Sep 17 00:00:00 2001 From: Gabriel Bernal Date: Fri, 9 May 2025 10:49:29 +0200 Subject: [PATCH] feat: add schema configuration for logging view plugin Signed-off-by: Gabriel Bernal --- .../observability-operator.clusterserviceversion.yaml | 2 +- .../observability.openshift.io_uiplugins.yaml | 10 ++++++++++ .../common/observability.openshift.io_uiplugins.yaml | 10 ++++++++++ docs/api.md | 11 +++++++++++ pkg/apis/uiplugin/v1alpha1/types.go | 9 +++++++++ pkg/controllers/uiplugin/logging.go | 4 +++- 6 files changed, 44 insertions(+), 2 deletions(-) diff --git a/bundle/manifests/observability-operator.clusterserviceversion.yaml b/bundle/manifests/observability-operator.clusterserviceversion.yaml index cba8b5b71..b3d6198ce 100644 --- a/bundle/manifests/observability-operator.clusterserviceversion.yaml +++ b/bundle/manifests/observability-operator.clusterserviceversion.yaml @@ -42,7 +42,7 @@ metadata: categories: Monitoring certified: "false" containerImage: observability-operator:1.1.0 - createdAt: "2025-04-03T07:29:49Z" + createdAt: "2025-05-09T09:01:23Z" description: A Go based Kubernetes operator to setup and manage highly available Monitoring Stack using Prometheus, Alertmanager and Thanos Querier. operatorframework.io/cluster-monitoring: "true" diff --git a/bundle/manifests/observability.openshift.io_uiplugins.yaml b/bundle/manifests/observability.openshift.io_uiplugins.yaml index fda0fef1e..c6a68a77c 100644 --- a/bundle/manifests/observability.openshift.io_uiplugins.yaml +++ b/bundle/manifests/observability.openshift.io_uiplugins.yaml @@ -128,6 +128,16 @@ spec: type: string type: object x-kubernetes-map-type: atomic + schema: + description: |- + Schema is the schema to use for logs querying and display. + + Defatults to "viaq" if not specified. + enum: + - viaq + - otel + - select + type: string timeout: description: |- Timeout is the maximum duration before a query timeout. diff --git a/deploy/crds/common/observability.openshift.io_uiplugins.yaml b/deploy/crds/common/observability.openshift.io_uiplugins.yaml index de756d1da..d3e5e0b09 100644 --- a/deploy/crds/common/observability.openshift.io_uiplugins.yaml +++ b/deploy/crds/common/observability.openshift.io_uiplugins.yaml @@ -128,6 +128,16 @@ spec: type: string type: object x-kubernetes-map-type: atomic + schema: + description: |- + Schema is the schema to use for logs querying and display. + + Defatults to "viaq" if not specified. + enum: + - viaq + - otel + - select + type: string timeout: description: |- Timeout is the maximum duration before a query timeout. diff --git a/docs/api.md b/docs/api.md index 37e47a052..252338995 100644 --- a/docs/api.md +++ b/docs/api.md @@ -4279,6 +4279,17 @@ It only applies to UIPlugin Type: Logging. It always references a LokiStack in the "openshift-logging" namespace.
false + + schema + enum + + Schema is the schema to use for logs querying and display. + +Defatults to "viaq" if not specified.
+
+ Enum: viaq, otel, select
+ + false timeout string diff --git a/pkg/apis/uiplugin/v1alpha1/types.go b/pkg/apis/uiplugin/v1alpha1/types.go index 5cd379fe8..3e85677a6 100644 --- a/pkg/apis/uiplugin/v1alpha1/types.go +++ b/pkg/apis/uiplugin/v1alpha1/types.go @@ -119,6 +119,15 @@ type LoggingConfig struct { // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OCP Console Query Timeout",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:ocpConsoleTimeout"} // +kubebuilder:validation:Pattern:="^([0-9]+)([sm]{0,1})$" Timeout string `json:"timeout,omitempty"` + + // Schema is the schema to use for logs querying and display. + // + // Defatults to "viaq" if not specified. + // + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OCP Console Logs Schema",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:ocpConsoleLogsSchema"} + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Enum=viaq;otel;select + Schema string `json:"schema,omitempty"` } // LokiStackReference is used to configure a reference to a LokiStack that should be used diff --git a/pkg/controllers/uiplugin/logging.go b/pkg/controllers/uiplugin/logging.go index 78a245482..6de73d76f 100644 --- a/pkg/controllers/uiplugin/logging.go +++ b/pkg/controllers/uiplugin/logging.go @@ -24,6 +24,7 @@ import ( type loggingConfig struct { LogsLimit int32 `yaml:"logsLimit,omitempty"` Timeout time.Duration `yaml:"timeout,omitempty"` + Schema string `yaml:"schema,omitempty"` } func createLoggingPluginInfo(plugin *uiv1alpha1.UIPlugin, namespace, name, image string, features []string, ctx context.Context, dk dynamic.Interface) (*UIPluginInfo, error) { @@ -133,7 +134,7 @@ func marshalLoggingPluginConfig(cfg *uiv1alpha1.LoggingConfig) (string, error) { return "", nil } - if cfg.LogsLimit == 0 && cfg.Timeout == "" { + if cfg.LogsLimit == 0 && cfg.Timeout == "" && cfg.Schema == "" { return "", nil } @@ -149,6 +150,7 @@ func marshalLoggingPluginConfig(cfg *uiv1alpha1.LoggingConfig) (string, error) { pluginCfg := loggingConfig{ LogsLimit: cfg.LogsLimit, Timeout: timeout, + Schema: cfg.Schema, } buf := &bytes.Buffer{}