Skip to content
This repository has been archived by the owner on Jun 12, 2020. It is now read-only.

Commit

Permalink
fix: corrected service-monitor definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
stebenz committed Jan 8, 2020
1 parent 5270dec commit e85baef
Showing 1 changed file with 76 additions and 16 deletions.
92 changes: 76 additions & 16 deletions internal/app/v1beta1/crd/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (c *Crd) ScrapeMetricsCrdsConfig(toolsetCRDSpec *toolsetsv1beta1.ToolsetSpe
Port: "ambassador-admin",
Path: "/metrics",
}
labels := map[string]string{"service": "ambassador-admin"}
labels := map[string]string{"app.kubernetes.io/name": "ambassador"}

smconfig := &servicemonitor.Config{
Name: "ambassador-servicemonitor",
Expand All @@ -31,21 +31,21 @@ func (c *Crd) ScrapeMetricsCrdsConfig(toolsetCRDSpec *toolsetsv1beta1.ToolsetSpe
servicemonitors = append(servicemonitors, smconfig)
}

if toolsetCRDSpec.CertManager != nil && toolsetCRDSpec.CertManager.Deploy {
endpoint := &servicemonitor.ConfigEndpoint{
TargetPort: "9402",
Path: "/metrics",
}
labels := map[string]string{"app": "cert-manager"}

smconfig := &servicemonitor.Config{
Name: "cert-manager-servicemonitor",
Endpoints: []*servicemonitor.ConfigEndpoint{endpoint},
MonitorMatchingLabels: monitorlabels,
ServiceMatchingLabels: labels,
}
servicemonitors = append(servicemonitors, smconfig)
}
// if toolsetCRDSpec.CertManager != nil && toolsetCRDSpec.CertManager.Deploy {
// endpoint := &servicemonitor.ConfigEndpoint{
// TargetPort: "http",
// Path: "/metrics",
// }
// labels := map[string]string{"app": "cert-manager"}

// smconfig := &servicemonitor.Config{
// Name: "cert-manager-servicemonitor",
// Endpoints: []*servicemonitor.ConfigEndpoint{endpoint},
// MonitorMatchingLabels: monitorlabels,
// ServiceMatchingLabels: labels,
// }
// servicemonitors = append(servicemonitors, smconfig)
// }

if toolsetCRDSpec.PrometheusOperator != nil && toolsetCRDSpec.PrometheusOperator.Deploy {
endpoint := &servicemonitor.ConfigEndpoint{
Expand Down Expand Up @@ -121,6 +121,66 @@ func (c *Crd) ScrapeMetricsCrdsConfig(toolsetCRDSpec *toolsetsv1beta1.ToolsetSpe
servicemonitors = append(servicemonitors, smconfig)
}

if toolsetCRDSpec.Argocd != nil && toolsetCRDSpec.Argocd.Deploy {
//argocd-application-controller
endpoint := &servicemonitor.ConfigEndpoint{
Port: "metrics",
Path: "/metrics",
}

labels := map[string]string{
"app.kubernetes.io/part-of": "argocd",
"app.kubernetes.io/component": "application-controller",
}

smconfig := &servicemonitor.Config{
Name: "application-controller-servicemonitor",
Endpoints: []*servicemonitor.ConfigEndpoint{endpoint},
MonitorMatchingLabels: monitorlabels,
ServiceMatchingLabels: labels,
JobName: "application-controller",
}
servicemonitors = append(servicemonitors, smconfig)
// argocd-repo-server
endpoint = &servicemonitor.ConfigEndpoint{
Port: "metrics",
Path: "/metrics",
}

labels = map[string]string{
"app.kubernetes.io/part-of": "argocd",
"app.kubernetes.io/component": "repo-server",
}

smconfig = &servicemonitor.Config{
Name: "argocd-repo-server-servicemonitor",
Endpoints: []*servicemonitor.ConfigEndpoint{endpoint},
MonitorMatchingLabels: monitorlabels,
ServiceMatchingLabels: labels,
JobName: "argocd-repo-server",
}
servicemonitors = append(servicemonitors, smconfig)
// argocd-server
endpoint = &servicemonitor.ConfigEndpoint{
Port: "metrics",
Path: "/metrics",
}

labels = map[string]string{
"app.kubernetes.io/part-of": "argocd",
"app.kubernetes.io/component": "server",
}

smconfig = &servicemonitor.Config{
Name: "argocd-server-servicemonitor",
Endpoints: []*servicemonitor.ConfigEndpoint{endpoint},
MonitorMatchingLabels: monitorlabels,
ServiceMatchingLabels: labels,
JobName: "argocd-server",
}
servicemonitors = append(servicemonitors, smconfig)
}

adconfigs := make([]*prometheus.AdditionalScrapeConfig, 0)
//Metrics from the kubernetes service
smconfig := getAPIServers(monitorlabels)
Expand Down

0 comments on commit e85baef

Please sign in to comment.