Skip to content

Commit 90da429

Browse files
committed
Add prometheus metrics installation and setup
* Refactor base install components into "core" kustomize component * Add metrics kustomize component which installs prometheus operator, server and configures Kafka metrics and console * Add core and metrics overlays * Update install/uninstall scripts and README with new layout and overlay options (via OVERLAY env var) Signed-off-by: Thomas Cooper <code@tomcooper.dev>
1 parent 184f6bf commit 90da429

44 files changed

Lines changed: 592 additions & 72 deletions

Some content is hidden

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

.github/workflows/validate.yaml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,33 @@ jobs:
1616
- name: Set up kubectl
1717
uses: azure/setup-kubectl@776406bce94f63e41d621b960d78ee25c8b76ede # v4.0.1
1818

19-
- name: Build base layer
20-
run: kubectl kustomize base/
19+
- name: Build core overlay base
20+
run: kubectl kustomize overlays/core/base/
2121

22-
- name: Build stack layer
23-
run: kubectl kustomize stack/
22+
- name: Build core overlay stack
23+
run: kubectl kustomize overlays/core/stack/
2424

25-
- name: Verify quick-start labels in base
25+
- name: Build metrics overlay base
26+
run: kubectl kustomize overlays/metrics/base/
27+
28+
- name: Build metrics overlay stack
29+
run: kubectl kustomize overlays/metrics/stack/
30+
31+
- name: Verify quick-start labels in core overlay base
32+
run: |
33+
kubectl kustomize overlays/core/base/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
34+
35+
- name: Verify quick-start labels in core overlay stack
36+
run: |
37+
kubectl kustomize overlays/core/stack/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
38+
39+
- name: Verify quick-start labels in metrics overlay base
2640
run: |
27-
kubectl kustomize base/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
41+
kubectl kustomize overlays/metrics/base/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
2842
29-
- name: Verify quick-start labels in stack
43+
- name: Verify quick-start labels in metrics overlay stack
3044
run: |
31-
kubectl kustomize stack/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
45+
kubectl kustomize overlays/metrics/stack/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
3246
3347
shellcheck:
3448
name: Lint shell scripts

README.md

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ A Kustomize-based repository for deploying the StreamsHub event-streaming stack
1515
| StreamsHub Console Operator | `streamshub-console` | Manages console instances |
1616
| StreamsHub Console instance | `streamshub-console` | Web UI for Kafka management |
1717

18+
> **Optional:** The [metrics overlay](#install-with-metrics) adds Prometheus Operator, a Prometheus instance, and Kafka metrics collection via PodMonitors.
19+
1820
## Prerequisites
1921

2022
- `kubectl` v1.27 or later (for Kustomize v5.0 `labels` transformer support)
@@ -39,6 +41,7 @@ The install script accepts the following environment variables:
3941
|----------|---------|-------------|
4042
| `REPO` | `streamshub/developer-quickstart` | GitHub repository path |
4143
| `REF` | `main` | Git ref, branch, or tag |
44+
| `OVERLAY` | *(empty)* | Overlay to apply (e.g. `metrics`) |
4245
| `TIMEOUT` | `120s` | `kubectl wait` timeout |
4346

4447
Example with a pinned version:
@@ -47,14 +50,24 @@ Example with a pinned version:
4750
curl -sL https://raw.githubusercontent.com/streamshub/developer-quickstart/main/install.sh | REF=v1.0.0 bash
4851
```
4952

53+
### Install with Metrics
54+
55+
Deploy the stack with Prometheus metrics collection:
56+
57+
```shell
58+
curl -sL https://raw.githubusercontent.com/streamshub/developer-quickstart/main/install.sh | OVERLAY=metrics bash
59+
```
60+
61+
This adds the Prometheus Operator and a Prometheus instance (namespace: `monitoring`), enables Kafka metrics via [Strimzi Metrics Reporter](https://strimzi.io/docs/operators/latest/deploying#proc-metrics-kafka-str), and wires Console to display metrics.
62+
5063
## Manual Install
5164

5265
If you prefer to control each step, the stack is installed in two phases:
5366

5467
### Phase 1 — Operators and CRDs
5568

5669
```shell
57-
kubectl apply -k 'https://github.com/streamshub/developer-quickstart//base?ref=main'
70+
kubectl apply -k 'https://github.com/streamshub/developer-quickstart//overlays/core/base?ref=main'
5871
```
5972

6073
Wait for the operators to become ready:
@@ -68,7 +81,23 @@ kubectl wait --for=condition=Available deployment/streamshub-console-operator -n
6881
### Phase 2 — Operands
6982

7083
```shell
71-
kubectl apply -k 'https://github.com/streamshub/developer-quickstart//stack?ref=main'
84+
kubectl apply -k 'https://github.com/streamshub/developer-quickstart//overlays/core/stack?ref=main'
85+
```
86+
87+
### Manual Install with Metrics
88+
89+
To include the metrics overlay, use the `overlays/metrics` paths instead of `overlays/core`.
90+
91+
```shell
92+
# Phase 1
93+
kubectl create -k 'https://github.com/streamshub/developer-quickstart//overlays/metrics/base?ref=main'
94+
kubectl wait --for=condition=Available deployment/prometheus-operator -n monitoring --timeout=120s
95+
kubectl wait --for=condition=Available deployment/strimzi-cluster-operator -n strimzi --timeout=120s
96+
kubectl wait --for=condition=Available deployment/apicurio-registry-operator -n apicurio-registry --timeout=120s
97+
kubectl wait --for=condition=Available deployment/streamshub-console-operator -n streamshub-console --timeout=120s
98+
99+
# Phase 2
100+
kubectl apply -k 'https://github.com/streamshub/developer-quickstart//overlays/metrics/stack?ref=main'
72101
```
73102

74103
## Accessing the Console
@@ -142,6 +171,9 @@ The uninstall script handles safe teardown with shared-cluster safety checks:
142171

143172
```shell
144173
curl -sL https://raw.githubusercontent.com/streamshub/developer-quickstart/main/uninstall.sh | bash
174+
175+
# If installed with the metrics overlay:
176+
curl -sL https://raw.githubusercontent.com/streamshub/developer-quickstart/main/uninstall.sh | OVERLAY=metrics bash
145177
```
146178

147179
The script:
@@ -156,7 +188,7 @@ The script:
156188
**Phase 1 — Delete operands:**
157189

158190
```shell
159-
kubectl delete -k 'https://github.com/streamshub/developer-quickstart//stack?ref=main'
191+
kubectl delete -k 'https://github.com/streamshub/developer-quickstart//overlays/core/stack?ref=main'
160192
```
161193

162194
Wait for all custom resources to be fully removed before proceeding.
@@ -169,9 +201,11 @@ Wait for all custom resources to be fully removed before proceeding.
169201
> ```
170202
171203
```shell
172-
kubectl delete -k 'https://github.com/streamshub/developer-quickstart//base?ref=main'
204+
kubectl delete -k 'https://github.com/streamshub/developer-quickstart//overlays/core/base?ref=main'
173205
```
174206
207+
For the metrics overlay, use `overlays/metrics/base` and `overlays/metrics/stack` instead.
208+
175209
### Finding Quick-Start Resources
176210

177211
All resources carry the label `app.kubernetes.io/part-of=streamshub-developer-quickstart`:
@@ -201,7 +235,7 @@ Use the `update-version.sh` script to update component versions:
201235
./update-version.sh strimzi 0.52.0
202236
```
203237

204-
Supported components: `strimzi`, `apicurio-registry`, `streamshub-console`
238+
Supported components: `strimzi`, `apicurio-registry`, `streamshub-console`, `prometheus-operator`
205239

206240
### Testing scripts locally
207241

@@ -229,17 +263,25 @@ LOCAL_DIR=/home/user/repos/developer-quickstart ./install.sh
229263
## Repository Structure
230264

231265
```
232-
base/ # Phase 1: Operators & CRDs
233-
├── kustomization.yaml # Composes all operator sub-components
234-
├── strimzi-operator/ # Strimzi Kafka Operator
235-
├── apicurio-registry-operator/ # Apicurio Registry Operator
236-
└── streamshub-console-operator/ # StreamsHub Console Operator
237-
238-
stack/ # Phase 2: Operands (Custom Resources)
239-
├── kustomization.yaml # Composes all operand sub-components
240-
├── kafka/ # Single-node Kafka cluster
241-
├── apicurio-registry/ # In-memory registry instance
242-
└── streamshub-console/ # Console instance
243-
244-
overlays/ # Future: variant configurations
266+
components/ # Reusable Kustomize components
267+
├── core/ # Core stack component
268+
│ ├── base/ # Operators & CRDs
269+
│ │ ├── strimzi-operator/ # Strimzi Kafka Operator
270+
│ │ ├── apicurio-registry-operator/ # Apicurio Registry Operator
271+
│ │ └── streamshub-console-operator/ # StreamsHub Console Operator
272+
│ └── stack/ # Operands (Custom Resources)
273+
│ ├── kafka/ # Single-node Kafka cluster
274+
│ ├── apicurio-registry/ # In-memory registry instance
275+
│ └── streamshub-console/ # Console instance
276+
└── metrics/ # Prometheus metrics component
277+
├── base/ # Prometheus Operator
278+
└── stack/ # Prometheus instance, PodMonitors, patches
279+
280+
overlays/ # Deployable configurations
281+
├── core/ # Default install (core only)
282+
│ ├── base/ # Phase 1: Operators & CRDs
283+
│ └── stack/ # Phase 2: Operands
284+
└── metrics/ # Core + Prometheus metrics
285+
├── base/ # Phase 1: Operators & CRDs + Prometheus Operator
286+
└── stack/ # Phase 2: Operands + Prometheus instance & monitors
245287
```

base/kustomization.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

base/apicurio-registry-operator/kustomization.yaml renamed to components/core/base/apicurio-registry-operator/kustomization.yaml

File renamed without changes.

base/apicurio-registry-operator/namespace.yaml renamed to components/core/base/apicurio-registry-operator/namespace.yaml

File renamed without changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
4+
resources:
5+
- strimzi-operator
6+
- apicurio-registry-operator
7+
- streamshub-console-operator
8+
9+
patches:
10+
# The streamshub-console-operator install YAML includes a ServiceMonitor
11+
# that requires the Prometheus Operator CRD (monitoring.coreos.com).
12+
# Since the base install does not include Prometheus, we remove it here.
13+
# The metrics component re-adds monitoring via its own ServiceMonitor.
14+
- target:
15+
group: monitoring.coreos.com
16+
version: v1
17+
kind: ServiceMonitor
18+
name: streamshub-console-operator
19+
patch: |-
20+
$patch: delete
21+
apiVersion: monitoring.coreos.com/v1
22+
kind: ServiceMonitor
23+
metadata:
24+
name: streamshub-console-operator

base/streamshub-console-operator/kustomization.yaml renamed to components/core/base/streamshub-console-operator/kustomization.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,3 @@ patches:
2525
- op: replace
2626
path: /subjects/0/namespace
2727
value: streamshub-console
28-
# Remove ServiceMonitor — requires Prometheus Operator CRD which is not
29-
# part of the base install. A metrics overlay will be added separately.
30-
- target:
31-
group: monitoring.coreos.com
32-
version: v1
33-
kind: ServiceMonitor
34-
name: streamshub-console-operator
35-
patch: |-
36-
$patch: delete
37-
apiVersion: monitoring.coreos.com/v1
38-
kind: ServiceMonitor
39-
metadata:
40-
name: streamshub-console-operator

base/streamshub-console-operator/namespace.yaml renamed to components/core/base/streamshub-console-operator/namespace.yaml

File renamed without changes.

base/strimzi-operator/clusterrolebindings.yaml renamed to components/core/base/strimzi-operator/clusterrolebindings.yaml

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)