Skip to content

Commit

Permalink
Merge pull request #52 from JoaoBraveCoding/remove-metrics
Browse files Browse the repository at this point in the history
addon: removes metrics for dev-preview
  • Loading branch information
periklis authored Jun 3, 2024
2 parents f32869f + 01acc3e commit 4efe845
Show file tree
Hide file tree
Showing 18 changed files with 5 additions and 470 deletions.
6 changes: 1 addition & 5 deletions deploy/resources/cluster_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,4 @@
# Role for addon to perform tracing specific actions
- apiGroups: ["opentelemetry.io"]
resources: ["opentelemetrycollectors"]
verbs: ["get", "list", "watch"]
# Roles for addon to perform metrics specific actions
- apiGroups: ["route.openshift.io"]
resources: ["routes"]
verbs: ["get"]
verbs: ["get", "list", "watch"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/ViaQ/logerr/v2 v2.1.0
github.com/imdario/mergo v0.3.16
github.com/open-telemetry/opentelemetry-operator v0.93.0
github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e // release-4.15
github.com/openshift/api v0.0.0-20240124164020-e2ce40831f2e // indirect; release-4.15
github.com/openshift/cluster-logging-operator v0.0.0-20231130135759-9270994dc4bc
github.com/operator-framework/api v0.17.7
github.com/spf13/cobra v1.8.0
Expand Down
25 changes: 3 additions & 22 deletions internal/addon/helm/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/rhobs/multicluster-observability-addon/internal/addon"
lhandlers "github.com/rhobs/multicluster-observability-addon/internal/logging/handlers"
lmanifests "github.com/rhobs/multicluster-observability-addon/internal/logging/manifests"
"github.com/rhobs/multicluster-observability-addon/internal/metrics"
thandlers "github.com/rhobs/multicluster-observability-addon/internal/tracing/handlers"
tmanifests "github.com/rhobs/multicluster-observability-addon/internal/tracing/manifests"
"k8s.io/klog/v2"
Expand All @@ -22,13 +21,11 @@ const annotationLocalCluster = "local-cluster"

type HelmChartValues struct {
Enabled bool `json:"enabled"`
Metrics metrics.MetricsValues `json:"metrics"`
Logging lmanifests.LoggingValues `json:"logging"`
Tracing tmanifests.TracingValues `json:"tracing"`
}

type Options struct {
MetricsDisabled bool
LoggingDisabled bool
TracingDisabled bool
}
Expand Down Expand Up @@ -56,14 +53,6 @@ func GetValuesFunc(k8s client.Client) addonfactory.GetValuesFunc {
Enabled: true,
}

if !opts.MetricsDisabled {
metrics, err := metrics.GetValuesFunc(k8s, cluster, addon, aodc)
if err != nil {
return nil, err
}
userValues.Metrics = metrics
}

if !opts.LoggingDisabled {
loggingOpts, err := lhandlers.BuildOptions(k8s, addon, aodc)
if err != nil {
Expand Down Expand Up @@ -116,28 +105,20 @@ func buildOptions(addOnDeployment *addonapiv1alpha1.AddOnDeploymentConfig) (Opti
}

for _, keyvalue := range addOnDeployment.Spec.CustomizedVariables {
if keyvalue.Name == addon.AdcMetricsDisabledKey {
value, err := strconv.ParseBool(keyvalue.Value)
if err != nil {
return opts, err
}
opts.MetricsDisabled = value
}
if keyvalue.Name == addon.AdcLoggingDisabledKey {
switch keyvalue.Name {
case addon.AdcLoggingDisabledKey:
value, err := strconv.ParseBool(keyvalue.Value)
if err != nil {
return opts, err
}
opts.LoggingDisabled = value
}
if keyvalue.Name == addon.AdcTracingisabledKey {
case addon.AdcTracingisabledKey:
value, err := strconv.ParseBool(keyvalue.Value)
if err != nil {
return opts, err
}
opts.TracingDisabled = value
}

}
return opts, nil
}
Expand Down
8 changes: 0 additions & 8 deletions internal/addon/helm/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ func Test_Mcoa_Disable_Charts(t *testing.T) {
},
Spec: addonapiv1alpha1.AddOnDeploymentConfigSpec{
CustomizedVariables: []addonapiv1alpha1.CustomizedVariable{
{
Name: "metricsDisabled",
Value: "true",
},
{
Name: "loggingDisabled",
Value: "true",
Expand Down Expand Up @@ -127,10 +123,6 @@ func Test_Mcoa_Disable_Chart_Hub(t *testing.T) {
},
Spec: addonapiv1alpha1.AddOnDeploymentConfigSpec{
CustomizedVariables: []addonapiv1alpha1.CustomizedVariable{
{
Name: "metricsDisabled",
Value: "true",
},
{
Name: "loggingDisabled",
Value: "true",
Expand Down
3 changes: 0 additions & 3 deletions internal/addon/manifests/charts/mcoa/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ version: 1.0.0
appVersion: "1.0.0"

dependencies:
- name: metrics
repository: 'file://./charts/metrics'
condition: metrics.enabled
- name: logging
repository: 'file://./charts/logging'
condition: logging.enabled
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions internal/addon/manifests/charts/mcoa/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ nameOverride: null

enabled: true

metrics:
enabled: true

logging:
enabled: true

Expand Down
Loading

0 comments on commit 4efe845

Please sign in to comment.