Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apis/hive/v1/metricsconfig/metrics_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ type MetricsConfig struct {
// pkg/controller/metrics/metrics_with_dynamic_labels.go
// +optional
AdditionalClusterDeploymentLabels *map[string]string `json:"additionalClusterDeploymentLabels,omitempty"`
MetricsToReport []MetricsToReport `json:"metricsToReport,omitempty"`
}
15 changes: 15 additions & 0 deletions apis/hive/v1/metricsconfig/metrics_to_report.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package metricsconfig

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// MetricsToReport represents metrics that have additional customizations
type MetricsToReport struct {
// MetricNames is a list of metrics for which the following customizations must be added, if they support the customization
// The name of the metric here must be valid, and it can only be present once in metricsToReport.
MetricNames []string `json:"metricNames"`
// ClusterDeploymentLabelSelector can be used to match cluster deployment label present, it can be used to filter the metrics reported.
// It can only be used with metrics that have their clusterdeployment at hand when they are being reported.
ClusterDeploymentLabelSelector metav1.LabelSelector `json:"clusterDeploymentLabelSelector"`
}
29 changes: 29 additions & 0 deletions apis/hive/v1/metricsconfig/zz_generated.deepcopy.go

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

66 changes: 66 additions & 0 deletions config/crds/hive.openshift.io_hiveconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,72 @@ spec:
Affected metrics are those whose type implements the metricsWithDynamicLabels interface found in
pkg/controller/metrics/metrics_with_dynamic_labels.go
type: object
metricsToReport:
items:
description: MetricsToReport represents metrics that have additional
customizations
properties:
clusterDeploymentLabelSelector:
description: |-
ClusterDeploymentLabelSelector can be used to match cluster deployment label present, it can be used to filter the metrics reported.
It can only be used with metrics that have their clusterdeployment at hand when they are being reported.
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
metricNames:
description: "\tMetricNames is a list of metrics for which
the following customizations must be added, if they support
the customization\nThe name of the metric here must be
valid, and it can only be present once in metricsToReport."
items:
type: string
type: array
required:
- clusterDeploymentLabelSelector
- metricNames
type: object
type: array
metricsWithDuration:
description: Optional metrics and their configurations
items:
Expand Down
Loading