Skip to content

Commit 6181d21

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 1905fe1 commit 6181d21

Some content is hidden

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

44 files changed

+584
-64
lines changed

.github/workflows/validate.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ jobs:
2121
- name: Build stack layer
2222
run: kubectl kustomize stack/
2323

24+
- name: Build metrics overlay base
25+
run: kubectl kustomize overlays/metrics/base/
26+
27+
- name: Build metrics overlay stack
28+
run: kubectl kustomize overlays/metrics/stack/
29+
2430
- name: Verify quick-start labels in base
2531
run: |
2632
kubectl kustomize base/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
@@ -29,6 +35,14 @@ jobs:
2935
run: |
3036
kubectl kustomize stack/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
3137
38+
- name: Verify quick-start labels in metrics overlay base
39+
run: |
40+
kubectl kustomize overlays/metrics/base/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
41+
42+
- name: Verify quick-start labels in metrics overlay stack
43+
run: |
44+
kubectl kustomize overlays/metrics/stack/ | grep -q 'app.kubernetes.io/part-of: streamshub-developer-quickstart'
45+
3246
shellcheck:
3347
name: Lint shell scripts
3448
runs-on: ubuntu-latest

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
@@ -98,6 +127,9 @@ The uninstall script handles safe teardown with shared-cluster safety checks:
98127

99128
```shell
100129
curl -sL https://raw.githubusercontent.com/streamshub/developer-quickstart/main/uninstall.sh | bash
130+
131+
# If installed with the metrics overlay:
132+
curl -sL https://raw.githubusercontent.com/streamshub/developer-quickstart/main/uninstall.sh | OVERLAY=metrics bash
101133
```
102134

103135
The script:
@@ -112,7 +144,7 @@ The script:
112144
**Phase 1 — Delete operands:**
113145

114146
```shell
115-
kubectl delete -k 'https://github.com/streamshub/developer-quickstart//stack?ref=main'
147+
kubectl delete -k 'https://github.com/streamshub/developer-quickstart//overlays/core/stack?ref=main'
116148
```
117149

118150
Wait for all custom resources to be fully removed before proceeding.
@@ -125,9 +157,11 @@ Wait for all custom resources to be fully removed before proceeding.
125157
> ```
126158
127159
```shell
128-
kubectl delete -k 'https://github.com/streamshub/developer-quickstart//base?ref=main'
160+
kubectl delete -k 'https://github.com/streamshub/developer-quickstart//overlays/core/base?ref=main'
129161
```
130162
163+
For the metrics overlay, use `overlays/metrics/base` and `overlays/metrics/stack` instead.
164+
131165
### Finding Quick-Start Resources
132166

133167
All resources carry the label `app.kubernetes.io/part-of=streamshub-developer-quickstart`:
@@ -157,7 +191,7 @@ Use the `update-version.sh` script to update component versions:
157191
./update-version.sh strimzi 0.52.0
158192
```
159193

160-
Supported components: `strimzi`, `apicurio-registry`, `streamshub-console`
194+
Supported components: `strimzi`, `apicurio-registry`, `streamshub-console`, `prometheus-operator`
161195

162196
### Testing scripts locally
163197

@@ -185,17 +219,25 @@ LOCAL_DIR=/home/user/repos/developer-quickstart ./install.sh
185219
## Repository Structure
186220

187221
```
188-
base/ # Phase 1: Operators & CRDs
189-
├── kustomization.yaml # Composes all operator sub-components
190-
├── strimzi-operator/ # Strimzi Kafka Operator
191-
├── apicurio-registry-operator/ # Apicurio Registry Operator
192-
└── streamshub-console-operator/ # StreamsHub Console Operator
193-
194-
stack/ # Phase 2: Operands (Custom Resources)
195-
├── kustomization.yaml # Composes all operand sub-components
196-
├── kafka/ # Single-node Kafka cluster
197-
├── apicurio-registry/ # In-memory registry instance
198-
└── streamshub-console/ # Console instance
199-
200-
overlays/ # Future: variant configurations
222+
components/ # Reusable Kustomize components
223+
├── core/ # Core stack component
224+
│ ├── base/ # Operators & CRDs
225+
│ │ ├── strimzi-operator/ # Strimzi Kafka Operator
226+
│ │ ├── apicurio-registry-operator/ # Apicurio Registry Operator
227+
│ │ └── streamshub-console-operator/ # StreamsHub Console Operator
228+
│ └── stack/ # Operands (Custom Resources)
229+
│ ├── kafka/ # Single-node Kafka cluster
230+
│ ├── apicurio-registry/ # In-memory registry instance
231+
│ └── streamshub-console/ # Console instance
232+
└── metrics/ # Prometheus metrics component
233+
├── base/ # Prometheus Operator
234+
└── stack/ # Prometheus instance, PodMonitors, patches
235+
236+
overlays/ # Deployable configurations
237+
├── core/ # Default install (core only)
238+
│ ├── base/ # Phase 1: Operators & CRDs
239+
│ └── stack/ # Phase 2: Operands
240+
└── metrics/ # Core + Prometheus metrics
241+
├── base/ # Phase 1: Operators & CRDs + Prometheus Operator
242+
└── stack/ # Phase 2: Operands + Prometheus instance & monitors
201243
```

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)