Skip to content

Commit

Permalink
mark podmonitors as experimental; fix relabeling
Browse files Browse the repository at this point in the history
  • Loading branch information
auhlig committed Jun 11, 2019
1 parent 09eaef8 commit 86ed2d1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Documentation/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ PrometheusSpec is a specification of the desired behavior of the Prometheus clus
| podMetadata | Standard object’s metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata Metadata Labels and Annotations gets propagated to the prometheus pods. | *[metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#objectmeta-v1-meta) | false |
| serviceMonitorSelector | ServiceMonitors to be selected for target discovery. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#labelselector-v1-meta) | false |
| serviceMonitorNamespaceSelector | Namespaces to be selected for ServiceMonitor discovery. If nil, only check own namespace. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#labelselector-v1-meta) | false |
| podMonitorSelector | PodMonitors to be selected for target discovery. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#labelselector-v1-meta) | false |
| podMonitorSelector | *Experimental* PodMonitors to be selected for target discovery. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#labelselector-v1-meta) | false |
| podMonitorNamespaceSelector | Namespaces to be selected for PodMonitor discovery. If nil, only check own namespace. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#labelselector-v1-meta) | false |
| version | Version of Prometheus to be deployed. | string | false |
| tag | Tag of Prometheus container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set. | string | false |
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/monitoring/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type PrometheusSpec struct {
// Namespaces to be selected for ServiceMonitor discovery. If nil, only
// check own namespace.
ServiceMonitorNamespaceSelector *metav1.LabelSelector `json:"serviceMonitorNamespaceSelector,omitempty"`
// PodMonitors to be selected for target discovery.
// *Experimental* PodMonitors to be selected for target discovery.
PodMonitorSelector *metav1.LabelSelector `json:"podMonitorSelector,omitempty"`
// Namespaces to be selected for PodMonitor discovery. If nil, only
// check own namespace.
Expand Down
12 changes: 0 additions & 12 deletions pkg/prometheus/promcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,6 @@ func (cg *configGenerator) generatePodMonitorConfig(version semver.Version, m *v

// Relabel namespace and pod and service labels into proper labels.
relabelings = append(relabelings, []yaml.MapSlice{
{
{Key: "source_labels", Value: []string{"__meta_kubernetes_pod_node_name"}},
{Key: "target_label", Value: "node"},
},
{
{Key: "source_labels", Value: []string{"__meta_kubernetes_namespace"}},
{Key: "target_label", Value: "namespace"},
Expand All @@ -459,14 +455,6 @@ func (cg *configGenerator) generatePodMonitorConfig(version semver.Version, m *v
{Key: "source_labels", Value: []string{"__meta_kubernetes_pod_name"}},
{Key: "target_label", Value: "pod"},
},
{
{Key: "source_labels", Value: []string{"__meta_kubernetes_pod_phase"}},
{Key: "target_label", Value: "pod_phase"},
},
{
{Key: "source_labels", Value: []string{"__meta_kubernetes_pod_ready"}},
{Key: "target_label", Value: "pod_ready"},
},
}...)

// Relabel targetLabels from Pod onto target.
Expand Down

0 comments on commit 86ed2d1

Please sign in to comment.