Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 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
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

# Adjust sed command to include '' if on MacOS (Darwin)
ifeq ($(shell uname), Darwin)
BUNDLE_SED_COMMAND = sed -e 's|<IMG_OBSERVABILITY_OPERATOR>|$(OPERATOR_IMG)|g' \
-i '' bundle/manifests/observability-operator.clusterserviceversion.yaml
else
BUNDLE_SED_COMMAND = sed -e 's|<IMG_OBSERVABILITY_OPERATOR>|$(OPERATOR_IMG)|g' \
-i bundle/manifests/observability-operator.clusterserviceversion.yaml
endif



.PHONY: bundle
bundle: $(KUSTOMIZE) $(OPERATOR_SDK) generate
Expand All @@ -170,8 +180,7 @@ bundle: $(KUSTOMIZE) $(OPERATOR_SDK) generate
--kustomize-dir=deploy/olm \
--package=observability-operator \
$(BUNDLE_METADATA_OPTS)
sed -e 's|<IMG_OBSERVABILITY_OPERATOR>|$(OPERATOR_IMG)|g' \
-i bundle/manifests/observability-operator.clusterserviceversion.yaml
$(BUNDLE_SED_COMMAND)
$(OPERATOR_SDK) bundle validate ./bundle \
--select-optional name=operatorhub \
--optional-values=k8s-version=1.21 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ metadata:
categories: Monitoring
certified: "false"
containerImage: observability-operator:1.0.0
createdAt: "2024-12-11T10:22:00Z"
createdAt: "2025-01-13T20:38:02Z"
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"
Expand Down
15 changes: 12 additions & 3 deletions bundle/manifests/observability.openshift.io_uiplugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ spec:
- url
type: object
x-kubernetes-map-type: atomic
persesDashboards:
description: PersesDashboards points to the perses-dashboards
service of which it should create a proxy to.
properties:
serviceName:
description: Name of the Perses Service to proxy to.
minLength: 1
type: string
required:
- serviceName
type: object
x-kubernetes-map-type: atomic
thanosQuerier:
description: ThanosQuerier points to the thanos-querier service
of which it should create a proxy to.
Expand All @@ -168,9 +180,6 @@ spec:
- url
type: object
x-kubernetes-map-type: atomic
required:
- alertmanager
- thanosQuerier
type: object
troubleshootingPanel:
description: TroubleshootingPanel contains configuration for the troubleshooting
Expand Down
15 changes: 12 additions & 3 deletions deploy/crds/common/observability.openshift.io_uiplugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ spec:
- url
type: object
x-kubernetes-map-type: atomic
persesDashboards:
description: PersesDashboards points to the perses-dashboards
service of which it should create a proxy to.
properties:
serviceName:
description: Name of the Perses Service to proxy to.
minLength: 1
type: string
required:
- serviceName
type: object
x-kubernetes-map-type: atomic
thanosQuerier:
description: ThanosQuerier points to the thanos-querier service
of which it should create a proxy to.
Expand All @@ -168,9 +180,6 @@ spec:
- url
type: object
x-kubernetes-map-type: atomic
required:
- alertmanager
- thanosQuerier
type: object
troubleshootingPanel:
description: TroubleshootingPanel contains configuration for the troubleshooting
Expand Down
38 changes: 36 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4173,14 +4173,21 @@ Monitoring contains configuration for the monitoring console plugin.
<td>
Alertmanager points to the alertmanager instance of which it should create a proxy to.<br/>
</td>
<td>true</td>
<td>false</td>
</tr><tr>
<td><b><a href="#uipluginspecmonitoringpersesdashboards">persesDashboards</a></b></td>
<td>object</td>
<td>
PersesDashboards points to the perses-dashboards service of which it should create a proxy to.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b><a href="#uipluginspecmonitoringthanosquerier">thanosQuerier</a></b></td>
<td>object</td>
<td>
ThanosQuerier points to the thanos-querier service of which it should create a proxy to.<br/>
</td>
<td>true</td>
<td>false</td>
</tr></tbody>
</table>

Expand Down Expand Up @@ -4212,6 +4219,33 @@ Alertmanager points to the alertmanager instance of which it should create a pro
</table>


### UIPlugin.spec.monitoring.persesDashboards
<sup><sup>[↩ Parent](#uipluginspecmonitoring)</sup></sup>



PersesDashboards points to the perses-dashboards service of which it should create a proxy to.

<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>serviceName</b></td>
<td>string</td>
<td>
Name of the Perses Service to proxy to.<br/>
</td>
<td>true</td>
</tr></tbody>
</table>


### UIPlugin.spec.monitoring.thanosQuerier
<sup><sup>[↩ Parent](#uipluginspecmonitoring)</sup></sup>

Expand Down
25 changes: 21 additions & 4 deletions pkg/apis/uiplugin/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,18 @@ type LokiStackReference struct {
type MonitoringConfig struct {
// Alertmanager points to the alertmanager instance of which it should create a proxy to.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Optional
Alertmanager AlertmanagerReference `json:"alertmanager"`

// ThanosQuerier points to the thanos-querier service of which it should create a proxy to.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Optional
ThanosQuerier ThanosQuerierReference `json:"thanosQuerier"`

// PersesDashboards points to the perses-dashboards service of which it should create a proxy to.
//
// +kubebuilder:validation:Optional
PersesDashboards PersesDashboardsReference `json:"persesDashboards"`
}

// Alertmanager is used to configure a reference to a alertmanage that should be used
Expand All @@ -157,7 +162,7 @@ type AlertmanagerReference struct {
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength:=1
Url string `json:"url"`
Url string `json:"url,omitempty"`
}

// ThanosQuerier is used to configure a reference to a thanos-querier service that should be used
Expand All @@ -169,7 +174,19 @@ type ThanosQuerierReference struct {
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength:=1
Url string `json:"url"`
Url string `json:"url,omitempty"`
}

// PersesDashboards is used to configure a reference to a perses-dashbaords service that should be used
// by the monitoring console plugin.
//
// +structType=atomic
type PersesDashboardsReference struct {
// Name of the Perses Service to proxy to.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength:=1
ServiceName string `json:"serviceName,omitempty"`
}

// UIPluginSpec is the specification for desired state of UIPlugin.
Expand Down
16 changes: 16 additions & 0 deletions pkg/apis/uiplugin/v1alpha1/zz_generated.deepcopy.go

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

25 changes: 25 additions & 0 deletions pkg/controllers/uiplugin/compatibility_matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,31 @@ var compatibilityMatrix = []CompatibilityEntry{
"dev-alerts",
},
},
{
PluginType: uiv1alpha1.TypeMonitoring,
MinClusterVersion: "v4.19",
MaxClusterVersion: "",
ImageKey: "ui-monitoring",
MinAcmVersion: "v2.11",
MaxAcmVersion: "",
SupportLevel: DevPreview,
Features: []string{
"perses-dashboards",
"acm-alerting",
},
},
{
PluginType: uiv1alpha1.TypeMonitoring,
MinClusterVersion: "v4.19",
MaxClusterVersion: "",
ImageKey: "ui-monitoring",
MinAcmVersion: "",
MaxAcmVersion: "",
SupportLevel: DevPreview,
Features: []string{
"perses-dashboards",
},
},
{
PluginType: uiv1alpha1.TypeMonitoring,
MinClusterVersion: "v4.14",
Expand Down
49 changes: 49 additions & 0 deletions pkg/controllers/uiplugin/compatibility_matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package uiplugin

import (
"fmt"
"log"
"testing"

"golang.org/x/mod/semver"
Expand Down Expand Up @@ -37,6 +38,11 @@ func TestCompatibilityMatrixMaxVersions(t *testing.T) {
continue
}

// exception for montioring-plugin usage of perses-dashboards
if v.PluginType == "Monitoring" && contains(v.Features, "perses-dashboards") {
continue
}

_, found := cm[v.PluginType]
assert.Assert(t, !found, string(v.PluginType))
cm[v.PluginType] = struct{}{}
Expand Down Expand Up @@ -242,6 +248,46 @@ func TestLookupImageAndFeatures(t *testing.T) {
expectedFeatures: []string{"acm-alerting"},
expectedErr: nil,
},
{
pluginType: uiv1alpha1.TypeMonitoring,
clusterVersion: "v4.19",
acmVersion: "v2.11.3",
expectedKey: "ui-monitoring",
expectedFeatures: []string{"perses-dashboards", "acm-alerting"},
expectedErr: nil,
},
{
pluginType: uiv1alpha1.TypeMonitoring,
clusterVersion: "v4.19.0-0.nightly-2024-06-06-064349",
acmVersion: "v2.11.3",
expectedKey: "ui-monitoring",
expectedFeatures: []string{"perses-dashboards", "acm-alerting"},
expectedErr: nil,
},
{
pluginType: uiv1alpha1.TypeMonitoring,
clusterVersion: "v4.19",
acmVersion: "",
expectedKey: "ui-monitoring",
expectedFeatures: []string{"perses-dashboards"},
expectedErr: nil,
},
{
pluginType: uiv1alpha1.TypeMonitoring,
clusterVersion: "v4.19.0-0.nightly-2024-06-06-064349",
acmVersion: "",
expectedKey: "ui-monitoring",
expectedFeatures: []string{"perses-dashboards"},
expectedErr: nil,
},
{
pluginType: uiv1alpha1.TypeMonitoring,
clusterVersion: "v4.19",
acmVersion: "v2.10",
expectedKey: "ui-monitoring",
expectedFeatures: []string{"perses-dashboards"},
expectedErr: nil,
},
} {
t.Run(fmt.Sprintf("%s/%s", tc.pluginType, tc.clusterVersion), func(t *testing.T) {
info, err := lookupImageAndFeatures(tc.pluginType, tc.clusterVersion, tc.acmVersion)
Expand All @@ -253,6 +299,9 @@ func TestLookupImageAndFeatures(t *testing.T) {

assert.NilError(t, err)

log.Printf("expected Features: %s", tc.expectedFeatures)
log.Printf("Features: %s", info.Features)

t.Logf("%s == %s", tc.expectedKey, info.ImageKey)
assert.Equal(t, tc.expectedKey, info.ImageKey)

Expand Down
33 changes: 33 additions & 0 deletions pkg/controllers/uiplugin/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

func createMonitoringPluginInfo(plugin *uiv1alpha1.UIPlugin, namespace, name, image string, features []string) (*UIPluginInfo, error) {
config := plugin.Spec.Monitoring
persesDashboardsFeatureEnabled := contains(features, "perses-dashboards")
if config == nil {
return nil, fmt.Errorf("monitoring configuration can not be empty for plugin type %s", plugin.Spec.Type)
}
Expand Down Expand Up @@ -111,6 +112,31 @@ func createMonitoringPluginInfo(plugin *uiv1alpha1.UIPlugin, namespace, name, im
},
}

if persesDashboardsFeatureEnabled {
pluginInfo.Proxies = append(pluginInfo.Proxies, osv1.ConsolePluginProxy{
Alias: "perses",
Authorization: "UserToken",
Endpoint: osv1.ConsolePluginProxyEndpoint{
Type: osv1.ProxyTypeService,
Service: &osv1.ConsolePluginProxyServiceConfig{
Name: name,
Copy link
Contributor Author

@zhuje zhuje Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgbernalp @PeterYurkovich Is it necessary to require the PersesDashboardsReference > serviceName in the types.go? I think Service name and namespace are already passed in the props here...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are the name and namespace of the monitoring-plugin, not the perses service

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhh okay.

Namespace: namespace,
Port: 9446,
},
},
})
pluginInfo.LegacyProxies = append(pluginInfo.LegacyProxies, osv1alpha1.ConsolePluginProxy{
Type: "Service",
Alias: "perses",
Authorize: true,
Service: osv1alpha1.ConsolePluginProxyServiceConfig{
Name: name,
Namespace: namespace,
Port: 9446,
},
})
}

return pluginInfo, nil
}

Expand Down Expand Up @@ -150,6 +176,13 @@ func newMonitoringService(name string, namespace string) *corev1.Service {
Protocol: corev1.ProtocolTCP,
TargetPort: intstr.FromInt32(9445),
},
// JZ OPEN QUESTION: Need to align on PORT number...with Perses Operator?
{
Port: 9446,
Name: "perses",
Protocol: corev1.ProtocolTCP,
TargetPort: intstr.FromInt32(9446),
},
},
Selector: componentLabels(name),
Type: corev1.ServiceTypeClusterIP,
Expand Down
Loading
Loading