Skip to content

Commit

Permalink
Merge pull request #9 from robertgmoss/gcp
Browse files Browse the repository at this point in the history
add support for gcp
  • Loading branch information
robertgmoss authored Aug 14, 2023
2 parents cfc612a + e4f1314 commit aa95579
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 59 deletions.
44 changes: 43 additions & 1 deletion charts/continuous-load/charts/k6/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.global.promOperator "coreos" -}}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
Expand Down Expand Up @@ -48,4 +49,45 @@ spec:
regex: (.*)
targetLabel: node_ip
replacement: $1
action: replace
action: replace
{{- end -}}
{{- if eq .Values.global.promOperator "googleapis" -}}
---
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
name: k6
labels:
app: k6
spec:
selector:
matchExpressions:
- key: "app.kubernetes.io/name"
operator: In
values: ["k6"]
endpoints:
- path: /metrics
port: http
metricRelabeling:
- sourceLabels: [__meta_kubernetes_pod_ready]
action: keep
regex: "true"
- sourceLabels: [__meta_kubernetes_pod_name]
separator: ;
regex: (.*)
targetLabel: pod_name
replacement: $1
action: replace
- sourceLabels: [__meta_kubernetes_pod_node_name]
separator: ;
regex: (.*)
targetLabel: node_name
replacement: $1
action: replace
- sourceLabels: [__meta_kubernetes_pod_host_ip]
separator: ;
regex: (.*)
targetLabel: node_ip
replacement: $1
action: replace
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if eq .Values.promOperator "coreos" -}}
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
Expand Down Expand Up @@ -97,4 +99,4 @@ spec:
Memory usage percentage: `{{`{{`}} $value | humanize {{`}}`}}`
Expected <= 90% for 1m
summary: The container is using more memory than expected.
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.dashboard.enabled -}}
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
Expand All @@ -7,7 +8,7 @@ spec:
resyncPeriod: 5m
instanceSelector:
matchLabels:
dashboards: "grafana"
dashboards: {{ .Values.grafanaInstanceLabel }}
json: >-
{
"annotations": {
Expand Down Expand Up @@ -588,10 +589,10 @@ spec:
{
"editorMode": "code",
"exemplar": false,
"expr": "sum by(name, status) (rate(k6_http_reqs{\n namespace=\"continuous-load\"\n}[$__rate_interval])) > 0",
"expr": "sum by(name, status) (rate(k6_http_reqs{\n namespace=\"{{ .Release.Namespace }}\"\n}[$__rate_interval])) > 0",
"hide": false,
"interval": "",
"legendFormat": "Response {{ status }}",
"legendFormat": "Response {{`{{ status }}`}}",
"queryType": "randomWalk",
"range": true,
"refId": "A"
Expand Down Expand Up @@ -684,10 +685,10 @@ spec:
{
"editorMode": "code",
"exemplar": false,
"expr": "sum(rate(k6_http_reqs{status=\"200\", namespace=\"continuous-load\"}[${timespan}]))/sum(rate(k6_http_reqs{namespace=\"continuous-load\"}[${timespan}])) * 100",
"expr": "sum(rate(k6_http_reqs{status=\"200\", namespace=\"{{ .Release.Namespace }}\"}[${timespan}]))/sum(rate(k6_http_reqs{namespace=\"{{ .Release.Namespace }}\"}[${timespan}])) * 100",
"hide": false,
"interval": "",
"legendFormat": "{{value }}",
"legendFormat": "{{`{{ value }}`}}",
"queryType": "randomWalk",
"range": true,
"refId": "A"
Expand Down Expand Up @@ -779,7 +780,7 @@ spec:
{
"editorMode": "code",
"exemplar": false,
"expr": "histogram_quantile(0.95, \nsum(rate(k6_http_req_duration_bucket{namespace=\"continuous-load\"}[${timespan}]))by (le))",
"expr": "histogram_quantile(0.95, \nsum(rate(k6_http_req_duration_bucket{namespace=\"{{ .Release.Namespace }}\"}[${timespan}]))by (le))",
"hide": false,
"interval": "",
"legendFormat": "P95",
Expand All @@ -790,7 +791,7 @@ spec:
{
"editorMode": "code",
"exemplar": false,
"expr": "histogram_quantile(0.80, \nsum(rate(k6_http_req_duration_bucket{namespace=\"continuous-load\"}[${timespan}]))by (le))",
"expr": "histogram_quantile(0.80, \nsum(rate(k6_http_req_duration_bucket{namespace=\"{{ .Release.Namespace }}\"}[${timespan}]))by (le))",
"hide": false,
"interval": "",
"legendFormat": "P80",
Expand All @@ -800,15 +801,15 @@ spec:
},
{
"editorMode": "code",
"expr": "histogram_quantile(0.50, \nsum(rate(k6_http_req_duration_bucket{namespace=\"continuous-load\"}[${timespan}]))by (le))",
"expr": "histogram_quantile(0.50, \nsum(rate(k6_http_req_duration_bucket{namespace=\"{{ .Release.Namespace }}\"}[${timespan}]))by (le))",
"hide": false,
"legendFormat": "P50",
"range": true,
"refId": "D"
},
{
"editorMode": "code",
"expr": "histogram_quantile(0.10, \nsum(rate(k6_http_req_duration_bucket{namespace=\"continuous-load\"}[${timespan}]))by (le))",
"expr": "histogram_quantile(0.10, \nsum(rate(k6_http_req_duration_bucket{namespace=\"{{ .Release.Namespace }}\"}[${timespan}]))by (le))",
"hide": false,
"legendFormat": "P10",
"range": true,
Expand Down Expand Up @@ -901,7 +902,7 @@ spec:
{
"editorMode": "code",
"exemplar": false,
"expr": "histogram_quantile(0.99, \nsum(rate(k6_http_req_duration_bucket{namespace=\"continuous-load\"}[${timespan}]))by (le))",
"expr": "histogram_quantile(0.99, \nsum(rate(k6_http_req_duration_bucket{namespace=\"{{ .Release.Namespace }}\"}[${timespan}]))by (le))",
"hide": false,
"interval": "",
"legendFormat": "P99",
Expand Down Expand Up @@ -1009,18 +1010,18 @@ spec:
{
"editorMode": "code",
"exemplar": false,
"expr": "sum by(path, method, status) (rate(http_request_duration_seconds_count{\n namespace=\"continuous-load\", path=\"status\"\n}[$__rate_interval])) > 0",
"expr": "sum by(path, method, status) (rate(http_request_duration_seconds_count{\n namespace=\"{{ .Release.Namespace }}\", path=\"status\"\n}[$__rate_interval])) > 0",
"hide": false,
"interval": "",
"legendFormat": "Response {{ status }}",
"legendFormat": "Response {{`{{ status }}`}}",
"queryType": "randomWalk",
"range": true,
"refId": "A"
},
{
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(http_request_duration_seconds_count{namespace=\"continuous-load\", path=\"status\"}[$__rate_interval]))",
"expr": "sum(rate(http_request_duration_seconds_count{namespace=\"{{ .Release.Namespace }}\", path=\"status\"}[$__rate_interval]))",
"hide": false,
"interval": "",
"legendFormat": "TOTAL",
Expand Down Expand Up @@ -1115,10 +1116,10 @@ spec:
{
"editorMode": "code",
"exemplar": false,
"expr": "sum by (path, method)(rate(http_request_duration_seconds_count{status=\"200\", namespace=\"continuous-load\", path=\"status\"}[${timespan}]))/sum by (path, method)(rate(http_request_duration_seconds_count{namespace=\"continuous-load\", path=\"status\"}[${timespan}])) * 100",
"expr": "sum by (path, method)(rate(http_request_duration_seconds_count{status=\"200\", namespace=\"{{ .Release.Namespace }}\", path=\"status\"}[${timespan}]))/sum by (path, method)(rate(http_request_duration_seconds_count{namespace=\"{{ .Release.Namespace }}\", path=\"status\"}[${timespan}])) * 100",
"hide": false,
"interval": "",
"legendFormat": "Path: {{path}}",
"legendFormat": "Path: {{`{{ path }}`}}",
"queryType": "randomWalk",
"range": true,
"refId": "A"
Expand Down Expand Up @@ -1209,37 +1210,37 @@ spec:
"targets": [
{
"exemplar": false,
"expr": "histogram_quantile(0.95, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"continuous-load\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"expr": "histogram_quantile(0.95, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"{{ .Release.Namespace }}\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"hide": false,
"interval": "",
"legendFormat": "P95 Path: {{path}} Status: {{status}}",
"legendFormat": "P95 Path: {{`{{ path }}`}} Status: {{`{{ status }}`}}",
"queryType": "randomWalk",
"refId": "B"
},
{
"exemplar": false,
"expr": "histogram_quantile(0.80, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"continuous-load\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"expr": "histogram_quantile(0.80, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"{{ .Release.Namespace }}\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"hide": false,
"interval": "",
"legendFormat": "P80 Path: {{path}} Status: {{status}}",
"legendFormat": "P80 Path: {{`{{ path }}`}} Status: {{`{{ status }}`}}",
"queryType": "randomWalk",
"refId": "C"
},
{
"exemplar": false,
"expr": "histogram_quantile(0.50, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"continuous-load\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"expr": "histogram_quantile(0.50, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"{{ .Release.Namespace }}\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"hide": false,
"interval": "",
"legendFormat": "P50 Path: {{path}} Status: {{status}}",
"legendFormat": "P50 Path: {{`{{ path }}`}} Status: {{`{{ status }}`}}",
"queryType": "randomWalk",
"refId": "D"
},
{
"exemplar": false,
"expr": "histogram_quantile(0.10, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"continuous-load\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"expr": "histogram_quantile(0.10, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"{{ .Release.Namespace }}\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"hide": false,
"interval": "",
"legendFormat": "P10 Path: {{path}} Status: {{status}}",
"legendFormat": "P10 Path: {{`{{ path }}`}} Status: {{`{{ status }}`}}",
"queryType": "randomWalk",
"refId": "E"
}
Expand Down Expand Up @@ -1329,10 +1330,10 @@ spec:
"targets": [
{
"exemplar": false,
"expr": "histogram_quantile(0.99, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"continuous-load\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"expr": "histogram_quantile(0.99, \nsum(rate(http_request_duration_seconds_bucket{namespace=\"{{ .Release.Namespace }}\", path=\"status\"}[${timespan}])) by (le, path, method, status))",
"hide": false,
"interval": "",
"legendFormat": "P99 Path: {{path}} Status: {{status}}",
"legendFormat": "P99 Path: {{`{{ path }}`}} Status: {{`{{ status }}`}}",
"queryType": "randomWalk",
"refId": "A"
}
Expand Down Expand Up @@ -1454,4 +1455,5 @@ spec:
"uid": "zDpLnqaMz",
"version": 3,
"weekStart": ""
}
}
{{- end -}}
20 changes: 19 additions & 1 deletion charts/continuous-load/templates/pod-monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.global.promOperator "coreos" -}}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
Expand All @@ -12,4 +13,21 @@ spec:
- port: http
namespaceSelector:
matchNames:
- {{.Release.Namespace}}
- {{.Release.Namespace}}
{{- end -}}
{{- if eq .Values.global.promOperator "googleapis" -}}
---
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
name: k6-podmonitor
labels:
release: prometheus
namespace: {{.Release.Namespace}}
spec:
selector:
matchLabels:
app.kubernetes.io/name: k6
endpoints:
- port: http
{{- end -}}
24 changes: 23 additions & 1 deletion charts/continuous-load/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if eq .Values.global.promOperator "coreos" -}}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand All @@ -24,4 +26,24 @@ spec:
scheme: https
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecureSkipVerify: true
insecureSkipVerify: true
{{- end -}}
{{- if eq .Values.global.promOperator "googleapis" -}}
---
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
name: servicemonitor
labels:
release: prometheus
namespace: {{.Release.Namespace}}
spec:
selector:
matchExpressions:
- {key: app.kubernetes.io/name, operator: Exists}
endpoints:
- port: http
interval: 15s
- port: https
interval: 15s
{{- end -}}
10 changes: 10 additions & 0 deletions charts/continuous-load/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
global:
# -- Configure the Prometheus operator to use. Valid values are "coreos", "googleapis", "none"
promOperator: coreos

# -- Configure the grafana instance that the dashboard will be deploy to
grafanaInstanceLabel: grafana

dashboard:
enabled: true

podinfo:
# -- Configure the number of replicas of the target service
replicaCount: "2"
Expand Down
Loading

0 comments on commit aa95579

Please sign in to comment.