1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-16 09:16:38 +00:00
prometheus-operator/scripts/generate/build-conversion-webhook-patch-for-alermanagerconfig-crd.sh
Simon Pasquier 1829e379cd
*: add v1beta1 for AlertmanagerConfig CRD (#4709)
* *: 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>
2022-05-31 11:11:00 +02:00

10 lines
353 B
Bash
Executable file

#!/usr/bin/env bash
# exit immediately when a command fails
set -e
# only exit with zero if all commands of the pipeline exit successfully
set -o pipefail
# error on unset variables
set -u
jsonnet -J scripts/generate/vendor scripts/generate/conversion-webhook-patch-for-alermanagerconfig-crd.jsonnet > "example/alertmanager-crd-conversion/patch.json"