diff --git a/controllers/common/common.go b/controllers/common/common.go index bd3c7c6..17a05fc 100644 --- a/controllers/common/common.go +++ b/controllers/common/common.go @@ -209,13 +209,15 @@ func (r *Client) PatchWfAlertAndAlertsConfigStatus( log = log.WithValues("wfAlertCR", wfAlert.Name, "alertsConfigCR", alertsConfig.Name) alertStatus.LastUpdatedTimestamp = metav1.Now() alertStatusBytes, _ := json.Marshal(alertStatus) - patch := []byte(fmt.Sprintf("{\"status\":{\"state\": \"%s\", \"alertsStatus\":{\"%s\":%s}}}", state, wfAlert.Name, string(alertStatusBytes))) + retryCount := alertsConfig.Status.RetryCount + patch := []byte(fmt.Sprintf("{\"status\":{\"state\": \"%s\", \"retryCount\": %d, \"alertsStatus\":{\"%s\":%s}}}", state, retryCount, wfAlert.Name, string(alertStatusBytes))) _, err := r.PatchStatus(ctx, alertsConfig, client.RawPatch(types.MergePatchType, patch), state, requeueTime...) if err != nil { log.Error(err, "unable to patch the status for alerts config object") return err } - wfAlertStatusPatch := []byte(fmt.Sprintf("{\"status\":{\"state\": \"%s\",\"alertsStatus\":{\"%s\":%s}}}", state, alertsConfig.Name, string(alertStatusBytes))) + wfRetryCount := wfAlert.Status.RetryCount + wfAlertStatusPatch := []byte(fmt.Sprintf("{\"status\":{\"state\": \"%s\", \"retryCount\": %d,\"alertsStatus\":{\"%s\":%s}}}", state, wfRetryCount, alertsConfig.Name, string(alertStatusBytes))) if err != nil { log.Error(err, "unable to patch the status for wavefront alert object") return err diff --git a/go.mod b/go.mod index 75fbb6e..ac315d7 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/onsi/ginkgo v1.16.4 github.com/onsi/gomega v1.16.0 golang.org/x/mod v0.5.1 // indirect - golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac // indirect + golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 // indirect //golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac // indirect golang.org/x/tools v0.1.7 // indirect k8s.io/api v0.19.2 diff --git a/go.sum b/go.sum index 109ce39..a264450 100644 --- a/go.sum +++ b/go.sum @@ -609,6 +609,8 @@ golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef h1:fPxZ3Umkct3LZ8gK9nbk+DWDJ golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 h1:KzbpndAYEM+4oHRp9JmB2ewj0NHHxO3Z0g7Gus2O1kk= +golang.org/x/sys v0.0.0-20211015200801-69063c4bb744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=