Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MON-3215: drop techpreview gate for collection profiles #2046

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Note: This CHANGELOG is only for the monitoring team to track all monitoring related changes. Please see OpenShift release notes for official changes.

## 4.16

- [#2046](https://github.com/openshift/cluster-monitoring-operator/pull/2046) Drop TechPreview gate for CollectionProfiles.
Copy link
Member

Choose a reason for hiding this comment

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

IIUC we added this as a TechPreviewNoUpgrade FeatureGate so for this PR there is no user change log?

Copy link
Member Author

Choose a reason for hiding this comment

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

ACK, the TP was replaced by the newly introduced ways of using feature-gates in #2153. At the moment there is no changelog entry for this, but we might want to point out to users that this is available in TP behind a certain FG if they want to use it. WDYT?


## 4.15

- [#2022](https://github.com/openshift/cluster-monitoring-operator/pull/2022) Add support to switch to metrics server from prometheus-adapter when the `MetricsServer` feature gate is enabled.
Expand Down
24 changes: 9 additions & 15 deletions pkg/manifests/config.go
Expand Up @@ -428,22 +428,16 @@ func (c *Config) LoadEnforcedBodySizeLimit(pcr PodCapacityReader, ctx context.Co
}

func (c *Config) Precheck() error {
if c.ClusterMonitoringConfiguration.PrometheusK8sConfig.CollectionProfile != FullCollectionProfile && !c.TechPreview {
return fmt.Errorf("collectionProfiles is a TechPreview feature, to be able to use a profile different from the default (\"full\") please enable TechPreview: %w", ErrConfigValidation)
}

// Validate the configured collection profile iff tech preview is enabled, even if the default profile is set.
if c.TechPreview {
for _, profile := range SupportedCollectionProfiles {
var v float64
if profile == c.ClusterMonitoringConfiguration.PrometheusK8sConfig.CollectionProfile {
v = 1
}
metrics.CollectionProfile.WithLabelValues(string(profile)).Set(v)
}
if !slices.Contains(SupportedCollectionProfiles, c.ClusterMonitoringConfiguration.PrometheusK8sConfig.CollectionProfile) {
return fmt.Errorf(`%q is not supported, supported collection profiles are: %q: %w`, c.ClusterMonitoringConfiguration.PrometheusK8sConfig.CollectionProfile, SupportedCollectionProfiles.String(), ErrConfigValidation)
// Validate the configured collection profile.
for _, profile := range SupportedCollectionProfiles {
var v float64
if profile == c.ClusterMonitoringConfiguration.PrometheusK8sConfig.CollectionProfile {
v = 1
}
metrics.CollectionProfile.WithLabelValues(string(profile)).Set(v)
}
if !slices.Contains(SupportedCollectionProfiles, c.ClusterMonitoringConfiguration.PrometheusK8sConfig.CollectionProfile) {
return fmt.Errorf(`%q is not supported, supported collection profiles are: %q: %w`, c.ClusterMonitoringConfiguration.PrometheusK8sConfig.CollectionProfile, SupportedCollectionProfiles.String(), ErrConfigValidation)
}

// Highlight deprecated config fields.
Expand Down
16 changes: 6 additions & 10 deletions pkg/manifests/manifests.go
Expand Up @@ -727,7 +727,7 @@ func (f *Factory) KubeStateMetricsClusterRole() (*rbacv1.ClusterRole, error) {
}

func (f *Factory) KubeStateMetricsServiceMonitors() ([]*monv1.ServiceMonitor, error) {
return serviceMonitors(f.config.TechPreview, f.KubeStateMetricsServiceMonitor, f.KubeStateMetricsMinimalServiceMonitor)
return serviceMonitors(f.KubeStateMetricsServiceMonitor, f.KubeStateMetricsMinimalServiceMonitor)
}

func (f *Factory) KubeStateMetricsServiceMonitor() (*monv1.ServiceMonitor, error) {
Expand Down Expand Up @@ -847,7 +847,7 @@ func (f *Factory) OpenShiftStateMetricsRBACProxySecret() (*v1.Secret, error) {
}

func (f *Factory) NodeExporterServiceMonitors() ([]*monv1.ServiceMonitor, error) {
return serviceMonitors(f.config.TechPreview, f.NodeExporterServiceMonitor, f.NodeExporterMinimalServiceMonitor)
return serviceMonitors(f.NodeExporterServiceMonitor, f.NodeExporterMinimalServiceMonitor)
}

func (f *Factory) NodeExporterServiceMonitor() (*monv1.ServiceMonitor, error) {
Expand Down Expand Up @@ -1962,7 +1962,7 @@ func (f *Factory) PrometheusAdapterService() (*v1.Service, error) {
}

func (f *Factory) PrometheusAdapterServiceMonitors() ([]*monv1.ServiceMonitor, error) {
return serviceMonitors(f.config.TechPreview, f.PrometheusAdapterServiceMonitor, f.PrometheusAdapterMinimalServiceMonitor)
return serviceMonitors(f.PrometheusAdapterServiceMonitor, f.PrometheusAdapterMinimalServiceMonitor)
}

func (f *Factory) PrometheusAdapterServiceMonitor() (*monv1.ServiceMonitor, error) {
Expand Down Expand Up @@ -2521,7 +2521,7 @@ func (f *Factory) ControlPlanePrometheusRule() (*monv1.PrometheusRule, error) {
}

func (f *Factory) ControlPlaneKubeletServiceMonitors() ([]*monv1.ServiceMonitor, error) {
return serviceMonitors(f.config.TechPreview, f.ControlPlaneKubeletServiceMonitor, f.ControlPlaneKubeletMinimalServiceMonitor)
return serviceMonitors(f.ControlPlaneKubeletServiceMonitor, f.ControlPlaneKubeletMinimalServiceMonitor)
}

func (f *Factory) ControlPlaneKubeletServiceMonitor() (*monv1.ServiceMonitor, error) {
Expand Down Expand Up @@ -3474,7 +3474,7 @@ func makeConsoleURL(c *configv1.Console, path string) (string, error) {
return "", nil
}

func serviceMonitors(appendMinimal bool, fullServiceMonitor, minimalServiceMonitor func() (*monv1.ServiceMonitor, error)) ([]*monv1.ServiceMonitor, error) {
func serviceMonitors(fullServiceMonitor, minimalServiceMonitor func() (*monv1.ServiceMonitor, error)) ([]*monv1.ServiceMonitor, error) {
sMonitor, err := fullServiceMonitor()
if err != nil {
return nil, err
Expand All @@ -3483,11 +3483,7 @@ func serviceMonitors(appendMinimal bool, fullServiceMonitor, minimalServiceMonit
if err != nil {
return nil, err
}
sms := []*monv1.ServiceMonitor{sMonitor}
if appendMinimal {
sms = append(sms, sMonitorMinimal)
}
return sms, nil
return []*monv1.ServiceMonitor{sMonitor, sMonitorMinimal}, nil
}

func addRemoteWriteConfigs(clusterID string, rw []monv1.RemoteWriteSpec, rwTargets ...RemoteWriteSpec) []monv1.RemoteWriteSpec {
Expand Down