diff --git a/config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml b/config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml index 5e8162cb2ee..3ced0128b3f 100644 --- a/config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml +++ b/config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml @@ -3122,6 +3122,41 @@ tests: authorization: type: BearerToken expectedError: 'spec.prometheusConfig.remoteWrite[0].authorization.type: Unsupported value: "BearerToken": supported values: "Authorization", "BasicAuth", "OAuth2", "SigV4", "ServiceAccount"' + - name: Should accept writeRelabelConfigs with regex longer than 1000 bytes + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: ClusterMonitoring + spec: + userDefined: + mode: "Disabled" + prometheusConfig: + remoteWrite: + - name: primary + url: https://example.com/api/v1/write + authorization: + type: ServiceAccount + writeRelabelConfigs: + - name: keep-metrics + regex: "(kube_node_spec_unschedulable|kube_pod_container_status_restarts_total|kube_pod_container_resource_requests|kube_pod_container_resource_limits|kube_pod_status_phase|kube_pod_status_ready|kube_deployment_status_replicas_available|kube_deployment_status_replicas_unavailable|kube_statefulset_status_replicas_ready|kube_daemonset_status_number_unavailable|kube_job_status_failed|kube_job_status_succeeded|kube_cronjob_status_active|kube_namespace_status_phase|kube_node_status_condition|kube_node_status_allocatable|kube_node_status_capacity|kube_persistentvolume_status_phase|kube_persistentvolumeclaim_status_phase|kube_resourcequota|kube_horizontalpodautoscaler_status_current_replicas|kube_horizontalpodautoscaler_status_desired_replicas|kube_horizontalpodautoscaler_spec_max_replicas|kube_horizontalpodautoscaler_spec_min_replicas|container_cpu_usage_seconds_total|container_memory_working_set_bytes|container_network_receive_bytes_total|container_network_transmit_bytes_total|process_start_time_seconds|up|scrape_duration_seconds|scrape_samples_scraped|scrape_samples_post_metric_relabeling)" + action: + type: Drop + expected: | + apiVersion: config.openshift.io/v1alpha1 + kind: ClusterMonitoring + spec: + userDefined: + mode: "Disabled" + prometheusConfig: + remoteWrite: + - name: primary + url: https://example.com/api/v1/write + authorization: + type: ServiceAccount + writeRelabelConfigs: + - name: keep-metrics + regex: "(kube_node_spec_unschedulable|kube_pod_container_status_restarts_total|kube_pod_container_resource_requests|kube_pod_container_resource_limits|kube_pod_status_phase|kube_pod_status_ready|kube_deployment_status_replicas_available|kube_deployment_status_replicas_unavailable|kube_statefulset_status_replicas_ready|kube_daemonset_status_number_unavailable|kube_job_status_failed|kube_job_status_succeeded|kube_cronjob_status_active|kube_namespace_status_phase|kube_node_status_condition|kube_node_status_allocatable|kube_node_status_capacity|kube_persistentvolume_status_phase|kube_persistentvolumeclaim_status_phase|kube_resourcequota|kube_horizontalpodautoscaler_status_current_replicas|kube_horizontalpodautoscaler_status_desired_replicas|kube_horizontalpodautoscaler_spec_max_replicas|kube_horizontalpodautoscaler_spec_min_replicas|container_cpu_usage_seconds_total|container_memory_working_set_bytes|container_network_receive_bytes_total|container_network_transmit_bytes_total|process_start_time_seconds|up|scrape_duration_seconds|scrape_samples_scraped|scrape_samples_post_metric_relabeling)" + action: + type: Drop - name: Should accept prometheusConfig retention duration initial: | apiVersion: config.openshift.io/v1alpha1 diff --git a/config/v1alpha1/types_cluster_monitoring.go b/config/v1alpha1/types_cluster_monitoring.go index 98f8d7dc592..6f99152e466 100644 --- a/config/v1alpha1/types_cluster_monitoring.go +++ b/config/v1alpha1/types_cluster_monitoring.go @@ -2153,10 +2153,10 @@ type RelabelConfig struct { // Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. // The default value is "(.*)" to match everything. - // Must be between 1 and 1000 characters in length when specified. + // Must be between 1 and 8192 characters in length when specified. // +optional // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=1000 + // +kubebuilder:validation:MaxLength=8192 Regex string `json:"regex,omitempty"` // action defines the action to perform on the matched labels and its configuration. diff --git a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yaml b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yaml index d169df63401..49c65b26c9b 100644 --- a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yaml +++ b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clustermonitorings.crd.yaml @@ -4569,8 +4569,8 @@ spec: Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is "(.*)" to match everything. - Must be between 1 and 1000 characters in length when specified. - maxLength: 1000 + Must be between 1 and 8192 characters in length when specified. + maxLength: 8192 minLength: 1 type: string separator: diff --git a/config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml b/config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml index a7f16af0246..8f6d799002f 100644 --- a/config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml +++ b/config/v1alpha1/zz_generated.featuregated-crd-manifests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml @@ -4569,8 +4569,8 @@ spec: Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is "(.*)" to match everything. - Must be between 1 and 1000 characters in length when specified. - maxLength: 1000 + Must be between 1 and 8192 characters in length when specified. + maxLength: 8192 minLength: 1 type: string separator: diff --git a/config/v1alpha1/zz_generated.swagger_doc_generated.go b/config/v1alpha1/zz_generated.swagger_doc_generated.go index 99d9b5a66f4..cf6793d7825 100644 --- a/config/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/config/v1alpha1/zz_generated.swagger_doc_generated.go @@ -660,7 +660,7 @@ var map_RelabelConfig = map[string]string{ "name": "name is a unique identifier for this relabel configuration. Must contain only alphanumeric characters, hyphens, and underscores. Must be between 1 and 63 characters in length.", "sourceLabels": "sourceLabels specifies which label names to extract from each series for this relabeling rule. The values of these labels are joined together using the configured separator, and the resulting string is then matched against the regular expression. If a referenced label does not exist on a series, Prometheus substitutes an empty string. When omitted, the rule operates without extracting source labels (useful for actions like labelmap). Minimum of 1 and maximum of 10 source labels can be specified, each between 1 and 128 characters. Each entry must be unique. Label names beginning with \"__\" (two underscores) are reserved for internal Prometheus use and are not allowed. Label names SHOULD start with a letter (a-z, A-Z) or underscore (_), followed by zero or more letters, digits (0-9), or underscores for best compatibility. While Prometheus supports UTF-8 characters in label names (since v3.0.0), using the recommended character set ensures better compatibility with the wider ecosystem (tooling, third-party instrumentation, etc.).", "separator": "separator is the character sequence used to join source label values. Common examples: \";\", \",\", \"::\", \"|||\". When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is \";\". Must be between 1 and 5 characters in length when specified.", - "regex": "regex is the regular expression to match against the concatenated source label values. Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is \"(.*)\" to match everything. Must be between 1 and 1000 characters in length when specified.", + "regex": "regex is the regular expression to match against the concatenated source label values. Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is \"(.*)\" to match everything. Must be between 1 and 8192 characters in length when specified.", "action": "action defines the action to perform on the matched labels and its configuration. Exactly one action-specific configuration must be specified based on the action type.", } diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index c60b07daff0..a301f9c6990 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -26938,7 +26938,7 @@ func schema_openshift_api_config_v1alpha1_RelabelConfig(ref common.ReferenceCall }, "regex": { SchemaProps: spec.SchemaProps{ - Description: "regex is the regular expression to match against the concatenated source label values. Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is \"(.*)\" to match everything. Must be between 1 and 1000 characters in length when specified.", + Description: "regex is the regular expression to match against the concatenated source label values. Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is \"(.*)\" to match everything. Must be between 1 and 8192 characters in length when specified.", Type: []string{"string"}, Format: "", }, diff --git a/openapi/openapi.json b/openapi/openapi.json index 832f0146d88..9c9783f8b7a 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -14819,7 +14819,7 @@ "type": "string" }, "regex": { - "description": "regex is the regular expression to match against the concatenated source label values. Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is \"(.*)\" to match everything. Must be between 1 and 1000 characters in length when specified.", + "description": "regex is the regular expression to match against the concatenated source label values. Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is \"(.*)\" to match everything. Must be between 1 and 8192 characters in length when specified.", "type": "string" }, "separator": { diff --git a/payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml b/payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml index d169df63401..49c65b26c9b 100644 --- a/payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml +++ b/payload-manifests/crds/0000_10_config-operator_01_clustermonitorings.crd.yaml @@ -4569,8 +4569,8 @@ spec: Must be a valid RE2 regular expression (https://github.com/google/re2/wiki/Syntax). When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The default value is "(.*)" to match everything. - Must be between 1 and 1000 characters in length when specified. - maxLength: 1000 + Must be between 1 and 8192 characters in length when specified. + maxLength: 8192 minLength: 1 type: string separator: