Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: add v1beta1 for AlertmanagerConfig CRD #4709

Merged

Conversation

simonpasquier
Copy link
Contributor

@simonpasquier simonpasquier commented Apr 8, 2022

Description

This change implements #4677. It includes an extension of the webhook admission service that enables converting from v1alpha1 to v1beta1 (and vice-versa). The stored version is v1alpha1 to enable smooth migration.

As discussed during the project office hours and documented in the associated issue, v1beta1 is going to be opt-in for 2 releases. This is to let time for users to install the conversion webhook as long as they don't want/need to support v1beta1.

  • Implement v1beta1 as a 1:1 copy of v1alph1.
  • Implement conversion webhook.
  • Unit tests for conversion webhook.
  • Remove the regex field from the Matcher type.
  • Rename spec.muteTimeIntervals to spec.timeIntervals
  • Rename the MuteTimeInterval type to TimeInterval (and TimeInterval type to TimePeriod).
  • Replace v1.SecretKeySelector by SecretKeySelector (optional field removed + name and key required).
  • Update Documentation/user-guides/webhook.md
  • Fix Documentation/api.md (edit: v1beta1 being opt-in, the documentation part can wait a bit and it would be best tackled as part of Support documenting different types in po-docgen #4376).

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.

Added v1beta1 version of AlertmanagerConfig CRD.

@simonpasquier simonpasquier force-pushed the amconfig-v1beta1-poc branch 6 times, most recently from e3634ca to ad1f614 Compare April 19, 2022 09:34
@simonpasquier simonpasquier marked this pull request as ready for review April 19, 2022 11:32
@simonpasquier simonpasquier requested review from paulfantom and a team as code owners April 19, 2022 11:32
@simonpasquier simonpasquier force-pushed the amconfig-v1beta1-poc branch 4 times, most recently from 74ed626 to 3682765 Compare April 20, 2022 14:36
@simonpasquier
Copy link
Contributor Author

@philipgough @paulfantom @fpetkovski can you please review this?

}
}
}
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Makefile Show resolved Hide resolved
@simonpasquier
Copy link
Contributor Author

@prometheus-operator/prometheus-operator-reviewers please have a look. As discussed during our last office hours, this requires explicit action from cluster admins to expose the v1beta1 version so this is quite safe for the majority of users.

@simonpasquier
Copy link
Contributor Author

@paulfantom @fpetkovski @philipgough I'd welcome a review on the PR. Ideally I'd like to have it in v0.57.0 so folks can start playing with it :)

@simonpasquier simonpasquier force-pushed the amconfig-v1beta1-poc branch 2 times, most recently from 9a83cc3 to 5a70542 Compare May 30, 2022 07:24
Copy link
Contributor

@philipgough philipgough left a comment

Choose a reason for hiding this comment

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

Nice work, LGTM on green!

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
…ySelector

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>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
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>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Copy link
Member

@paulfantom paulfantom left a comment

Choose a reason for hiding this comment

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

Awesome work! 💯

@simonpasquier simonpasquier merged commit 1829e37 into prometheus-operator:main May 31, 2022
@simonpasquier simonpasquier deleted the amconfig-v1beta1-poc branch May 31, 2022 09:16
simonpasquier added a commit to simonpasquier/prometheus-operator that referenced this pull request Jun 16, 2022
The `followRedirects` field was missed in prometheus-operator#4709.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
simonpasquier added a commit to simonpasquier/prometheus-operator that referenced this pull request Jun 17, 2022
The `followRedirects` field was missed in prometheus-operator#4709.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
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.

None yet

3 participants