Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added x-metrics pod monitor #8

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e79781a
added x-metrics pod monitor
humoflife Oct 31, 2023
97c6a6e
feat(podmonitors): change pod monitors to operators namespace and add…
haarchri Nov 1, 2023
ab39fc9
Merge pull request #9 from upbound/feature/streamline-podmonitors
humoflife Nov 1, 2023
e75584e
xmetrics dashboard checkpoint checkin
humoflife Nov 2, 2023
80c294a
variable setup for top level dashboard
humoflife Nov 3, 2023
798f785
dashboard updates
humoflife Nov 3, 2023
91b73ff
added dashboard panels
humoflife Nov 4, 2023
96db29f
added new line to yaml
humoflife Nov 4, 2023
ec5c873
moved patch for deterministic dashboard creation
humoflife Nov 6, 2023
9c1e7ed
Merge pull request #11 from upbound/fix/dashboard-creation
humoflife Nov 6, 2023
7be5310
moved patch for deterministic dashboard creation
humoflife Nov 6, 2023
aca5877
dashboard update
humoflife Nov 6, 2023
09c9e68
Merge pull request #10 from upbound/feature/x-metrics-dashboard
haarchri Nov 6, 2023
884713b
added x-metrics pod monitor
humoflife Oct 31, 2023
aa7502e
Merge branch 'x-metrics' of github.com:upbound/configuration-observab…
humoflife Nov 7, 2023
dab3b01
added usage
humoflife Nov 7, 2023
86ed1a4
x-metrics port name is metrics
humoflife Nov 7, 2023
f16fb4e
added x-metrics install
humoflife Nov 7, 2023
b68c396
updated Makefile
humoflife Nov 8, 2023
7d199f6
updated README.md and moved dashboards
humoflife Nov 8, 2023
ac0453e
updated README.md
humoflife Nov 8, 2023
9ba87a6
updated Makefile
Nov 14, 2023
10b18ff
added usage
humoflife Nov 7, 2023
e980050
x-metrics port name is metrics
humoflife Nov 7, 2023
8be1e6a
added x-metrics install
humoflife Nov 7, 2023
d235260
updated Makefile
humoflife Nov 8, 2023
1a9e312
updated README.md and moved dashboards
humoflife Nov 8, 2023
554b2c6
updated README.md
humoflife Nov 8, 2023
b692476
updated Makefile
Nov 14, 2023
8fb5789
Merge branch 'x-metrics' of github.com:upbound/configuration-observab…
Nov 14, 2023
658dde8
replaced generic metrics example with smaller scoped ones
Nov 15, 2023
7cb4f68
added make cluster option and updated README disclaimers
Nov 15, 2023
a4dc317
updated README.md
Nov 15, 2023
f5b61c3
replace disclaimer with note
Nov 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ PLATFORMS ?= linux_amd64
UP_VERSION = v0.21.0
UP_CHANNEL = stable
UPTEST_VERSION = v0.6.1
UXP_INSTALL_OPTS = "--unstable"
UXP_VERSION = 1.14.0-up.1.rc.2"

-include build/makelib/k8s_tools.mk
# ====================================================================================
Expand Down Expand Up @@ -69,7 +71,7 @@ build.init: $(UP)
# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/templates/01-delete.yaml.tmpl.
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e examples/folder-grafana.yaml,examples/dashboard-grafana-crossplane-health.yaml,examples/dashboard-grafana-crossplane-mr.yaml,examples/dashboard-grafana-crossplane-resources-ttr.yaml,examples/dashboard-grafana-crossplane-sli-metrics.yaml,examples/oss.yaml --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL)
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e examples/dashboards/folder-grafana.yaml,examples/dashboards/dashboard-grafana-crossplane-health.yaml,examples/dashboards/dashboard-grafana-crossplane-mr.yaml,examples/dashboards/dashboard-grafana-crossplane-resources-ttr.yaml,examples/dashboards/dashboard-grafana-crossplane-sli-metrics.yaml,examples/dashboards/dashboard-grafana-crossplane-top-level.yaml,examples/dashboards/dashboard-grafana-crossplane-xmetrics.yaml,examples/oss.yaml --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL)
@$(OK) running automated tests

# This target requires the following environment variables to be set:
Expand Down
41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ with open source software integrations such as Prometheus and Grafana.
Observability is a measure of how well platform performance can be inferred
from knowledge of its metrics, logs and traces outputs.

**Warning**
## Disclaimer: Management Cluster Resource Use
Prometheus and Grafana may require significant cluster resources in relation
to the amount of metrics scraped, processed and visualized. This may impact
cluster operations. Consult the respective Prometheus Operator and
Grafana documentation for set up guidance prior to using this configuration
on mission critical Crossplane management clusters.

**Warning**
## Disclaimer: Metric Stability
Crossplane has no concept of metric stability. This implies
that metrics used in this configuration may be absent in future versions
of Crossplane and / or its providers.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These warning messages do not provide much direction and the language has negative connotation. Consider rewriting them. What is the goal of having them here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal is to guide users to keep their mission critical management clusters happily operational through proper Prometheus tuning. I'll come up with more positive wording.

## Purpose
The goal for configuration-observability-oss is to complement
other configurations such as configuration-caas. See the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is configuration-caas?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configuration-caas is a plug and play configuration for cluster as a service.

Expand All @@ -20,37 +34,32 @@ at the conclusion of the tests by default.

Apply the resource claim as follows to re-create
the namespace, Prometheus, Grafana and dependencies for further

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the claim 're-creating' the ns, Prometheus, and Grafana?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we offer a make cluster so that the workflow does not duplicate the installation after Uptest cleaned up its test setup? Users who want to run make e2e could do it purposefully as a separate step with or without pre-existing cluster.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a make cluster option.

exploration.
exploration. Note that the xmetrics configuration examples
rely on the CRDs to be installed through the oss composition
first.
```
kubectl apply -f examples/oss.yaml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this claim installing x-metrics? If so, change the name. OSS is very generic, I would avoid using it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you recommend to not use oss.yaml for the claim name, even though x-metrics, prometheus and grafana are open source?

If so, which name would resonate with you?

```
Wait until xmetrics CRDs have been installed, then apply
the xmetrics configuration to see metrics flowing.
```
kubectl apply -f examples/xmetrics.yaml
```

To load dashboards that are part of this configuration repository,
please apply the following dashboard resource claims.
Copy link

@candonov candonov Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To load dashboards that are part of this configuration repository,
please apply the following dashboard resource claims.
The following command will apply all the dashboard resource claims located in the `dashboards` folder. Each claim will create a respective Grafana dashboard.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

```
kubectl apply -f examples/dashboards/folder-grafana.yaml
kubectl apply -f examples/dashboards/dashboard-grafana-crossplane-health.yaml
kubectl apply -f examples/dashboards/dashboard-grafana-crossplane-mr.yaml
kubectl apply -f examples/dashboards/dashboard-grafana-crossplane-resources-ttr.yaml
kubectl apply -f examples/dashboards/dashboard-grafana-crossplane-sli-metrics.yaml
kubectl apply -f examples/dashboards
```

Use the following to forward localhost:9090 to the Prometheus pod.
Copy link

@candonov candonov Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use the following to forward localhost:9090 to the Prometheus pod.
To access the Prometheus dashboard, port-forward to the the Prometheus service on port 9090.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

```
PROMETHEUS_POD_NAME=$(k -n operators get pods|\
awk '{print $1}'|\
tail +2|\
grep prometheus-0)
kubectl -n operators port-forward ${PROMETHEUS_POD_NAME} 9090
kubectl -n operators port-forward prometheus-oss-kube-prometheus-stack-prometheus-0 9090

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kubectl -n operators port-forward prometheus-oss-kube-prometheus-stack-prometheus-0 9090
kubectl -n operators port-forward svc/kube-prometheus-stack-prometheus 9090:9090

```

Use the following to forward localhost:3000 to the Grafana pod.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use the following to forward localhost:3000 to the Grafana pod.
To access the Grafana dashboard, port-forward to the Grafana service on port 80.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

```
GRAFANA_POD_NAME=$(k -n operators get pods|\
awk '{print $1}'|\
tail +2|\
grep grafana)
kubectl -n operators port-forward ${GRAFANA_POD_NAME} 3000
kubectl -n operators port-forward svc/oss-grafana 3000:80
```

Log in to Grafana at http://localhost:3000 with the credentials
Expand Down
103 changes: 91 additions & 12 deletions apis/oss/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
labels:
labels:
type: podMonitorCrossplaneRbacManager
spec:
forProvider:
Expand All @@ -31,10 +31,14 @@ spec:
kind: PodMonitor
metadata:
name: crossplane-rbac-manager
namespace: upbound-system
namespace: operators
labels:
app: crossplane-rbac-manager
spec:
namespaceSelector:
matchNames:
- crossplane-system
- upbound-system
selector:
matchLabels:
app: crossplane-rbac-manager
Expand All @@ -49,7 +53,7 @@ spec:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
labels:
labels:
type: podMonitorCrossplane
spec:
forProvider:
Expand All @@ -58,10 +62,14 @@ spec:
kind: PodMonitor
metadata:
name: crossplane
namespace: upbound-system
namespace: operators
labels:
app: crossplane
spec:
namespaceSelector:
matchNames:
- crossplane-system
- upbound-system
selector:
matchLabels:
app: crossplane
Expand All @@ -76,7 +84,7 @@ spec:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
labels:
labels:
type: podMonitorCrossplaneProviders
spec:
forProvider:
Expand All @@ -85,10 +93,14 @@ spec:
kind: PodMonitor
metadata:
name: crossplane-providers
namespace: upbound-system
namespace: operators
labels:
app: crossplane-providers
spec:
namespaceSelector:
matchNames:
- crossplane-system
- upbound-system
selector:
matchLabels:
app: crossplane-providers
Expand All @@ -98,6 +110,39 @@ spec:
- type: PatchSet
patchSetName: common

- name: podMonitorXmetrics
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
labels:
type: podMonitorXmetrics
Comment on lines +113 to +119

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

X-metrics installs with a service, when a service exists, it is better to use a service monitor for Prometheus. The helm chart already supports service monitor, use helm values to enable it.

spec:
forProvider:
manifest:
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: x-metrics
namespace: operators
labels:
app: x-metrics
spec:
namespaceSelector:
matchNames:
- crossplane-system
- upbound-system
- x-metrics
selector:
matchLabels:
app: x-metrics
podMetricsEndpoints:
- port: metrics
path: "/x-metrics"
patches:
- type: PatchSet
patchSetName: common

- name: releasePrometheus
base:
apiVersion: helm.crossplane.io/v1beta1
Expand All @@ -122,6 +167,12 @@ spec:
patchSetName: common
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.name
- fromFieldPath: metadata.labels
toFieldPath: metadata.labels
- fromFieldPath: metadata.annotations
toFieldPath: metadata.annotations
- fromFieldPath: spec.parameters.operators.prometheus.version
toFieldPath: spec.forProvider.chart.version
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.annotations[crossplane.io/external-name]
transforms:
Expand All @@ -131,12 +182,24 @@ spec:
- type: regexp
regexp: '.*'
result: oss
- fromFieldPath: metadata.labels
toFieldPath: metadata.labels
- fromFieldPath: metadata.annotations
toFieldPath: metadata.annotations
- fromFieldPath: spec.parameters.operators.prometheus.version
toFieldPath: spec.forProvider.chart.version

- name: usagePrometheusByPodMonitorXmetrics
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
of:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
resourceSelector:
matchControllerRef: true
by:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
resourceSelector:
matchControllerRef: true
matchLabels:
type: podMonitorXmetrics

- name: usagePrometheusByPodMonitorCrossplaneRbacManager
base:
Expand Down Expand Up @@ -191,3 +254,19 @@ spec:
matchControllerRef: true
matchLabels:
type: podMonitorCrossplaneProviders

- name: releaseXMetrics
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
rollbackLimit: 3
forProvider:
namespace: x-metrics
chart:
name: x-metrics
repository: https://crossplane-contrib.github.io/x-metrics
version: "0.1.3"
patches:
- type: PatchSet
patchSetName: common
Loading