diff --git a/CHANGELOG.md b/CHANGELOG.md index a26cce4780..d93a709ef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - [#1598](https://github.com/openshift/cluster-monitoring-operator/pull/1598) Expose Authorization settings for remote write in the CMO configuration - [#1638](https://github.com/openshift/cluster-monitoring-operator/pull/1638) Expose sigv4 setting to Prometheus remoteWrite - [#1579](https://github.com/openshift/cluster-monitoring-operator/pull/1579) Expose retention size settings for Platform Prometheus +- [#1630](https://github.com/openshift/cluster-monitoring-operator/pull/1630) Expose retention size settings for UWM Prometheus ## 4.10 diff --git a/pkg/manifests/config.go b/pkg/manifests/config.go index 7dade9b144..058312b817 100644 --- a/pkg/manifests/config.go +++ b/pkg/manifests/config.go @@ -500,6 +500,7 @@ type UserWorkloadConfiguration struct { type PrometheusRestrictedConfig struct { LogLevel string `json:"logLevel"` Retention string `json:"retention"` + RetentionSize string `json:"retentionSize"` NodeSelector map[string]string `json:"nodeSelector"` Tolerations []v1.Toleration `json:"tolerations"` Resources *v1.ResourceRequirements `json:"resources"` diff --git a/pkg/manifests/manifests.go b/pkg/manifests/manifests.go index fce7189871..6ad477d25f 100644 --- a/pkg/manifests/manifests.go +++ b/pkg/manifests/manifests.go @@ -1762,6 +1762,10 @@ func (f *Factory) PrometheusUserWorkload(grpcTLS *v1.Secret) (*monv1.Prometheus, p.Spec.Retention = f.config.UserWorkloadConfiguration.Prometheus.Retention } + if f.config.UserWorkloadConfiguration.Prometheus.RetentionSize != "" { + p.Spec.RetentionSize = f.config.UserWorkloadConfiguration.Prometheus.RetentionSize + } + p.Spec.Image = &f.config.Images.Prometheus if f.config.UserWorkloadConfiguration.Prometheus.Resources != nil { diff --git a/test/e2e/config_test.go b/test/e2e/config_test.go index d3fa5a694f..701d6909cf 100644 --- a/test/e2e/config_test.go +++ b/test/e2e/config_test.go @@ -472,6 +472,7 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) { enforcedLabelValueLengthLimit: 600 logLevel: debug retention: 10h + retentionSize: 15GB queryLogFile: /tmp/test.log tolerations: - operator: "Exists" @@ -512,6 +513,7 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) { expectMatchingRequests(podName, containerName, mem, cpu), expectContainerArg("--log.level=debug", containerName), expectContainerArg("--storage.tsdb.retention.time=10h", containerName), + expectContainerArg("--storage.tsdb.retention.size=15GB", containerName), }, ), },