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
17 changes: 0 additions & 17 deletions Documentation/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Configuring Cluster Monitoring is optional. If the config does not exist or is e
* [AlertmanagerMainConfig](#alertmanagermainconfig)
* [AlertmanagerUserWorkloadConfig](#alertmanageruserworkloadconfig)
* [ClusterMonitoringConfiguration](#clustermonitoringconfiguration)
* [K8sPrometheusAdapter](#k8sprometheusadapter)
* [KubeStateMetricsConfig](#kubestatemetricsconfig)
* [MetricsServerConfig](#metricsserverconfig)
* [MonitoringPluginConfig](#monitoringpluginconfig)
Expand Down Expand Up @@ -143,22 +142,6 @@ The `ClusterMonitoringConfiguration` resource defines settings that customize th

[Back to TOC](#table-of-contents)

## K8sPrometheusAdapter

#### Description

The `K8sPrometheusAdapter` resource defines settings for the Prometheus Adapter component. This is deprecated config, setting this has no effect and will be removed in a future version.

| Property | Type | Description |
| -------- | ---- | ----------- |
| audit | *Audit | Defines the audit configuration used by the Prometheus Adapter instance. Possible profile values are: `metadata`, `request`, `requestresponse`, and `none`. The default value is `metadata`. |
| nodeSelector | map[string]string | Defines the nodes on which the pods are scheduled. |
| resources | *[v1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcerequirements-v1-core) | Defines resource requests and limits for the PrometheusAdapter container. |
| tolerations | [][v1.Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#toleration-v1-core) | Defines tolerations for the pods. |
| topologySpreadConstraints | []v1.TopologySpreadConstraint | Defines a pod's topology spread constraints. |

[Back to TOC](#table-of-contents)

## KubeStateMetricsConfig

#### Description
Expand Down
1 change: 0 additions & 1 deletion Documentation/openshiftdocs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ The configuration file itself is always defined under the `config.yaml` key in t
* link:modules/alertmanagermainconfig.adoc[AlertmanagerMainConfig]
* link:modules/alertmanageruserworkloadconfig.adoc[AlertmanagerUserWorkloadConfig]
* link:modules/clustermonitoringconfiguration.adoc[ClusterMonitoringConfiguration]
* link:modules/k8sprometheusadapter.adoc[K8sPrometheusAdapter]
* link:modules/kubestatemetricsconfig.adoc[KubeStateMetricsConfig]
* link:modules/metricsserverconfig.adoc[MetricsServerConfig]
* link:modules/monitoringpluginconfig.adoc[MonitoringPluginConfig]
Expand Down
30 changes: 0 additions & 30 deletions Documentation/openshiftdocs/modules/k8sprometheusadapter.adoc

This file was deleted.

28 changes: 0 additions & 28 deletions pkg/manifests/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,19 +603,6 @@ func (c *Config) LoadEnforcedBodySizeLimit(pcr PodCapacityReader, ctx context.Co
return nil
}

func (c *Config) checkAlertmanagerVersion() error {
if c.ClusterMonitoringConfiguration == nil || c.ClusterMonitoringConfiguration.PrometheusK8sConfig == nil {
return nil
}

for _, amConfig := range c.ClusterMonitoringConfiguration.PrometheusK8sConfig.AlertmanagerConfigs {
if alertmanagerV1(amConfig.APIVersion) {
return fmt.Errorf("%w: found in prometheusK8s.additionalAlertmanagerConfigs", errAlertmanagerV1NotSupported)
}
}
return nil
}

func (c *Config) Precheck() error {
if c.ClusterMonitoringConfiguration.PrometheusK8sConfig.CollectionProfile != FullCollectionProfile && !c.CollectionProfilesFeatureGateEnabled {
return fmt.Errorf("%w: collectionProfiles is currently a TechPreview feature behind the \"MetricsCollectionProfiles\" feature-gate, to be able to use a profile different from the default (\"full\") please enable it first", ErrConfigValidation)
Expand All @@ -635,21 +622,6 @@ func (c *Config) Precheck() error {
}
}

// Highlight deprecated config fields.
var d float64
if c.ClusterMonitoringConfiguration.K8sPrometheusAdapter != nil {
klog.Infof("k8sPrometheusAdapter is a deprecated config use metricsServer instead")
d = 1
}
// Prometheus-Adapter is replaced with Metrics Server by default from 4.16
metrics.DeprecatedConfig.WithLabelValues("openshift-monitoring/cluster-monitoring-config", "k8sPrometheusAdapter", "4.16").Set(d)

// TODO: remove after 4.19
// Only to assist with the migration to Prometheus 3; fail early if Alertmanager v1 is still in use.
if err := c.checkAlertmanagerVersion(); err != nil {
return err
}

return nil
}

Expand Down
40 changes: 0 additions & 40 deletions pkg/manifests/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"os"
"testing"

"github.com/openshift/cluster-monitoring-operator/pkg/metrics"
prom_testutil "github.com/prometheus/client_golang/prometheus/testutil"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -801,44 +799,6 @@ func TestCollectionProfilePreCheck(t *testing.T) {
}
}

func TestDeprecatedConfig(t *testing.T) {
for _, tc := range []struct {
name string
config string
expectedMetricValue float64
}{
{
name: "setting a field in k8sPrometheusAdapter",
config: `k8sPrometheusAdapter:
resources:
requests:
cpu: 1m
memory: 20Mi
`,
expectedMetricValue: 1,
},
{
name: "k8sPrometheusAdapter nil",
config: `k8sPrometheusAdapter:
`,
expectedMetricValue: 0,
},
{
name: "no config set",
config: "",
expectedMetricValue: 0,
},
} {
t.Run(tc.name, func(t *testing.T) {
c, err := NewConfigFromString(tc.config, true)
require.NoError(t, err)
err = c.Precheck()
require.NoError(t, err)
require.Equal(t, tc.expectedMetricValue, prom_testutil.ToFloat64(metrics.DeprecatedConfig))
})
}
}

// TestUnsupportedAlertmanagerVersion is a temp test
// TODO: remove after 4.19
// Only to assist with the migration to Prometheus 3; fail early if Alertmanager v1 is still in use.
Expand Down
22 changes: 0 additions & 22 deletions pkg/manifests/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ type ClusterMonitoringConfiguration struct {
UserWorkload *UserWorkloadConfig `json:"userWorkload,omitempty"`
// OmitFromDoc
HTTPConfig *HTTPConfig `json:"http,omitempty"`
// OmitFromDoc: `K8sPrometheusAdapter` defines settings for the Prometheus Adapter component.
K8sPrometheusAdapter *K8sPrometheusAdapter `json:"k8sPrometheusAdapter,omitempty"`
// `MetricsServer` defines settings for the MetricsServer component.
MetricsServerConfig *MetricsServerConfig `json:"metricsServer,omitempty"`
// `KubeStateMetricsConfig` defines settings for the `kube-state-metrics` agent.
Expand Down Expand Up @@ -118,26 +116,6 @@ type AlertmanagerMainConfig struct {
VolumeClaimTemplate *monv1.EmbeddedPersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
}

// The `K8sPrometheusAdapter` resource defines settings for the Prometheus Adapter component.
// This is deprecated config, setting this has no effect and will be removed in a future version.
// TODO: Remove this in 4.19. We should block upgrades till config is been removed
type K8sPrometheusAdapter struct {
// Defines the audit configuration used by the Prometheus Adapter instance.
// Possible profile values are: `metadata`, `request`, `requestresponse`, and `none`.
// The default value is `metadata`.
Audit *Audit `json:"audit,omitempty"`
// Defines the nodes on which the pods are scheduled.
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// Defines resource requests and limits for the PrometheusAdapter container.
Resources *v1.ResourceRequirements `json:"resources,omitempty"`
// Defines tolerations for the pods.
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
// Defines a pod's topology spread constraints.
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
// OmitFromDoc: Defines dedicated service monitors.
DedicatedServiceMonitors *DedicatedServiceMonitors `json:"dedicatedServiceMonitors,omitempty"`
}

// The `MetricsServerConfig` resource defines settings for the Metrics Server component.
type MetricsServerConfig struct {
// Defines the audit configuration used by the Metrics Server instance.
Expand Down
32 changes: 0 additions & 32 deletions test/e2e/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -874,38 +874,6 @@ monitoringPlugin:
}
}

func TestClusterMonitoringDeprecatedConfig(t *testing.T) {
metricName := "cluster_monitoring_operator_deprecated_config_in_use"
checkMetricValue := func(value float64) {
t.Helper()
f.PrometheusK8sClient.WaitForQueryReturn(
t, 5*time.Minute, fmt.Sprintf(`%s{configmap="openshift-monitoring/cluster-monitoring-config", field="k8sPrometheusAdapter", deprecation_version="4.16"}`, metricName),
func(v float64) error {
if v != value {
return fmt.Errorf("expected %s to be of value %f.", metricName, value)
}
return nil
},
)
}
// No deprecated config should have been used.
checkMetricValue(0)

// Set a field for k8sPrometheusAdapter.
data := `
k8sPrometheusAdapter:
audit:
profile: Request`
f.MustCreateOrUpdateConfigMap(t, f.BuildCMOConfigMap(t, data))
checkMetricValue(1)

// The metric should be reset to 0.
data = `
k8sPrometheusAdapter:`
f.MustCreateOrUpdateConfigMap(t, f.BuildCMOConfigMap(t, data))
checkMetricValue(0)
}

// checks that the toleration is present
// this toleration will match all so will not affect rolling out workloads
func expectTolerationsEqual(exp int) framework.PodAssertion {
Expand Down