* Introduce PrometheusAgent CRD
Operator is able to run with PrometheusAgent resources in the cluster, but doesn't do anything with them yet. This is the first step to implement the Prometheus Agent Operator.
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
* Re-enable configmap and secret informers
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit 1a71db03db6b41cd0cee9d0193b6ea3884bb5bae)
* Implement Resolve for Agent operator
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit 49558165b9178b6c1bda833a48f7bfe1468c942a)
* Operator is able to create Agent Statefulset
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit 7a3826683c92f917312c866a2bb6401dc54b95f2)
* Agent Operator creates secret from ServiceMonitors
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit 11232669befb4de9d0765dfadfe5fae00b575f11)
* Agent Operator creates secret from PodMonitors
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit 5ae551734bac2babc056c86443d15729d43d12b0)
* Agent Operator creates secret from Probes
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit 9637612fbbe9617335fd6188271ebf2cc74a3693)
* Agent Operator configures remote-write
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit c4bdf230d527e19f8b77ca5f938b9254ed344f7d)
* Agent Operator configures additionalScrapeConfigs
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit d9f28db764641e682bf4fe8963310f791979c387)
* Implement UpdateStatus
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit c546ecaf3e8b73916df44a8f48b279c6988e32f5)
* Add resource handlers
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit 5b83359445e20f88ea5fff80302fce62d58058b9)
* make format
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
(cherry picked from commit 6507964ba28f4ebf32ce3203db752444e288c45d)
* Only start agent operator if there is enough permission
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
* Remove node endpoint syncronization from agent operator
The server operator already handles it
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
* Move PrometheusAgent API from v1 to v1alpha1
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
* pkg/prometheus/agent/statefulset.go: Fix image concatenation
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
* Avoid name colisions between Prometheus Agents and Servers
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
* agent/createOrUpdateConfigurationSecret: Do not handle case where servicemonitor and podmonitor selectors are empty
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
* make format
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
* make --always-make format generate
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
* Remove unused fields from Operator struct
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
* Add deployment mode as new selector label for agent/server ssts
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
* WIP: Fix OperatorUpgrade e2e test
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
* Panic if type casting PrometheusInterface doesn't return Prometheus/Agent
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
* Detect whether PrometheusAgent CRD is installed or not
If the operator's service account has all permissions on the cluster and
the CRD isn't installed then the PrometheusAgent controller will run
but fail because of the absence of the CRD.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Create dedicated governing service for Prometheus agent
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
---------
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
/apis was a workaround for getting status about the Prometheus objects
managed by the operator. The status subresource is available since
v0.56.0 and there's no reason for not using the native Kubernetes way
rather than the operator API.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* build(deps): bump github.com/prometheus/client_golang
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.0...v1.12.1)
---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
* Add a new flag alertmanager-config-namespaces to watch
AlertmanagerConfig namespaces require Secrets list/watch, so separating
this config from general --namespaces provides better control over which
namespaces to allow Secrets RBAC access.
Fixes#3544
Signed-off-by: Will Tran <will@autonomic.ai>
* Use AlertmanagerConfigAllowList for alrtCfgInfs and nsAlrtCfgInf as well
Signed-off-by: Will Tran <will@autonomic.ai>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* alertmanager: Expose validation function for AmConfig CR
* admission: Extend admission controller for AmConf validation
* cmd:operator: Register metrics for am validating webhook
* test:e2e: Setup and test validating webhook for AmConf CR
Using github.com/go-kit/log instead of github.com/go-kit/kit reduces the
list of things this project depends on. This commit also removes the
wrapper for k8s.io/klog because none of the k8s libraries depend on it
anymore.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* removal of deprecated config-reloader resource flags for #3883
* remove rc* specific code from cmd/operator/main.go that should never run
* formatting issue corrected
* make format generate results
* kloggokit: #3326: Use klog-gokit for getting additional logs
* remove logtostderr from commadline args
* Added comment for why InitFlags is not needed.
* Addressing review comments
* Cleanup with go mod tidy
* after make generate
* fix failure
* fix failure
This change gets rid of the additional reloader that was deployed in the
Prometheus pod to monitor rules file.
It also changes the Alertmanager and Thanos ruler statefulsets to use
the container image from the `--prometheus-config-reloader` flag instead
of `--config-reloader-image`. We pick `prometheus-config-reloader`
because it supports gzipped configuration file and is "smarter" about
when to reload the configuration (e.g. it checks that the content on
disk has effectively changed before reloading).
The `--config-reloader-image` of Prometheus operator is deprecated (e.g.
it isn't used anywhere by the operator) and it may be removed in a
future release (but not before v0.45).
Since the Prometheus config reloader doesn't watch only rule directories
anymore (e.g. for Alertmanager it watches mounted secrets), it gets a
new `--watched-dir` flag that replaces the `--rules-dir` flag.
Finally the config reloader can be configured to expose metrics with the
`--listen-address` flag. The metrics are:
* `reloader_config_apply_operations_failed_total`
* `reloader_config_apply_operations_total`
* `reloader_reloads_failed_total`
* `reloader_reloads_total`
* `reloader_watch_errors_total`
* `reloader_watches`
* `reloader_watch_events_total`
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This change adds 3 metrics tracking client-go requests to the Kubernetes
API:
* `prometheus_operator_kubernetes_client_http_requests_total`, counter
with a `status_code` label.
* `prometheus_operator_kubernetes_client_http_request_duration_seconds`,
summary with a `endpoint` label.
* `prometheus_operator_kubernetes_client_rate_limiter_duration_seconds`,
summary with a `endpoint` label.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>