Skip to content

Commit

Permalink
Add the ability to specify extra queries for the test job (#197)
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall authored Oct 20, 2023
1 parent 7ea9a30 commit 3fde507
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/configs/loki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ monitoring:
enabled: false
grafanaAgent:
installOperator: false
serviceMonitor:
enabled: false
3 changes: 2 additions & 1 deletion charts/k8s-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ The Prometheus and Loki services may be hosted on the same cluster, or remotely
| prometheus-operator-crds.enabled | bool | `true` | Should this helm chart deploy the Prometheus Operator CRDs to the cluster. Set this to false if your cluster already has the CRDs, or if you do not to have the Grafana Agent scrape metrics from PodMonitors, Probes, or ServiceMonitors. |
| prometheus-windows-exporter.config | string | `"collectors:\n enabled: cpu,cs,container,logical_disk,memory,net,os\ncollector:\n service:\n services-where: \"Name='containerd' or Name='kubelet'\""` | |
| prometheus-windows-exporter.enabled | bool | `false` | Should this helm chart deploy Windows Exporter to the cluster. Set this to false if your cluster already has Windows Exporter, or if you do not want to scrape metrics from Windows Exporter. |
| test.extraQueries | list | `[]` | Additional queries that will be run with `helm test`. Example: extraQueries: - query: prometheus_metric{cluster="my-cluster-name"} |
| test.image.image | string | `"ubuntu"` | Test job image repository |
| test.image.registry | string | `"docker.io"` | Test job image registry |
| test.image.tag | string | `"latest"` | Test job image tag |
| test.image.tag | string | `"jammy"` | Test job image tag |
| traces.enabled | bool | `false` | Receive and forward traces. |
| traces.processors.batch.size | int | `16384` | What batch size to use, in bytes |
| traces.processors.batch.timeout | string | `"2s"` | How long before sending |
Expand Down
4 changes: 4 additions & 0 deletions charts/k8s-monitoring/ci/ci-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ externalServices:
username: loki
password: lokipassword

test:
extraQueries:
- query: kube_deployment_spec_replicas{cluster="ci-test-cluster"}

opencost:
prometheus:
external:
Expand Down
5 changes: 5 additions & 0 deletions charts/k8s-monitoring/templates/tests/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ queries:
{{- if .Values.metrics.kubernetesMonitoring.enabled }}
- query: grafana_kubernetes_monitoring_build_info{cluster={{ .Values.cluster.name | quote}}}
{{- end }}
{{- if .Values.test.extraQueries }}
{{- range .Values.test.extraQueries }}
- query: {{ .query }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}

Expand Down
8 changes: 7 additions & 1 deletion charts/k8s-monitoring/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,19 @@ extraConfig:

# Settings for the test job, runnable by "helm test"
test:
# -- Additional queries that will be run with `helm test`.
# Example:
# extraQueries:
# - query: prometheus_metric{cluster="my-cluster-name"}
extraQueries: []

image:
# -- Test job image registry
registry: docker.io
# -- Test job image repository
image: ubuntu
# -- Test job image tag
tag: latest
tag: jammy

# Settings for the Kube State Metrics deployment
# You can use this sections to make modifications to the Kube State Metrics deployment.
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-allow-lists/output.yaml

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

2 changes: 1 addition & 1 deletion examples/custom-config/output.yaml

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

2 changes: 1 addition & 1 deletion examples/default-values/output.yaml

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

2 changes: 1 addition & 1 deletion examples/extra-rules/output.yaml

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

2 changes: 1 addition & 1 deletion examples/gke-autopilot/output.yaml

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

2 changes: 1 addition & 1 deletion examples/logs-only/output.yaml

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

2 changes: 1 addition & 1 deletion examples/metrics-only/output.yaml

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

2 changes: 1 addition & 1 deletion examples/openshift-compatible/output.yaml

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

2 changes: 1 addition & 1 deletion examples/private-image-registry/output.yaml

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

2 changes: 1 addition & 1 deletion examples/scrape-intervals/output.yaml

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

2 changes: 1 addition & 1 deletion examples/specific-namespace/output.yaml

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

2 changes: 1 addition & 1 deletion examples/traces-enabled/output.yaml

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

2 changes: 1 addition & 1 deletion examples/windows-exporter/output.yaml

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

0 comments on commit 3fde507

Please sign in to comment.