Kube-prometheus: Change jsonnet directory layout

Created on 15 Jan 2021  ยท  7Comments  ยท  Source: prometheus-operator/kube-prometheus

What is missing?
Good user experience.

Why do we need it?
To improve user experience by categorizing various jsonnet snippets to create a clear picture.

Environment

  • kube-prometheus version:

    post release-0.7

Anything else we need to know?:

This is building on top of https://github.com/prometheus-operator/kube-prometheus/pull/873

I would like to categorize files in jsonnet/kube-prometheus directory in a following pattern:

.
โ”œโ”€โ”€ jsonnetfile.json
โ”œโ”€โ”€ main.libsonnet # previously kube-prometheus.libsonnet
โ”œโ”€โ”€ components/  # holding major components of the stack
โ”‚ย ย  โ”œโ”€โ”€ mixin/
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ alerts
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ alerts.libsonnet
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ general.libsonnet
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ node.libsonnet
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ tests.yaml
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ custom.libsonnet
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ kubernetes.libsonnet
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ rules
โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ general.libsonnet
โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ node-rules.libsonnet
โ”‚ย ย  โ”‚ย ย      โ””โ”€โ”€ rules.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ alertmanager.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ blackbox-exporter.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ grafana.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ ksm-autoscaler.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-state-metrics.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-rbac-proxy.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ node-exporter.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ prometheus.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ prometheus-adapter.libsonnet
โ”‚ย ย  โ””โ”€โ”€ prometheus-operator.libsonnet
โ”œโ”€โ”€ addons/  # various snippets that can be applied separatelly
โ”‚ย ย  โ”œโ”€โ”€ dropping-deprecated-metrics-relabelings.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ grafana-weave-net-cluster.json
โ”‚ย ย  โ”œโ”€โ”€ grafana-weave-net.json
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-all-namespaces.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-anti-affinity.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-bootkube.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-config-mixins.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-custom-metrics.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-external-metrics.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-insecure-kubelet.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-ksonnet.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-managed-cluster.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-node-ports.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-static-etcd.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-strip-limits.libsonnet
โ”‚ย ย  โ”œโ”€โ”€ kube-prometheus-thanos-sidecar.libsonnet
โ”‚ย ย  โ””โ”€โ”€ kube-prometheus-weave-net.libsonnet
โ””โ”€โ”€ platforms/  # Ready to apply examples for each platform.
 ย ย  โ”œโ”€โ”€ kube-prometheus-eks.libsonnet
 ย ย  โ”œโ”€โ”€ kube-prometheus-gke.libsonnet
 ย ย  โ”œโ”€โ”€ kube-prometheus-kops-coredns.libsonnet
 ย ย  โ”œโ”€โ”€ kube-prometheus-kops.libsonnet
 ย ย  โ”œโ”€โ”€ kube-prometheus-kubeadm.libsonnet
 ย ย  โ”œโ”€โ”€ kube-prometheus-kube-aws.libsonnet
 ย ย  โ””โ”€โ”€ kube-prometheus-kubespray.libsonnet

RFC @prometheus-operator/kube-prometheus-reviewers

kinfeature

Most helpful comment

I would say we open a separate issue and we can discuss on the naming :D

All 7 comments

I'd say for addons and platforms we can drop the kube-prometheus- prefix now. Otherwise :+1:

One day I would still like to see something a little more ergonomic (definitely my own perception, maybe for others it's not more ergonomic) like:

kp + 
  kp.platforms.gke +
  kp.addons.allNamespaces

That's just food for thought though, and is not mutually exclusive with your proposal, so from my side, feel free to move ahead with your proposal.

One thing:
I seen a good suggestion from Thor that the mixin name is confusing. Maybe we can rename that at least here to something else? Also because we have mixins in other subdirs per the chart above.

Otherwise this makes sense to me!

An additional general statement .. as the "API" of kube-prometheus as a library is essentially the main.jsonnet, I think we can feel free to refactor within components/ however we want.

It would be nice if we could write this "contract" down in the readme.

@lilic I feel we should wait until we find a new name within the community before renaming things here. I feel right now this would be a bit premature and we'd risk that we have to change it multiple times .. As I mentioned in my previous comment, anything within components/ we're pretty free to refactor at any point in time (I guess that's also an argument against my point haha).

Sounds good to me, lets document that!

It would be nice if we could write this "contract" down in the readme.

I agree and will write it in one of PRs with docs update.

As for renaming mixin/ directory - I also don't like it, but I didn't have any other good name. I am open to proposals on the name.

I would say we open a separate issue and we can discuss on the naming :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chiefy picture chiefy  ยท  6Comments

RiRa12621 picture RiRa12621  ยท  6Comments

brancz picture brancz  ยท  5Comments

grobie picture grobie  ยท  6Comments

rupadhya1 picture rupadhya1  ยท  3Comments