Skip to content

Commit

Permalink
Add working ServiceMonitor config to release uploads (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
Starttoaster authored Oct 25, 2024
1 parent 5d138cb commit 9bad276
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ release: manifests kustomize ## Build CRD and Operator manifests with kustomize.
mkdir -p release/
$(KUSTOMIZE) build config/crd > release/crd.yaml
$(KUSTOMIZE) build config/default > release/manager.yaml
$(KUSTOMIZE) build config/prometheus > release/monitor.yaml

# If you wish to build the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
Expand Down
2 changes: 2 additions & 0 deletions config/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
namespace: chia-operator-system
namePrefix: chia-operator-
resources:
- monitor.yaml
24 changes: 7 additions & 17 deletions config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@

# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
control-plane: controller-manager
app.kubernetes.io/name: servicemonitor
app.kubernetes.io/instance: controller-manager-metrics-monitor
app.kubernetes.io/component: metrics
app.kubernetes.io/created-by: chia-operator
app.kubernetes.io/part-of: chia-operator
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-monitor
name: manager-metrics
namespace: system
spec:
endpoints:
- path: /metrics
port: https
scheme: https
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
insecureSkipVerify: true
- interval: 30s
path: /metrics
port: metrics
namespaceSelector:
matchNames:
- chia-operator-system
selector:
matchLabels:
control-plane: controller-manager
10 changes: 10 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ Install the latest controller manager:
kubectl apply -f https://github.com/Chia-Network/chia-operator/releases/latest/download/manager.yaml
```

### Prometheus metrics (Optional)

If you have the Prometheus Operator installed in your cluster and would like to use the bundled ServiceMonitor to scrape chia-operator metrics:

```bash
kubectl apply -f https://github.com/Chia-Network/chia-operator/releases/latest/download/monitor.yaml
```

This ServiceMonitor is installed in the same namespace as chia-operator, so it will only work in Prometheus Operator configurations that can load ServiceMonitors from any namespace, and also don't have any ServiceMonitorSelectors set.

## Using kustomize

Clone this repository (and change to its directory):
Expand Down

0 comments on commit 9bad276

Please sign in to comment.