Repository navigation
feat: add initial silence crd - #7806
danielmellado wants to merge 1 commit into
Conversation
67492b0 to
66771eb
Compare
| } | ||
|
|
||
| // SilenceStatus tracks the synchronization state across multiple Alertmanager instances | ||
| type SilenceStatus struct { |
There was a problem hiding this comment.
Since a Silence can be selected by several Alertmanager resources (*), we need a structure that allows for it. You can take a look at https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/proposals/accepted/202501-configuration-object-status-subresource.md
(*) the most likely case is that a Silence resource is associated to a single Alertmanager resource but we can't exclude the possibilty.
There was a problem hiding this comment.
(nit) I would defer the example for now.
| // Comment provides context about the silence, typically explaining | ||
| // the reason for creating it (e.g., "Scheduled maintenance window"). | ||
| // +optional | ||
| Comment string `json:"comment,omitempty"` |
There was a problem hiding this comment.
shouldn't Comment be always required?
|
|
||
| // ExpiresAt specifies when the silence expires and alert notifications | ||
| // resume. This field is required to prevent indefinite silences. | ||
| ExpiresAt metav1.Time `json:"expiresAt"` |
| // AlertmanagerRef references a specific Alertmanager instance to apply this silence to. | ||
| // If not specified, the silence applies to all Alertmanager instances in the namespace. | ||
| // +optional | ||
| AlertmanagerRef *AlertmanagerRef `json:"alertmanagerRef,omitempty"` |
There was a problem hiding this comment.
As mentioned in the proposal PR, I'm not sure that we want to allow this.
| // SilenceSynced indicates the silence is synchronized across all target Alertmanager instances. | ||
| SilenceSynced SilenceConditionType = "Synced" | ||
| // SilenceFailed indicates an error occurred during Alertmanager API interaction. | ||
| SilenceFailed SilenceConditionType = "Failed" |
There was a problem hiding this comment.
What's the difference between synced, ready and failed conditions? Can we trim down to only 1 condition (e.g. Ready) which would be True when the silence is applied and False otherwise?
66771eb to
f9346e7
Compare
4f4d7a0 to
0cf1e7e
Compare
This commit implements the first implementation of the Silence CRD proposed in [1]. It follows existing prometheus-operator patternsfrom other CRDs and proposes the new api to v1alpha1. [1] prometheus-operator#7798 Signed-off-by: Daniel Mellado <[email protected]> Co-authored-by: Mohamed Chiheb Ben Jemaa <[email protected]> Signed-off-by: Daniel Mellado <[email protected]>
0cf1e7e to
1e50574
Compare
| // +required | ||
| Comment string `json:"comment"` | ||
| // expiresAt specifies when the silence expires and alert notifications | ||
| // resume. This field is required to prevent indefinite silences. |
There was a problem hiding this comment.
| // resume. This field is required to prevent indefinite silences. | |
| // resume. This field is required because Alertmanager requires an end date for silences. |
| } | ||
|
|
||
| // SilenceSpec defines the desired state of a Silence. | ||
| type SilenceSpec struct { |
There was a problem hiding this comment.
we likely need a "created by" field since it's required by Alertmanager API.
| // It corresponds to the metadata generation field, indicating whether the | ||
| // status reflects the latest changes to the resource. | ||
| // +optional | ||
| ObservedGeneration int64 `json:"observedGeneration,omitempty"` |
There was a problem hiding this comment.
observedGeneration is at the binding level, same for conditions.
| Name string `json:"name"` | ||
| // namespace is the namespace of the Alertmanager resource. | ||
| // +required | ||
| Namespace string `json:"namespace"` |
There was a problem hiding this comment.
we need group and resource fields too.
| // silenceID is the unique identifier of the silence in the Alertmanager API. | ||
| // This is populated after the silence is successfully created. | ||
| // +optional | ||
| SilenceID string `json:"silenceID,omitempty"` |
There was a problem hiding this comment.
For now maybe we can stop at the minimal information: the bound alertmanager instance + the set of conditions?
Proposes a Silence custom resource for prometheus-operator, so that Alertmanager silences can be managed declaratively through the Kubernetes API rather than only through the Alertmanager UI or REST API. Supersedes the proposal in prometheus-operator#7798, and builds on the original in prometheus-operator#5485 and the API review in prometheus-operator#7806. The status subresource follows the accepted configuration-resource convention, with the Alertmanager-assigned UUID as its one addition: the silence API is not declarative, so the handle it returns on creation is the only way to address a silence later, and it cannot be re-derived. Related: prometheus-operator#5452, prometheus-operator#2398, prometheus-operator#5836 Co-authored-by: Mohamed Chiheb Ben Jemaa <[email protected]> Co-authored-by: Daniel Mellado <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Nigel Smith <[email protected]>
Proposes a Silence custom resource for prometheus-operator, so that Alertmanager silences can be managed declaratively through the Kubernetes API rather than only through the Alertmanager UI or REST API. Supersedes the proposal in prometheus-operator#7798, and builds on the original in prometheus-operator#5485 and the API review in prometheus-operator#7806. The status subresource follows the accepted configuration-resource convention, with the Alertmanager-assigned UUID as its one addition: the silence API is not declarative, so the handle it returns on creation is the only way to address a silence later, and it cannot be re-derived. Adds amtool and the two author handles to the spell-check dictionary, following the existing convention for contributor names. Related: prometheus-operator#5452, prometheus-operator#2398, prometheus-operator#5836 Co-authored-by: Mohamed Chiheb Ben Jemaa <[email protected]> Co-authored-by: Daniel Mellado <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Nigel Smith <[email protected]>
Proposes a Silence custom resource for prometheus-operator, so that Alertmanager silences can be managed declaratively through the Kubernetes API rather than only through the Alertmanager UI or REST API. Supersedes the proposal in prometheus-operator#7798, and builds on the original in prometheus-operator#5485 and the API review in prometheus-operator#7806. The status subresource follows the accepted configuration-resource convention, with the Alertmanager-assigned UUID as its one addition: the silence API is not declarative, so the handle it returns on creation is the only way to address a silence later, and it cannot be re-derived. Adds amtool and the two author handles to the spell-check dictionary, following the existing convention for contributor names. Related: prometheus-operator#5452, prometheus-operator#2398, prometheus-operator#5836 Co-authored-by: Mohamed Chiheb Ben Jemaa <[email protected]> Co-authored-by: Daniel Mellado <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Signed-off-by: Nigel Smith <[email protected]>
|
This pull request is being closed because it had no activity in the last 180 days. This is not a signal from the maintainers that the PR has no value. We appreciate the time and effort that you put into this work. If you're willing to re-open it, the maintainers will do their best to review it. |
Description
This commit implements the first implementation of the Silence CRD
proposed in [1]. It follows existing prometheus-operator patternsfrom
other CRDs and proposes the new api to v1alpha1.
[1] #7798
Type of change
What type of changes does your code introduce to the Prometheus operator? Put an
xin 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.)