File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -296,6 +296,11 @@ func (c *Controller) syncHandler(key string) error {
296296 return nil
297297 }
298298
299+ // Clean the metrics if marked for deletion
300+ if cd .ObjectMeta .DeletionTimestamp != nil {
301+ c .recorder .DeleteStatus (cd )
302+ }
303+
299304 // set status condition for new canaries
300305 if cd .Status .Conditions == nil {
301306 if err := c .setPhaseInitializing (cd ); err != nil {
Original file line number Diff line number Diff line change @@ -186,6 +186,11 @@ func (cr *Recorder) IncFailures(labels CanaryMetricLabels) {
186186 cr .failures .WithLabelValues (labels .Values ()... ).Inc ()
187187}
188188
189+ // DeleteStatus deletes the canary analysis status
190+ func (cr * Recorder ) DeleteStatus (cd * flaggerv1.Canary ) {
191+ cr .status .DeleteLabelValues (cd .Spec .TargetRef .Name , cd .Namespace )
192+ }
193+
189194// GetStatusMetric returns the status metric
190195func (cr * Recorder ) GetStatusMetric () * prometheus.GaugeVec {
191196 return cr .status
You can’t perform that action at this time.
0 commit comments