Skip to content

Commit

Permalink
api/vmalertmanagerconfig: fixes regression at config generation
Browse files Browse the repository at this point in the history
issue related to regression after 5030eaf
Validate() call mutates data and it leads to the configuration
duplicates
#554
  • Loading branch information
f41gh7 committed Nov 17, 2022
1 parent fc4abe6 commit 4a7e873
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/v1beta1/vmalertmanagerconfig_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func (r *VMAlertmanagerConfig) SetupWebhookWithManager(mgr ctrl.Manager) error {
}

func (amc *VMAlertmanagerConfig) Validate() error {
if err := parseNestedRoutes(amc.Spec.Route); err != nil {
validateSpec := amc.DeepCopy()
if err := parseNestedRoutes(validateSpec.Spec.Route); err != nil {
return fmt.Errorf("cannot parse nested route for alertmanager config err: %w", err)
}
return nil
Expand Down

0 comments on commit 4a7e873

Please sign in to comment.