Skip to content

Commit

Permalink
Add more docs, examples, and tests. (#765)
Browse files Browse the repository at this point in the history
* Add details to the test chart

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Fix profiling feature and add an integration test for it.

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Allow tenantids to be numbers

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Fix profiling and update cluster config to use custom clusters

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Fix test chart to actually check the result

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* More test fixes

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Remove settings that actually make it harder

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Fix cluster name

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* More test fixing

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Fixing tests

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* simplify the loki deployment to speed up tests

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* More work on loki chart

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Working on docuemntation and examples

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Get int tests working

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Massive docs and tests update

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Add helm repos

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Use GITHUB_OUTPUT instead of env

Signed-off-by: Pete Wall <pete.wall@grafana.com>

* Making linters even happier

Signed-off-by: Pete Wall <pete.wall@grafana.com>

---------

Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall authored Oct 5, 2024
1 parent d26e124 commit 0e8dce2
Show file tree
Hide file tree
Showing 147 changed files with 7,966 additions and 269 deletions.
90 changes: 19 additions & 71 deletions .configs/loki.yaml
Original file line number Diff line number Diff line change
@@ -1,93 +1,41 @@
---
deploymentMode: SingleBinary
loki:
commonConfig:
replication_factor: 1
storage:
type: 'filesystem'
schemaConfig:
configs:
- from: 2024-04-01
- from: "2024-01-01"
store: tsdb
object_store: s3
schema: v13
index:
prefix: loki_index_
period: 24h
ingester:
chunk_encoding: snappy
querier:
# Default is 4, if you have enough memory and CPU you can increase, reduce if OOMing
max_concurrent: 2

test:
enabled: false

lokiCanary:
enabled: false

gateway:
basicAuth:
enabled: true
username: loki
password: lokipassword
service:
port: 8080

deploymentMode: SingleBinary
object_store: filesystem # we're storing on filesystem so there's no real persistence here.
schema: v13
singleBinary:
replicas: 1
# resources:
# limits:
# cpu: 3
# memory: 4Gi
# requests:
# cpu: 2
# memory: 2Gi
# extraEnv:
# # Keep a little bit lower than memory limits
# - name: GOMEMLIMIT
# value: 3750MiB

# Enable minio for storage
minio:
enabled: true

# Zero out replica counts of other deployment modes
backend:
replicas: 0
read:
replicas: 0
backend:
replicas: 0
write:
replicas: 0

ingester:
replicas: 0
querier:
replicas: 0
queryFrontend:
replicas: 0
queryScheduler:
replicas: 0
distributor:
replicas: 0
compactor:
replicas: 0
indexGateway:
replicas: 0
bloomCompactor:
replicas: 0
bloomGateway:
replicas: 0
chunksCache:
enabled: false
resultsCache:
enabled: false
chunksCache:
lokiCanary:
enabled: false
test:
enabled: false

monitoring:
selfMonitoring:
enabled: false
grafanaAgent:
installOperator: false
serviceMonitor:
gateway:
basicAuth:
enabled: true
# This actually isn't recommended by Loki, the default is 15s for a reason, but we don't want to upset
# our DPM test calculations.
interval: 1m
username: loki
password: lokipassword
service:
port: 8080
21 changes: 20 additions & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,29 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@v4

- name: Check for cluster config
id: check-cluster-config
run: |
if [ -f "charts/k8s-monitoring/tests/integration/${{ matrix.test }}/cluster.yaml" ]; then
echo "has-cluster-config=true" >> "${GITHUB_OUTPUT}"
else
echo "has-cluster-config=false" >> "${GITHUB_OUTPUT}"
fi
- name: Create kind cluster
if: ${{ steps.check-cluster-config.outputs.has-cluster-config == 'false' }}
uses: helm/kind-action@v1

- name: Create kind cluster with special config
if: ${{ steps.check-cluster-config.outputs.has-cluster-config == 'true' }}
uses: helm/kind-action@v1
with:
config: charts/k8s-monitoring/tests/integration/${{ matrix.test }}/cluster.yaml

- name: Run test
env:
CREATE_CLUSTER: "false"
DEPLOY_GRAFANA: "false"
run: |
echo "Testing ${{ matrix.test }}"
CREATE_CLUSTER=false ./scripts/integration-test.sh "charts/k8s-monitoring/tests/integration/${{ matrix.test }}"
./scripts/integration-test.sh "charts/k8s-monitoring/tests/integration/${{ matrix.test }}"
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ build:

.PHONY: test
test: build
helm repo update
set -e && \
for chart in $(FEATURE_CHARTS); do \
make -C charts/$$chart test; \
Expand Down
2 changes: 2 additions & 0 deletions charts/feature-annotation-autodiscovery/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: v2
name: k8s-monitoring-feature-annotation-autodiscovery
description: Gathers metrics automatically based on Kubernetes Pod and Service annotations
icon: https://raw.githubusercontent.com/grafana/grafana/main/public/img/grafana_icon.svg
sources:
- https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-annotation-autodiscovery
version: 1.0.0
appVersion: 1.0.0
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion charts/feature-annotation-autodiscovery/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ build: README.md Chart.lock values.schema.json
.PHONY: test
test: build
helm lint .
ct lint --lint-conf ../../.configs/lintconf.yaml --check-version-increment=false --charts .
ct lint --lint-conf ../../.configs/lintconf.yaml --check-version-increment=false --helm-dependency-extra-args=--skip-refresh --charts .
ifdef HAS_HELM_UNITTEST
helm unittest .
else
Expand Down
29 changes: 25 additions & 4 deletions charts/feature-annotation-autodiscovery/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
<!--
(NOTE: Do not edit README.md directly. It is a generated file!)
( To make changes, please modify README.md.gotmpl and run `helm-docs`)
-->

# k8s-monitoring-feature-annotation-autodiscovery

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

Gathers metrics automatically based on Kubernetes Pod and Service annotations

The annotation-based autodiscovery feature makes it very simple to add scrape targets. With this feature enabled, any
Kubernetes Pods or Services with the `k8s.grafana.com/scrape` annotation set to `true` will be automatically discovered
and scraped by the collector. There are several other annotations that can be used to customize the behavior of the
scrape configuration, such as:

* `k8s.grafana.com/job`: The value to use for the `job` label.
* `k8s.grafana.com/instance`: The value to use for the `instance` label.
* `k8s.grafana.com/metrics.path`: The path to scrape for metrics. Defaults to `/metrics`.
* `k8s.grafana.com/metrics.portNumber`: The port on the Pod or Service to scrape for metrics. This is used to target a specific port by its number, rather than all ports.
* `k8s.grafana.com/metrics.portName`: The named port on the Pod or Service to scrape for metrics. This is used to target a specific port by its name, rather than all ports.
* `k8s.grafana.com/metrics.scheme`: The scheme to use when scraping metrics. Defaults to `http`.
* `k8s.grafana.com/metrics.scrapeInterval`: The scrape interval to use when scraping metrics. Defaults to `60s`.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| petewall | <pete.wall@grafana.com> | |
<!-- markdownlint-disable no-bare-urls -->
<!-- markdownlint-disable list-marker-space -->
## Source Code

* <https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-annotation-autodiscovery>
<!-- markdownlint-enable list-marker-space -->
<!-- markdownlint-enable no-bare-urls -->

## Values

Expand Down Expand Up @@ -60,6 +84,3 @@ Gathers metrics automatically based on Kubernetes Pod and Service annotations
|-----|------|---------|-------------|
| global.maxCacheSize | int | `100000` | Sets the max_cache_size for every prometheus.relabel component. ([docs](https://grafana.com/docs/alloy/latest/reference/components/prometheus.relabel/#arguments)) This should be at least 2x-5x your largest scrape target or samples appended rate. |
| global.scrapeInterval | string | `"60s"` | How frequently to scrape metrics. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
32 changes: 32 additions & 0 deletions charts/feature-annotation-autodiscovery/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
(NOTE: Do not edit README.md directly. It is a generated file!)
( To make changes, please modify README.md.gotmpl and run `helm-docs`)
-->

{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}
{{ template "chart.badgesSection" . }}
{{ template "chart.description" . }}
{{ template "chart.homepageLine" . }}

The annotation-based autodiscovery feature makes it very simple to add scrape targets. With this feature enabled, any
Kubernetes Pods or Services with the `k8s.grafana.com/scrape` annotation set to `true` will be automatically discovered
and scraped by the collector. There are several other annotations that can be used to customize the behavior of the
scrape configuration, such as:

* `k8s.grafana.com/job`: The value to use for the `job` label.
* `k8s.grafana.com/instance`: The value to use for the `instance` label.
* `k8s.grafana.com/metrics.path`: The path to scrape for metrics. Defaults to `/metrics`.
* `k8s.grafana.com/metrics.portNumber`: The port on the Pod or Service to scrape for metrics. This is used to target a specific port by its number, rather than all ports.
* `k8s.grafana.com/metrics.portName`: The named port on the Pod or Service to scrape for metrics. This is used to target a specific port by its name, rather than all ports.
* `k8s.grafana.com/metrics.scheme`: The scheme to use when scraping metrics. Defaults to `http`.
* `k8s.grafana.com/metrics.scrapeInterval`: The scrape interval to use when scraping metrics. Defaults to `60s`.

{{ template "chart.maintainersSection" . }}
<!-- markdownlint-disable no-bare-urls -->
<!-- markdownlint-disable list-marker-space -->
{{ template "chart.sourcesSection" . }}
<!-- markdownlint-enable list-marker-space -->
<!-- markdownlint-enable no-bare-urls -->
{{ template "chart.requirementsSection" . }}
{{ template "chart.valuesSection" . }}
2 changes: 2 additions & 0 deletions charts/feature-application-observability/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: v2
name: k8s-monitoring-feature-application-observability
description: Gathers application data
icon: https://raw.githubusercontent.com/grafana/grafana/main/public/img/grafana_icon.svg
sources:
- https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-application-observability
version: 1.0.0
appVersion: 1.0.0
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion charts/feature-application-observability/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ build: README.md Chart.lock values.schema.json
.PHONY: test
test: build
helm lint .
ct lint --lint-conf ../../.configs/lintconf.yaml --check-version-increment=false --charts .
ct lint --lint-conf ../../.configs/lintconf.yaml --check-version-increment=false --helm-dependency-extra-args=--skip-refresh --charts .
ifdef HAS_HELM_UNITTEST
helm unittest .
else
Expand Down
19 changes: 15 additions & 4 deletions charts/feature-application-observability/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
<!--
(NOTE: Do not edit README.md directly. It is a generated file!)
( To make changes, please modify README.md.gotmpl and run `helm-docs`)
-->

# k8s-monitoring-feature-application-observability

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

Gathers application data

The Application Observability feature enables the collection of application telemetry data. Enabling this feature
requires enabling one or more receivers where data will be sent from the application.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| petewall | <pete.wall@grafana.com> | |
<!-- markdownlint-disable no-bare-urls -->
<!-- markdownlint-disable list-marker-space -->
## Source Code

* <https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-application-observability>
<!-- markdownlint-enable list-marker-space -->
<!-- markdownlint-enable no-bare-urls -->

## Values

Expand Down Expand Up @@ -74,6 +88,3 @@ Gathers application data
| traces.enabled | bool | `true` | |
| traces.filters | object | `{"span":[],"spanevent":[]}` | Apply a filter to traces received via the OTLP or OTLP HTTP receivers. ([docs](https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.filter/)) |
| traces.transforms | object | `{"resource":[],"span":[],"spanevent":[]}` | Apply a transformation to traces received via the OTLP or OTLP HTTP receivers. ([docs](https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.transform/)) |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
22 changes: 22 additions & 0 deletions charts/feature-application-observability/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
(NOTE: Do not edit README.md directly. It is a generated file!)
( To make changes, please modify README.md.gotmpl and run `helm-docs`)
-->

{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}
{{ template "chart.badgesSection" . }}
{{ template "chart.description" . }}
{{ template "chart.homepageLine" . }}

The Application Observability feature enables the collection of application telemetry data. Enabling this feature
requires enabling one or more receivers where data will be sent from the application.

{{ template "chart.maintainersSection" . }}
<!-- markdownlint-disable no-bare-urls -->
<!-- markdownlint-disable list-marker-space -->
{{ template "chart.sourcesSection" . }}
<!-- markdownlint-enable list-marker-space -->
<!-- markdownlint-enable no-bare-urls -->
{{ template "chart.requirementsSection" . }}
{{ template "chart.valuesSection" . }}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{- $msg = append $msg " receivers:" }}
{{- $msg = append $msg " grpc:" }}
{{- $msg = append $msg " enabled: true" }}
{{- $msg = append $msg "See https://github.com/grafana/k8s-monitoring-helm/blob/main/charts/feature-application-observability for more details." }}
{{- $msg = append $msg "See https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-application-observability for more details." }}
{{- fail (join "\n" $msg) }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ tests:
receivers:
grpc:
enabled: true
See https://github.com/grafana/k8s-monitoring-helm/blob/main/charts/feature-application-observability for more details.
See https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-application-observability for more details.
2 changes: 2 additions & 0 deletions charts/feature-cluster-events/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: v2
name: k8s-monitoring-feature-cluster-events
description: Gathers Kubernetes Events
icon: https://raw.githubusercontent.com/grafana/grafana/main/public/img/grafana_icon.svg
sources:
- https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-cluster-events
version: 1.0.0
appVersion: 1.0.0
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion charts/feature-cluster-events/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ build: README.md Chart.lock values.schema.json
.PHONY: test
test: build
helm lint .
ct lint --lint-conf ../../.configs/lintconf.yaml --check-version-increment=false --charts .
ct lint --lint-conf ../../.configs/lintconf.yaml --check-version-increment=false --helm-dependency-extra-args=--skip-refresh --charts .
ifdef HAS_HELM_UNITTEST
helm unittest .
else
Expand Down
19 changes: 15 additions & 4 deletions charts/feature-cluster-events/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
<!--
(NOTE: Do not edit README.md directly. It is a generated file!)
( To make changes, please modify README.md.gotmpl and run `helm-docs`)
-->

# k8s-monitoring-feature-cluster-events

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

Gathers Kubernetes Events

The Cluster Events feature enables the collection of Kubernetes events from the cluster. Events are captured as logs and
are annotated with additional metadata to make them easier to search and filter.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| petewall | <pete.wall@grafana.com> | |
<!-- markdownlint-disable no-bare-urls -->
<!-- markdownlint-disable list-marker-space -->
## Source Code

* <https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/feature-cluster-events>
<!-- markdownlint-enable list-marker-space -->
<!-- markdownlint-enable no-bare-urls -->

## Values

Expand All @@ -31,6 +45,3 @@ Gathers Kubernetes Events
|-----|------|---------|-------------|
| logFormat | string | `"logfmt"` | Log format used to forward cluster events. Allowed values: `logfmt` (default), `json`. |
| namespaces | list | `[]` | List of namespaces to watch for events (`[]` means all namespaces) |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
Loading

0 comments on commit 0e8dce2

Please sign in to comment.