Skip to content

pkg/controller: add possibility of user defined rule files - #2

Merged
fabxc merged 1 commit into
prometheus-operator:masterfrom
brancz:rule-cm
Oct 28, 2016
Merged

fabxc merged 1 commit into
prometheus-operator:masterfrom
brancz:rule-cm

Conversation

@brancz

@brancz brancz commented Oct 27, 2016 •

Copy link
Copy Markdown
Contributor

@fabxc

Main question on this is whether we want to enforce a user to create the <prometheus-name>-rules ConfigMap? Or do we want to go full on and do the managed ConfigMap?

Comment thread pkg/controller/deployment.go Outdated
},
},
}, {
Name: "rules-reloader",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So just having a single reloader does not work?

Does it generally not work recursively on a directory or is this just per-volume-mount?

For example, if we build a single rule ConfigMap in the controller from several ones, we'd always have nested directories as we'd store the individual files in <rule-ConfigMap-name>/<origPath> depending on their source ConfigMap.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

At least with the current implementation of the configmap reloader (fsnotify is not recursive) this is how we need to do it. I'll look into maybe extending the reloader to accept a glob instead of a single path to watch.

@fabxc

fabxc commented Oct 28, 2016

Copy link
Copy Markdown
Contributor

I think the name is fine. We also dictate the name if the user wants to provide their own configuration. We can actually just do both. If we later extend by allowing to provide a selector over ConfigMaps, the controller would write all their summarized contents into the ConfigMap with the fixed name.
Not providing a selector would, just as for config, allow the user to provide it themselves.

Doesn't have to be in this PR, but we have to figure out our labeling approach, i.e. do we consistently use the prometheus.coreos.com/{type,name} labels. Does the namespacing make sense?

Do we also or instead want to use ownerReferences in the object meta. For example, pods created by replica sets look like:

- apiVersion: v1
  kind: Pod
  metadata:
    annotations:
      kubernetes.io/created-by: |
        {"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"prometheus-main-3075796463","uid":"df360d3f-9c67-11e6-ac9f-2607313a24d5","apiVersion":"extensions","resourceVersion":"3067"}}
    creationTimestamp: 2016-10-27T17:07:42Z
    generateName: prometheus-main-3075796463-
    labels:
      pod-template-hash: "3075796463"
      prometheus.coreos.com/name: prometheus-main
      prometheus.coreos.com/type: prometheus
    name: prometheus-main-3075796463-kkkv6
    namespace: default
    ownerReferences:
    - apiVersion: extensions/v1beta1
      controller: true
      kind: ReplicaSet
      name: prometheus-main-3075796463
      uid: df360d3f-9c67-11e6-ac9f-2607313a24d5
    resourceVersion: "14032"
# ...

Comment thread Makefile Outdated
@@ -1,5 +1,6 @@
build:
go build github.com/coreos/kube-prometheus-controller/cmd/controller
go install github.com/coreos/kube-prometheus-controller/cmd/controller

@brancz brancz Oct 28, 2016 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fabxc Let me know if you have an opinion about this, I just do it because it means faster compiling. Not attached to it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mh, this kinda breaks my process of GOOS=linux make && make container.
For me builds are very fast with go build to – definitely seems to cache the built packages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok little experiment shows that an occasional go install already speeds up everything quite drastically .. will revert to the old makefile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@brancz

brancz commented Oct 28, 2016

Copy link
Copy Markdown
Contributor Author

The namespacing makes sense, I think we should have both, the labels and the owner reference, it will help big time when we get to GC'ing things.

@fabxc

fabxc commented Oct 28, 2016

Copy link
Copy Markdown
Contributor

👍

@fabxc
fabxc merged commit 131a481 into prometheus-operator:master Oct 28, 2016
@fabxc
fabxc deleted the rule-cm branch October 28, 2016 11:42
brancz referenced this pull request in brancz/prometheus-operator Mar 6, 2017
monitor and alert on k8s components
whypro pushed a commit to whypro/prometheus-operator that referenced this pull request Jul 19, 2018
Add apiserver config of kubernetes_sd_config to prometheus spec.
philipgough pushed a commit to philipgough/prometheus-operator that referenced this pull request Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants