Skip to content

Commit

Permalink
Add relabelling to ServiceMonitors for CDC metrics. (#807)
Browse files Browse the repository at this point in the history
* Add relabelling to ServiceMonitors for CDC metrics.
  • Loading branch information
Miles-Garnsey authored Jan 11, 2023
1 parent 5e31067 commit e844ef1
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 56 deletions.
108 changes: 54 additions & 54 deletions .github/workflows/kuttl_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ on:
push:
branches:
- main
- 'release/**'
- "release/**"
paths-ignore:
- 'docs/**'
- 'CHANGELOG/**'
- "docs/**"
- "CHANGELOG/**"
pull_request:
branches:
- main
- 'release/**'
- "release/**"
paths-ignore:
- 'docs/**'
- 'CHANGELOG/**'
- "docs/**"
- "CHANGELOG/**"

jobs:
build_image:
Expand Down Expand Up @@ -72,53 +72,53 @@ jobs:
matrix:
k8s_version: ["1.21"]
kuttl-test:
- test-servicemonitors
- test-user-defined-ns
- test-all-deployments
- test-servicemonitors
- test-user-defined-ns
- test-all-deployments
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v2
if: github.event_name != 'pull_request'
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: Kind kube-proxy issue workaround
run: sudo sysctl net/netfilter/nf_conntrack_max=524288
- name: Download k8ssandra-operator image
uses: actions/download-artifact@v2
with:
name: k8ssandra-operator
path: /tmp
- name: Load Docker images
run: |
docker load --input /tmp/k8ssandra-k8ssandra-operator.tar
- name: Install kustomize
uses: imranismail/setup-kustomize@v2
- name: Install kuttl
run: |
make install-kuttl
- name: Create kind cluster
run: |
kind create cluster --name k8ssandra-0 --config ./test/kuttl/config/kind/w3k${{ matrix.k8s_version }}.yaml
make cert-manager
make IMG="k8ssandra/k8ssandra-operator:${{ needs.build_image.outputs.image_tag }}" kind-load-image
- name: Run kuttl test
run: |
# We are running tests against k8s 1.21
# Additional versions must be added in kind config files under ./test/config/kind
- name: Check out code into the Go module directory
uses: actions/checkout@v2
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v2
if: github.event_name != 'pull_request'
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true
- name: Kind kube-proxy issue workaround
run: sudo sysctl net/netfilter/nf_conntrack_max=524288
- name: Download k8ssandra-operator image
uses: actions/download-artifact@v2
with:
name: k8ssandra-operator
path: /tmp
- name: Load Docker images
run: |
docker load --input /tmp/k8ssandra-k8ssandra-operator.tar
- name: Install kustomize
uses: imranismail/setup-kustomize@v2
- name: Install kuttl
run: |
make install-kuttl
- name: Create kind cluster
run: |
kind create cluster --name k8ssandra-0 --config ./test/kuttl/config/kind/w3k${{ matrix.k8s_version }}.yaml
make cert-manager
make IMG="k8ssandra/k8ssandra-operator:${{ needs.build_image.outputs.image_tag }}" kind-load-image
- name: Run kuttl test
run: |
# We are running tests against k8s 1.21
# Additional versions must be added in kind config files under ./test/config/kind
# Currently we aren't using the kuttl-test Makefile target while trying to iron out the
# release process. The following changes have been made to stay as close as possible
# to the existing behavior with kuttl tests while supporting the ability to use a release
# image tag of the operator.
./bin/kubectl-kuttl test --kind-context=k8ssandra-0 --start-kind=false --test ${{ matrix.kuttl-test }}
- name: Delete kind cluster
run: |
kind delete cluster --name k8ssandra-0
# Currently we aren't using the kuttl-test Makefile target while trying to iron out the
# release process. The following changes have been made to stay as close as possible
# to the existing behavior with kuttl tests while supporting the ability to use a release
# image tag of the operator.
./bin/kubectl-kuttl test --kind-context=k8ssandra-0 --start-kind=false --test ${{ matrix.kuttl-test }}
- name: Delete kind cluster
run: |
kind delete cluster --name k8ssandra-0
2 changes: 2 additions & 0 deletions CHANGELOG/CHANGELOG-1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Changelog for the K8ssandra Operator, new PRs should update the `unreleased` sec
When cutting a new release, update the `unreleased` heading to the tag being generated and date, like `## vX.Y.Z - YYYY-MM-DD` and create a new placeholder section for `unreleased` entries.

## unreleased

* [FEATURE] [#807](https://github.com/k8ssandra/k8ssandra-operator/pull/807) Adds Prometheus ServiceMonitor relabelling configurations for the CDC agent. The Agent's metrics will now appear in Prometheus alongside Cassandra's.
* [BUGFIX] [#808](https://github.com/k8ssandra/k8ssandra-operator/pull/808) Ensure that commonLabels are propagated to Prometheus ServiceMonitor resources.

## v1.4.1 - 2022-01-04
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.10.0

cert-manager: ## Install cert-manager to the cluster
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/$(CERT_MANAGER_VERSION)/cert-manager.yaml
# Wait for cert-manager rollout to be fully done
# Wait for cert-manager rollout to be fully done
kubectl rollout status deployment cert-manager -n cert-manager
kubectl rollout status deployment cert-manager-cainjector -n cert-manager
kubectl rollout status deployment cert-manager-webhook -n cert-manager
Expand Down Expand Up @@ -468,7 +468,7 @@ kuttl-test: install-kuttl docker-build
./bin/kubectl-kuttl test --kind-context=k8ssandra-0 --start-kind=false --test test-user-defined-ns

# Install kuttl for e2e tests.
install-kuttl:
install-kuttl:
mkdir -p ./bin ; \
cd ./bin ; \
OS="$$(uname | tr '[:upper:]' '[:lower:]')" ; \
Expand Down
5 changes: 5 additions & 0 deletions pkg/telemetry/prom_cass_servicemonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ spec:
sourceLabels:
- mcac
targetLabel: __name__
- regex: org\.apache\.cassandra\.metrics\.cdc_agent\.(\w+)
replacement: mcac_cdc_agent_${1}
sourceLabels:
- mcac
targetLabel: __name__
- regex: com\.datastax\.bdp\.type\.performance_objects\.name\.cql_slow_log\.metrics\.queries_latency
replacement: mcac_cql_slow_log_query_latency
sourceLabels:
Expand Down

0 comments on commit e844ef1

Please sign in to comment.