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
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
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
Expand Down
4 changes: 2 additions & 2 deletions config/v1alpha1/types_cluster_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Out of scope of this PR, but it would be nice to have some validation around RE2, since this just allows any string. I assume the consumer of this API does that already, though

// +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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion config/v1alpha1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down