Skip to content
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
10 changes: 10 additions & 0 deletions api/bases/telemetry.openstack.org_metricstorages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,16 @@ spec:
to scrape dataplane node_exporter endpoints
pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$
type: string
disabledDashboards:
description: |-
DisabledDashboards is a list of dashboard names that should not be
created even when DashboardsEnabled is true. Valid names match the
dashboards managed by the operator (for example "openstack-cloud",
"openstack-node", "openstack-vm").
items:
type: string
type: array
x-kubernetes-list-type: atomic
monitoringStack:
description: |-
MonitoringStack allows to define a metric storage with
Expand Down
10 changes: 10 additions & 0 deletions api/bases/telemetry.openstack.org_telemetries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3147,6 +3147,16 @@ spec:
used to scrape dataplane node_exporter endpoints
pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$
type: string
disabledDashboards:
description: |-
DisabledDashboards is a list of dashboard names that should not be
created even when DashboardsEnabled is true. Valid names match the
dashboards managed by the operator (for example "openstack-cloud",
"openstack-node", "openstack-vm").
items:
type: string
type: array
x-kubernetes-list-type: atomic
enabled:
default: false
description: Enabled - Whether a MetricStorage should be deployed
Expand Down
26 changes: 21 additions & 5 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,29 @@ package v1beta1

import (
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// PersesResourceAvailable reports whether the given PersesDatasource or
// PersesDashboard resource is attached to a Perses instance, by checking its
// "Available" condition. It returns true when Available is True, otherwise
// false with the condition's reason and message (or a default when unset).
func PersesResourceAvailable(conditions []metav1.Condition) (bool, string, string) {
available := meta.FindStatusCondition(conditions, "Available")
if available == nil {
return false, "PersesReconciling", "Waiting for the Perses operator to reconcile the object; no Perses instance may be available"
}
if available.Status != metav1.ConditionTrue {
reason := available.Reason
if reason == "" {
reason = "PersesBackendNotReady"
}
return false, reason, available.Message
}
return true, "", ""
}

// Telemetry Condition Types used by API objects.
const (
// CeilometerReadyCondition Status=True condition which indicates if the Ceilometer is configured and operational
Expand Down Expand Up @@ -68,8 +89,6 @@ const (

DashboardPrometheusRuleReadyCondition condition.Type = "DashboardPrometheusRuleReady"

DashboardPluginReadyCondition condition.Type = "DashboardPluginReady"

DashboardDatasourceReadyCondition condition.Type = "DashboardDatasourceReady"

DashboardDefinitionReadyCondition condition.Type = "DashboardDefinitionReady"
Expand Down Expand Up @@ -314,9 +333,6 @@ const (
DashboardPrometheusRuleReadyInitMessage = "Dashboard PrometheusRule not started"
DashboardPrometheusRuleUnableToOwnMessage = "Error occured when trying to own %s"

DashboardPluginReadyInitMessage = "Dashboard Plugin not started"
DashboardPluginFailedMessage = "Error occured when trying to install the dashboard plugin: %s"

DashboardDatasourceReadyInitMessage = "Dashboard Datasource not started"
DashboardDatasourceFailedMessage = "Error occured when trying to install the dashboard datasource: %s"

Expand Down
76 changes: 76 additions & 0 deletions api/v1beta1/conditions_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package v1beta1

import (
"testing"

. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// TestPersesResourceAvailable checks that PersesResourceAvailable reads the
// "Available" condition correctly: true when Available is True, false with the
// condition's reason/message otherwise (and a default when it is unset).
func TestPersesResourceAvailable(t *testing.T) {
tests := []struct {
name string
conditions []metav1.Condition
wantAvail bool
wantReason string
wantMessage string
}{
{
name: "no conditions yet (freshly created / perses-operator not reconciled)",
conditions: nil,
wantAvail: false,
wantReason: "PersesReconciling",
wantMessage: "Waiting for the Perses operator to reconcile the object; no Perses instance may be available",
},
{
name: "available true",
conditions: []metav1.Condition{
{Type: "Available", Status: metav1.ConditionTrue, Reason: "Reconciled", Message: "ok"},
{Type: "Degraded", Status: metav1.ConditionFalse},
},
wantAvail: true,
},
{
name: "available false propagates the perses-operator reason and message",
conditions: []metav1.Condition{
{Type: "Available", Status: metav1.ConditionFalse, Reason: "PersesMissing", Message: "no Perses instances found matching the label selector"},
{Type: "Degraded", Status: metav1.ConditionTrue, Reason: "PersesMissing"},
},
wantAvail: false,
wantReason: "PersesMissing",
wantMessage: "no Perses instances found matching the label selector",
},
{
name: "degraded true but available true is not misread as unavailable",
conditions: []metav1.Condition{
{Type: "Degraded", Status: metav1.ConditionTrue, Reason: "SomethingTransient"},
{Type: "Available", Status: metav1.ConditionTrue, Reason: "Reconciled"},
},
wantAvail: true,
},
{
name: "available false with empty reason falls back to a non-empty reason",
conditions: []metav1.Condition{
{Type: "Available", Status: metav1.ConditionFalse, Reason: "", Message: "backend error"},
},
wantAvail: false,
wantReason: "PersesBackendNotReady",
wantMessage: "backend error",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
avail, reason, message := PersesResourceAvailable(tt.conditions)
g.Expect(avail).To(Equal(tt.wantAvail))
if !tt.wantAvail {
g.Expect(reason).To(Equal(tt.wantReason))
g.Expect(message).To(Equal(tt.wantMessage))
}
})
}
}
8 changes: 8 additions & 0 deletions api/v1beta1/metricstorage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ type MetricStorageSpec struct {
// +kubebuilder:default=false
DashboardsEnabled bool `json:"dashboardsEnabled"`

// DisabledDashboards is a list of dashboard names that should not be
// created even when DashboardsEnabled is true. Valid names match the
// dashboards managed by the operator (for example "openstack-cloud",
// "openstack-node", "openstack-vm").
// +kubebuilder:validation:Optional
// +listType=atomic
DisabledDashboards []string `json:"disabledDashboards,omitempty"`

// DataplaneNetwork defines the network that will be used to scrape dataplane node_exporter endpoints
// +kubebuilder:validation:Optional
// +kubebuilder:default=ctlplane
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ import (
"github.com/openstack-k8s-operators/lib-common/modules/common/operator"
mariadbv1beta1 "github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1"
ovnv1 "github.com/openstack-k8s-operators/ovn-operator/api/v1beta1"
persesv1alpha1 "github.com/perses/perses-operator/api/v1alpha1"
monv1 "github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring/v1"
monv1alpha1 "github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring/v1alpha1"
obov1 "github.com/rhobs/observability-operator/pkg/apis/monitoring/v1alpha1"
obsuiv1 "github.com/rhobs/observability-operator/pkg/apis/uiplugin/v1alpha1"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client/config"
)
Expand All @@ -78,7 +78,6 @@ func init() {
utilruntime.Must(rabbitmqv1.AddToScheme(scheme))
utilruntime.Must(telemetryv1beta1.AddToScheme(scheme))
utilruntime.Must(obov1.AddToScheme(scheme))
utilruntime.Must(obsuiv1.AddToScheme(scheme))
utilruntime.Must(monv1.AddToScheme(scheme))
utilruntime.Must(monv1alpha1.AddToScheme(scheme))
utilruntime.Must(mariadbv1beta1.AddToScheme(scheme))
Expand All @@ -90,6 +89,7 @@ func init() {
utilruntime.Must(topologyv1.AddToScheme(scheme))
utilruntime.Must(lokistackv1.AddToScheme(scheme))
utilruntime.Must(certmgrv1.AddToScheme(scheme))
utilruntime.Must(persesv1alpha1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/telemetry.openstack.org_metricstorages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,16 @@ spec:
to scrape dataplane node_exporter endpoints
pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$
type: string
disabledDashboards:
description: |-
DisabledDashboards is a list of dashboard names that should not be
created even when DashboardsEnabled is true. Valid names match the
dashboards managed by the operator (for example "openstack-cloud",
"openstack-node", "openstack-vm").
items:
type: string
type: array
x-kubernetes-list-type: atomic
monitoringStack:
description: |-
MonitoringStack allows to define a metric storage with
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/telemetry.openstack.org_telemetries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3147,6 +3147,16 @@ spec:
used to scrape dataplane node_exporter endpoints
pattern: ^[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9]$
type: string
disabledDashboards:
description: |-
DisabledDashboards is a list of dashboard names that should not be
created even when DashboardsEnabled is true. Valid names match the
dashboards managed by the operator (for example "openstack-cloud",
"openstack-node", "openstack-vm").
items:
type: string
type: array
x-kubernetes-list-type: atomic
enabled:
default: false
description: Enabled - Whether a MetricStorage should be deployed
Expand Down
15 changes: 9 additions & 6 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,25 @@ rules:
- list
- watch
- apiGroups:
- observability.openshift.io
- ovn.openstack.org
resources:
- uiplugins
- ovnnorthds
verbs:
- create
- get
- list
- patch
- watch
- apiGroups:
- ovn.openstack.org
- perses.dev
resources:
- ovnnorthds
- persesdashboards
- persesdatasources
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- rabbitmq.openstack.org
Expand Down
25 changes: 24 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ require (
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20260927135032-f0eb46b149d8
github.com/openstack-k8s-operators/ovn-operator/api v0.6.1-0.20261003111325-949d7b834383
github.com/openstack-k8s-operators/telemetry-operator/api v0.0.0-00010101000000-000000000000
github.com/perses/perses v0.51.0
github.com/perses/perses-operator v0.2.0
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.77.1-rhobs1
github.com/rhobs/observability-operator v1.0.0
k8s.io/api v0.33.13
Expand All @@ -31,9 +33,12 @@ require (

require (
cel.dev/expr v0.25.2 // indirect
github.com/PaesslerAG/gval v1.2.4 // indirect
github.com/PaesslerAG/jsonpath v0.1.2-0.20240726212847-3a740cf7976f // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/brunoga/deep v1.2.5 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand All @@ -42,6 +47,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.1 // indirect
Expand All @@ -57,22 +63,37 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/labstack/echo/v4 v4.13.4 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/muhlemmer/gu v0.3.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/nexucis/lamenv v0.5.2 // indirect
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20261001122809-0e19abbc9e47 // indirect
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20261001122809-0e19abbc9e47 // indirect
github.com/perses/common v0.27.1-0.20250326140707-96e439b14e0e // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.22.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.65.0 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cobra v1.9.1 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zitadel/oidc/v3 v3.38.1 // indirect
github.com/zitadel/schema v1.3.1 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
go.opentelemetry.io/otel v1.45.0 // indirect
Expand All @@ -86,7 +107,8 @@ require (
go.uber.org/zap v1.28.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
golang.org/x/crypto v0.57.0 // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/net v0.60.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.23.0 // indirect
Expand All @@ -101,6 +123,7 @@ require (
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.33.13 // indirect
k8s.io/apiserver v0.33.13 // indirect
Expand Down
Loading
Loading