This change allows to run the operator locally as a different user:
```
export IMPERSONATE_USER=system:serviceaccount:default:system
./run/run-external.sh -c
```
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
The `--as` argument allows to run the operator while impersonating a
different user. It's useful to run the operator outside of the cluster
as a service account instead of `kubeadmin`.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* feat: adding golden files support on webconfig tests
I'm adding golden file supports on webconfig package, solves #5741
---------
Signed-off-by: Nicolas Takashi <nicolas.tcs@hotmail.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
* simplify running operator out of cluster
This patch enhances run-external.sh script to run all prerequisites
before running the operator.
The script now does the following
* checks if a deployment with name prometheus-operator is running in the
cluster.
* builds operator
* updates the CRDs
* runs the operator and stores operator log in tmp/operator.log
Signed-off-by: Sunil Thaha <sthaha@redhat.com>
* Apply suggestions from code review
---------
Signed-off-by: Sunil Thaha <sthaha@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Images with the `main` tag aren't signed because if I understand
correctly, it's not possible to sign again an existing image. Otherwise
we would have to suffix the tag with the short commit ID (e.g.
`:main-01234567`). At the same time, using the main (or latest) tag isn't
the best choice in terms of reproducibility/stability so not having
signed images is probably not a big deal.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Create Interface between Prometheus and PrometheusAgent
* Refactor: Use PrometheusInterface to generate configuration
* Hide PrometheusInterface from API documentation
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
This commit uses the `applyconfiguration-gen` tool to generate the
"apply configuration" types for all monitoring types. It enables users
to run server-side apply operations from Go code.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
The admission webhook service has to deployed with TLS enabled because
the Kubernetes API only supports webhook URLs with a "https://" scheme.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Documentation: add more content to online docs
This change adds the following content to prometheus-operator.dev website:
* New "User Guides" section with the "Getting Started" and "Alerting" guides.
I've updated/cleaned up the existing content to match with the current
release of the operator.
* "Storage" and "Strategic Merge Patch" pages to the Operator section.
The "Storage" page also documents how to manually expand statefulset volumes
(related to #4079).
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Address Philip's comments
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* scripts:tools: Add gen-crd-api-reference-docs tool
Signed-off-by: Philip Gough <philip.p.gough@gmail.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* make: Add targets and scripts to generate docs with gen-crd-api-reference-docs tool
Signed-off-by: Philip Gough <philip.p.gough@gmail.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* scripts/go.mod: bump gen-crd-api-reference-docs version
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Makefile: add target to generate v1beta1 docs
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Documentation/apis: regenerate
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Makefile: remove unused variable
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* pkg/apis/monitoring: reorder markers for API docs
gen-crd-api-reference-docs requires codegen markers to appear before the
comments describing the types. Otherwise resource types aren't properly
identified.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Documentation/apis: regenerate
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* update docs configuration
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Documentation/apis: regenerate
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Add README.md for API documentation generation
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Skip embedded fields
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Move docgen tooling to Documentation/
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* keep all APIs in a single page
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Fix header in pkg.tpl
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Update docs README.md
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Add link for apiextensions-apiserver module
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Documentation: regenerate
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Fix links in documentation
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* update pkg.tpl
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Fix check-docs CI
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Documentation/api.md: regenerate
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* scripts: bump mdox version
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Philip Gough <philip.p.gough@gmail.com>
Recent versions of Hugo fails to render `troubleshooting.md` when the
`custom-metrics-elements.png` image isn't located in a static directory.
To avoid further complication with the `synchronize.sh` script from the
github.com/prometheus-operator/website project, images are now stored
under `Documentation/img` and the script will copy this directory to the
`static` directory of the website. Any content that wants to include an
image needs to follow the same approach.
The caveat is that the image will not be displayed from the GitHub UI. I
have tried to use page bundles [1] which would circumvent this
limitation but it would involve moving all the individual MarkDown files
into separate directories and rearrange the site's structure.
See also https://github.com/prometheus-operator/website/pull/17
[1] https://gohugo.io/content-management/page-bundles/
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: add v1beta1 for AlertmanagerConfig CRD
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: implement conversion webhook for AlertmanagerConfig
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: add jsonnet support for CRD conversion webhook
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* test: configure conversion webhook for AlertmanagerConfig
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* test/e2e: add test for v1alpha1<->v1beta1 conversion
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Documentation: update webhook documentation
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* pkg/apis/monitoring/v1beta1: remove Regex field from Matcher type
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: rename muteTimeIntervals field to timeIntervals (v1beta1)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: restore short name for AlertmanagerConfig
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* pkg/admission: add unit test for conversion webhook
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* pkg/apis/monitoring/v1beta1: replace v1.SecretKeySelector by SecretKeySelector
v1.SecretKeySelector has an `Optional` field which doesn't make sense
in the context of the AlertmanagerConfig CRD. Not depending on an
external type also means that we can enforce that key and name values
are not empty.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: regenerate
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: make AlertmanagerConfig v1beta1 an opt-in choice
Enabling by default AlertmanagerConfig v1beta1 by default means that
users would have to configure the conversion webhook and it must be
performed in advance or at the same time users upgrade to the latest
operator version. To offer a smoother transition, we offer
AlertmanagerConfig v1beta1 as an opt-in feature: it's neither included
in the bundle.yaml file nor in the example/prometheus-operator-crd/
manifests.
People that want to enable v1beta1 should use the
example/prometheus-operator-crd-full manifests. For jsonnet users, the
Prometheus operator jsonnet library has a new
`enableAlertmanagerConfigV1beta1` configuration option that can be set
to `true`.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: add Telegram support in v1beta1
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* *: synchronize with latest main changes
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Documentation/user-guides/webhook.md: clarify mutation webhook
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* example: regenerate
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
The end-to-end tests and jsonnet code were using
`quay.io/prometheus-operator/prometheus-admission-webhook` which doesn't
exist.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>