@@ -9,70 +9,75 @@ The Better Stack Operator keeps Better Stack monitors in sync with Kubernetes by
99- ** Lifecycle management** – Finalizers ensure remote monitors are removed when their CRs are deleted, preventing orphaned resources.
1010- ** Status you can trust** – ` Ready ` , ` CredentialsAvailable ` , and ` Synced ` conditions expose reconciliation health.
1111
12- ## Helm Install
12+ ## Install with Helm
1313
14- Once a release is tagged ( ` vX.Y.Z ` ), the publish workflow builds and pushes a chart to:
14+ Published charts live at ` oci://ghcr.io/loks0n/betterstack-operator/helm/betterstack-operator ` .
1515
16- ```
17- oci://ghcr.io/loks0n/betterstack-operator/helm/betterstack-operator
18- ```
16+ ### 1. Provide Better Stack credentials
1917
20- Install/update the operator with :
18+ Choose how the controller should access the API token :
2119
22- ``` bash
23- helm upgrade --install betterstack-operator \
24- oci://ghcr.io/loks0n/betterstack-operator/helm/betterstack-operator \
25- --namespace betterstack-operator --create-namespace \
26- --wait
27- ```
20+ - ** Chart-managed secret** – let the release create the secret in its namespace (default ` betterstack-operator ` ).
2821
29- Create the ` betterstack-credentials ` secret before running the chart (see Quick Start step 2).
22+ ``` bash
23+ helm upgrade --install betterstack-operator \
24+ oci://ghcr.io/loks0n/betterstack-operator/helm/betterstack-operator \
25+ --namespace betterstack-operator --create-namespace \
26+ --set credentials.secret.create=true \
27+ --set-file credentials.secret.value=./betterstack-token.txt \
28+ --wait
29+ ```
3030
31- ## Quick Start
31+ Swap ` --set-file ` for ` --set credentials.secret.value=$TOKEN ` if you prefer piping the token directly from an environment variable or secret store.
3232
33- 1 . ** Fetch dependencies and (optionally) build **
33+ - ** Bring-your-own secret ** – pre-create it and point the chart at it:
3434
35- ``` bash
36- go mod tidy
37- go build ./...
38- ```
35+ ``` bash
36+ kubectl create secret generic betterstack-operator-credentials \
37+ --from-literal=api-key=REPLACE_ME \
38+ -n betterstack-operator
39+
40+ helm upgrade --install betterstack-operator \
41+ oci://ghcr.io/loks0n/betterstack-operator/helm/betterstack-operator \
42+ --namespace betterstack-operator --create-namespace \
43+ --set credentials.existingSecret=betterstack-operator-credentials \
44+ --wait
45+ ```
3946
40- 2 . ** Create an API token secret**
47+ The chart-generated secret defaults to ` betterstack-operator-credentials ` . Whichever path you choose, the secret must exist in every namespace where you define ` BetterStackMonitor ` objects.
4148
42- ``` bash
43- kubectl create secret generic betterstack-credentials \
44- --from-literal=api-key=REPLACE_ME \
45- -n default
46- ```
49+ ### 2. Create monitors
4750
48- 3 . ** Install CRD, RBAC, and controller **
51+ Apply one of the sample CRs to verify the install:
4952
50- ``` bash
51- kubectl apply -f config/crd/bases/monitoring.betterstack.io_betterstackmonitors.yaml
52- kubectl apply -f config/rbac/service_account.yaml
53- kubectl apply -f config/rbac/role.yaml
54- kubectl apply -f config/rbac/role_binding.yaml
55- kubectl apply -k config/manager
56- ```
53+ ``` bash
54+ kubectl apply -f config/samples/monitoring_v1alpha1_betterstackmonitor_https.yaml
55+ kubectl apply -f config/samples/monitoring_v1alpha1_betterstackmonitor_keyword.yaml
56+ kubectl apply -f config/samples/monitoring_v1alpha1_betterstackmonitor_tcp.yaml
57+ ```
5758
58- 4 . ** Create a monitor resource **
59+ Check reconciliation status and debug events with:
5960
60- Choose one (or more) of the sample manifests:
61+ ``` bash
62+ kubectl get betterstackmonitors.monitoring.betterstack.io -A
63+ kubectl describe betterstackmonitor demo-monitor
64+ ```
6165
62- ``` bash
63- kubectl apply -f config/samples/monitoring_v1alpha1_betterstackmonitor_https.yaml
64- kubectl apply -f config/samples/monitoring_v1alpha1_betterstackmonitor_keyword.yaml
65- kubectl apply -f config/samples/monitoring_v1alpha1_betterstackmonitor_tcp.yaml
66- ```
66+ Deleting a ` BetterStackMonitor ` automatically deletes the remote Better Stack monitor thanks to controller finalizers.
6767
68- 5 . ** Inspect status **
68+ ### Configuration highlights
6969
70- ``` bash
71- kubectl get betterstackmonitors.monitoring.betterstack.io -A
72- kubectl describe betterstackmonitor demo-monitor
73- ```
70+ See ` helm/betterstack-operator/values.yaml ` for the full list. Frequently tuned values include:
7471
75- Deleting the ` BetterStackMonitor ` automatically deletes the remote Better Stack monitor.
72+ - ` credentials.existingSecret ` – reference a pre-created secret instead of letting the chart manage one.
73+ - ` credentials.secret.* ` – control chart-managed secret creation (name override, key, annotations, inline value).
74+ - ` imagePullSecrets ` – add registry credentials when pulling the operator image.
75+ - ` podAnnotations ` , ` podLabels ` , ` podSecurityContext ` , ` containerSecurityContext ` – attach metadata or adjust pod/container security posture.
76+ - ` nodeSelector ` , ` tolerations ` , ` affinity ` – steer the operator onto matching nodes.
77+ - ` namespace ` – pin all resources to a specific namespace (defaults to the release namespace).
78+ - ` manager.* ` – adjust controller ports, enable/disable leader election, and pass extra arguments.
79+ - ` rbac.create ` – disable default RBAC when running with pre-provisioned roles.
80+ - ` crds.install ` – set to ` false ` when CRDs are installed out-of-band (e.g., via GitOps).
7681
7782## Spec Reference (excerpt)
7883
@@ -99,13 +104,34 @@ See `api/v1alpha1/betterstackmonitor_types.go` for the full schema and commentar
99104
100105## Troubleshooting
101106
102- - ` CredentialsAvailable=False ` – Confirm the referenced secret exists and contains the API key.
103- - ` Synced=False ` – The Better Stack API rejected the payload; inspect the condition message for validation errors.
104- - ` Ready=True ` – The latest spec was successfully applied.
107+ - ` CredentialsAvailable=False ` – confirm the referenced secret exists and contains the API key in the expected key.
108+ - ` Synced=False ` – the Better Stack API rejected the payload; inspect the condition message for validation errors.
109+ - ` Ready=True ` – the latest spec was successfully applied.
105110
106111Enable verbose logging with ` --zap-log-level=debug ` in the manager deployment for extra context.
107112
108- ## Testing
113+ ## Manual installation (development)
114+
115+ The manifests under ` config/ ` are primarily for hacking on the controller:
116+
117+ ``` bash
118+ kubectl apply -f config/crd/bases/monitoring.betterstack.io_betterstackmonitors.yaml
119+ kubectl apply -f config/rbac/service_account.yaml
120+ kubectl apply -f config/rbac/role.yaml
121+ kubectl apply -f config/rbac/role_binding.yaml
122+ kubectl apply -k config/manager
123+ ```
124+
125+ You still need to create a matching secret in the target namespace before running the manager locally or via these raw manifests.
126+
127+ ## Development
128+
129+ - Module path: ` loks0n/betterstack-operator ` .
130+ - API types live under ` api/v1alpha1 ` ; controller logic is in ` controllers/betterstackmonitor_controller.go ` .
131+ - The Better Stack API client lives in ` pkg/betterstack ` .
132+ - E2E helpers are in ` test/e2e ` , relying on ` kind ` , ` kubectl ` , and a Better Stack test token.
133+
134+ ### Testing
109135
110136- ** Unit tests**
111137
@@ -122,11 +148,4 @@ Enable verbose logging with `--zap-log-level=debug` in the manager deployment fo
122148
123149 The e2e test boots a Kind cluster, installs the CRD and controller, applies a richly populated ` BetterStackMonitor ` , and asserts (via the Better Stack API) that create/update/delete operations are reflected remotely. The test cleans up the remote monitor, but run it only against non-production credentials.
124150
125- ## Development Notes
126-
127- - Module path: ` loks0n/betterstack-operator ` .
128- - API types live under ` api/v1alpha1 ` ; controller logic is in ` controllers/betterstackmonitor_controller.go ` .
129- - The Better Stack API client (create/update/get/list/delete) resides in ` pkg/betterstack ` .
130- - E2E helpers are in ` test/e2e ` , relying on ` kind ` , ` kubectl ` , and genuine Better Stack credentials.
131-
132151Contributions, issues, and ideas are welcome!
0 commit comments