Skip to content

Commit

Permalink
use better naming
Browse files Browse the repository at this point in the history
Signed-off-by: clux <sszynrae@gmail.com>
  • Loading branch information
clux committed May 13, 2022
1 parent 26a4d07 commit 6c4a7ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ In either of the run scenarios, your app is listening on port `8080`, and it wil
Try some of:

```sh
kubectl apply -f yaml/instance-good.yaml
kubectl delete doc good
kubectl edit doc good # change info to contain bad
kubectl apply -f yaml/instance-lorem.yaml
kubectl delete doc lorem
kubectl edit doc lorem # change hidden
```

The reconciler will run and write the status object on every change. You should see results in the logs of the pod, or on the .status object outputs of `kubectl get doc -oyaml`.
Expand All @@ -79,7 +79,7 @@ The reconciler will run and write the status object on every change. You should
The sample web server exposes some example metrics and debug information you can inspect with `curl`.

```sh
$ kubectl apply -f yaml/instance-good.yaml
$ kubectl apply -f yaml/instance-lorem.yaml
$ curl 0.0.0.0:8080/metrics
# HELP doc_controller_reconcile_duration_seconds The duration of reconcile to complete in seconds
# TYPE doc_controller_reconcile_duration_seconds histogram
Expand Down Expand Up @@ -107,6 +107,6 @@ $ curl 0.0.0.0:8080/
The metrics will be auto-scraped if you have a standard [`PodMonitor` for `prometheus.io/scrape`](/~https://github.com/prometheus-community/helm-charts/blob/b69e89e73326e8b504102a75d668dc4351fcdb78/charts/prometheus/values.yaml#L1608-L1650).

### Events
The example `reconciler` only checks the `.spec.info` to see if it contains the word `bad`. If it does, it updates the `.status` object to reflect whether or not the instance `is_bad`. It also sends a kubernetes event associated with the controller. It is visible at the bottom of `kubectl describe doc bad`.
The example `reconciler` only checks the `.spec.hidden` bool. If it does, it updates the `.status` object to reflect whether or not the instance `is_hidden`. It also sends a kubernetes event associated with the controller. It is visible at the bottom of `kubectl describe doc samuel`.

While this controller has no child objects configured, there is a [`configmapgen_controller`](/~https://github.com/kube-rs/kube-rs/blob/master/examples/configmapgen_controller.rs) example in [kube-rs](/~https://github.com/kube-rs/kube-rs/).
2 changes: 1 addition & 1 deletion yaml/instance-good.yaml → yaml/instance-lorem.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kube.rs/v1
kind: Document
metadata:
name: good
name: lorem
spec:
title: Lorem Ipsum
hide: false
Expand Down
2 changes: 1 addition & 1 deletion yaml/instance-bad.yaml → yaml/instance-samuel.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kube.rs/v1
kind: Document
metadata:
name: bad
name: samuel
spec:
title: Samuel Ipsum
hide: true
Expand Down

0 comments on commit 6c4a7ad

Please sign in to comment.