Skip to content

Commit

Permalink
Merge pull request #692 from fluxcd/event-meta-token
Browse files Browse the repository at this point in the history
Use last attempted values checksum as event metadata token
  • Loading branch information
hiddeco committed May 24, 2023
2 parents 9250364 + 4df753a commit cb4da0f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions internal/controller/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,15 +794,22 @@ func (r *HelmReleaseReconciler) requestsForHelmChartChange(ctx context.Context,

// event emits a Kubernetes event and forwards the event to notification controller if configured.
func (r *HelmReleaseReconciler) event(_ context.Context, hr v2.HelmRelease, revision, severity, msg string) {
var meta map[string]string
if revision != "" {
meta = map[string]string{v2.GroupVersion.Group + "/revision": revision}
var eventMeta map[string]string

if revision != "" || hr.Status.LastAttemptedValuesChecksum != "" {
if revision != "" {
eventMeta = map[string]string{v2.GroupVersion.Group + "/" + eventv1.MetaRevisionKey: revision}
}
if hr.Status.LastAttemptedValuesChecksum != "" {
eventMeta = map[string]string{v2.GroupVersion.Group + "/" + eventv1.MetaTokenKey: hr.Status.LastAttemptedValuesChecksum}
}
}
eventtype := "Normal"

eventType := corev1.EventTypeNormal
if severity == eventv1.EventSeverityError {
eventtype = "Warning"
eventType = corev1.EventTypeWarning
}
r.EventRecorder.AnnotatedEventf(&hr, meta, eventtype, severity, msg)
r.EventRecorder.AnnotatedEventf(&hr, eventMeta, eventType, severity, msg)
}

func (r *HelmReleaseReconciler) recordSuspension(ctx context.Context, hr v2.HelmRelease) {
Expand Down

0 comments on commit cb4da0f

Please sign in to comment.