{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/prometheus-operator/issues/1256","repository_url":"https://api.github.com/repos/coreos/prometheus-operator","labels_url":"https://api.github.com/repos/coreos/prometheus-operator/issues/1256/labels{/name}","comments_url":"https://api.github.com/repos/coreos/prometheus-operator/issues/1256/comments","events_url":"https://api.github.com/repos/coreos/prometheus-operator/issues/1256/events","html_url":"https://github.com/coreos/prometheus-operator/issues/1256","id":317757615,"number":1256,"title":"ServiceMonitor can select itself","user":{"login":"adamdecaf","id":120951,"avatar_url":"https://avatars3.githubusercontent.com/u/120951?v=4","gravatar_id":"","url":"https://api.github.com/users/adamdecaf","html_url":"https://github.com/adamdecaf","followers_url":"https://api.github.com/users/adamdecaf/followers","following_url":"https://api.github.com/users/adamdecaf/following{/other_user}","gists_url":"https://api.github.com/users/adamdecaf/gists{/gist_id}","starred_url":"https://api.github.com/users/adamdecaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamdecaf/subscriptions","organizations_url":"https://api.github.com/users/adamdecaf/orgs","repos_url":"https://api.github.com/users/adamdecaf/repos","events_url":"https://api.github.com/users/adamdecaf/events{/privacy}","received_events_url":"https://api.github.com/users/adamdecaf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-25T19:12:28Z","updated_at":"2018-04-26T16:48:35Z","closed_at":null,"author_association":"NONE","body":"**What did you do?**\r\n\r\nI'm setting up federation using a ServiceMonitor (mentioned previously in https://github.com/coreos/prometheus-operator/issues/647), which works, but a prometheus instance can select itself. \r\n\r\nI have two prometheus instances (and `kind: Prometheus` objects) in the same namespace. I'm setting up the \"infra prometheus\" to federate (read from) a `marathon-prometheus` instance. The `ServiceMonitor` for that looks like the following. \r\n\r\n<details>\r\n<summary>marathon-prometheus ServiceMonitor</summary>\r\n\r\n```\r\n{\r\n    \"apiVersion\": \"monitoring.coreos.com/v1\",\r\n    \"kind\": \"ServiceMonitor\",\r\n    \"metadata\": {\r\n        \"labels\": {\r\n            \"team\": \"infrastructure\"\r\n        },\r\n        \"name\": \"marathon-prometheus\",\r\n        \"namespace\": \"infrastructure\"\r\n    },\r\n    \"spec\": {\r\n        \"endpoints\": [\r\n            {\r\n                \"honorLabels\": true,\r\n                \"interval\": \"30s\",\r\n                \"params\": {\r\n                    \"match[]\": [\r\n                        \"{__name__=~\\\".+\\\"}\"\r\n                    ]\r\n                },\r\n                \"path\": \"/federate\",\r\n                \"port\": \"web\"\r\n            }\r\n        ],\r\n        \"namespaceSelector\": {\r\n            \"matchNames\": [\r\n                \"infrastructure\"\r\n            ]\r\n        },\r\n        \"selector\": {\r\n            \"app\": \"marathon-prometheus\",\r\n            \"prometheus\": \"marathon-prometheus\"\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n</details>\r\n\r\n**What did you expect to see?**\r\n\r\nI expected to be able to select only the `marathon-prometheus` Prometheus. \r\n\r\n**Environment**\r\n\r\n* Kubernetes version information:\r\n\r\n```\r\n$ kubectl --context <omitted>-context version\r\nClient Version: version.Info{Major:\"1\", Minor:\"10\", GitVersion:\"v1.10.1\", GitCommit:\"d4ab47518836c750f9949b9e0d387f20fb92260b\", GitTreeState:\"clean\", BuildDate:\"2018-04-13T22:27:55Z\", GoVersion:\"go1.9.5\", Compiler:\"gc\", Platform:\"darwin/amd64\"}\r\nServer Version: version.Info{Major:\"1\", Minor:\"8+\", GitVersion:\"v1.8.9+coreos.1\", GitCommit:\"cd373fe93e046b0a0bc7e4045af1bf4171cea395\", GitTreeState:\"clean\", BuildDate:\"2018-03-13T21:28:21Z\", GoVersion:\"go1.8.3\", Compiler:\"gc\", Platform:\"linux/amd64\"}\r\n```\r\n\r\n* Kubernetes cluster kind: \r\n\r\n\ttectonic-installer\r\n"},"comment":{"url":"https://api.github.com/repos/coreos/prometheus-operator/issues/comments/384711303","html_url":"https://github.com/coreos/prometheus-operator/issues/1256#issuecomment-384711303","issue_url":"https://api.github.com/repos/coreos/prometheus-operator/issues/1256","id":384711303,"user":{"login":"brancz","id":4546722,"avatar_url":"https://avatars3.githubusercontent.com/u/4546722?v=4","gravatar_id":"","url":"https://api.github.com/users/brancz","html_url":"https://github.com/brancz","followers_url":"https://api.github.com/users/brancz/followers","following_url":"https://api.github.com/users/brancz/following{/other_user}","gists_url":"https://api.github.com/users/brancz/gists{/gist_id}","starred_url":"https://api.github.com/users/brancz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brancz/subscriptions","organizations_url":"https://api.github.com/users/brancz/orgs","repos_url":"https://api.github.com/users/brancz/repos","events_url":"https://api.github.com/users/brancz/events{/privacy}","received_events_url":"https://api.github.com/users/brancz/received_events","type":"User","site_admin":false},"created_at":"2018-04-26T16:48:35Z","updated_at":"2018-04-26T16:48:35Z","author_association":"MEMBER","body":"Nice, so you're all good? :slightly_smiling_face: "}}
{"actor":{"display_login":"brancz"}}