Skip to content

Commit e07e600

Browse files
Merge pull request #928 from Nordix/lentzi90/prow-kube-prometheus
Prow monitoring through kube-prometheus
2 parents 60e7e8f + 204a910 commit e07e600

File tree

99 files changed

+96199
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+96199
-8
lines changed

.cspell-config.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
"version": "0.2",
33
"language": "en",
4-
"ignorePaths": [
5-
"**/.github/workflows/**"
6-
],
4+
"ignorePaths": ["**/.github/workflows/**"],
75
"patterns": [
86
{
97
"name": "multiline-code-block",
@@ -14,10 +12,7 @@
1412
"pattern": "/`[^`].*`[^`]/g"
1513
}
1614
],
17-
"ignoreRegExpList": [
18-
"multiline-code-block",
19-
"inline-code"
20-
],
15+
"ignoreRegExpList": ["multiline-code-block", "inline-code"],
2116
"words": [
2217
"autoscaler",
2318
"baremetal",
@@ -35,6 +30,7 @@
3530
"ghprb",
3631
"HMAC",
3732
"ipam",
33+
"jsonnet",
3834
"keypair",
3935
"kubeadm",
4036
"kubeadmcontrolplane",

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,12 @@
33
*.tmp
44
.DS_Store
55
*.swp
6+
7+
# Development containers
8+
.devcontainer
9+
10+
# Zed
11+
.zed
12+
.zed_server
13+
14+
vendor

prow/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ avoid deleting it even if the Service is deleted. See
111111
[cert-manager](https://cert-manager.io/) and the Let's Encrypt HTTP01 challenge,
112112
as seen in [infra/cluster-issuer-http.yaml](infra/cluster-issuer-http.yaml).
113113

114+
#### Monitoring
115+
116+
Please see [infra/kube-prometheus](infra/kube-prometheus).
117+
114118
## Building node images
115119

116120
The Kubernetes cluster where Prow runs needs pre-built images for the Nodes. We

prow/capo-cluster/openstackcluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
remoteManagedGroups:
3333
- controlplane
3434
- worker
35-
allowAllInClusterTraffic: false
35+
allowAllInClusterTraffic: true
3636
managedSubnets:
3737
- cidr: 10.6.0.0/24
3838
dnsNameservers:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export CONTAINER_RUNTIME ?= docker
2+
3+
.phony: build
4+
5+
build:
6+
$(CONTAINER_RUNTIME) run --rm \
7+
--volume "${PWD}:/workdir:rw,z" \
8+
--workdir /workdir \
9+
--entrypoint /workdir/build.sh \
10+
docker.io/golang:1.23 \
11+
metal3-kube-prometheus.jsonnet
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Kube-prometheus for Metal3 Prow
2+
3+
This monitoring stack is based on
4+
[kube-prometheus](https://github.com/prometheus-operator/kube-prometheus/tree/main).
5+
We also took inspiration from how [k8s.io is monitoring
6+
ProwJobs](https://github.com/kubernetes/k8s.io/pull/5355).
7+
8+
This is how you apply it in the cluster:
9+
10+
```bash
11+
kubectl apply -f manifests/setup
12+
kubectl apply -f manifests
13+
kubectl apply -f prow-rules.yaml
14+
```
15+
16+
The `manifests` are rendered using jsonnet based on
17+
`metal3-kube-prometheus.jsonnet`. Use the build script to render them after
18+
making changes:
19+
20+
```bash
21+
make build
22+
```
23+
24+
## How to access?
25+
26+
For now, we have not exposed grafana or any other component. You can access them
27+
by using port-forward like this (after setting up access to the cluster itself):
28+
29+
```bash
30+
kubectl -n monitoring port-forward svc/grafana 3000
31+
```
32+
33+
Then go to <localhost:3000>.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# Based on https://github.com/prometheus-operator/kube-prometheus/blob/17aa6690a5739183c68efa048439739dce773827/build.sh
4+
# This script uses arg $1 (name of *.jsonnet file to use) to generate the manifests/*.yaml files.
5+
6+
set -e
7+
set -x
8+
# only exit with zero if all commands of the pipeline exit successfully
9+
set -o pipefail
10+
11+
# Make sure to use project tooling
12+
PATH="$(pwd)/tmp/bin:${PATH}"
13+
14+
# Install needed tools
15+
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected]
16+
go install github.com/google/go-jsonnet/cmd/[email protected]
17+
go install github.com/brancz/[email protected]
18+
19+
20+
# Make sure to start with a clean 'manifests' dir
21+
rm -rf manifests
22+
mkdir -p manifests/setup
23+
24+
# Calling gojsontoyaml is optional, but we would like to generate yaml, not json
25+
jsonnet -J vendor -m manifests "${1-example.jsonnet}" | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml' -- {}
26+
27+
# Make sure to remove json files
28+
find manifests -type f ! -name '*.yaml' -delete
29+
rm -f kustomization

0 commit comments

Comments
 (0)