Skip to content

Commit

Permalink
Merge branch 'main' into security-context
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Gomes authored Jan 4, 2022
2 parents 160e6fb + e2b988a commit b823a44
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions controllers/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,22 +737,27 @@ func (r *HelmReleaseReconciler) requestsForHelmChartChange(o client.Object) []re

// event emits a Kubernetes event and forwards the event to notification controller if configured.
func (r *HelmReleaseReconciler) event(ctx context.Context, hr v2.HelmRelease, revision, severity, msg string) {
r.EventRecorder.Event(&hr, "Normal", severity, msg)
if r.EventRecorder != nil {
r.EventRecorder.Event(&hr, "Normal", severity, msg)
}

if r.ExternalEventRecorder == nil {
return
}

objRef, err := reference.GetReference(r.Scheme, &hr)
if err != nil {
logr.FromContext(ctx).Error(err, "unable to send event")
return
}

if r.ExternalEventRecorder != nil {
var meta map[string]string
if revision != "" {
meta = map[string]string{"revision": revision}
}
if err := r.ExternalEventRecorder.Eventf(*objRef, meta, severity, severity, msg); err != nil {
logr.FromContext(ctx).Error(err, "unable to send event")
return
}
var meta map[string]string
if revision != "" {
meta = map[string]string{"revision": revision}
}
if err := r.ExternalEventRecorder.Eventf(*objRef, meta, severity, severity, msg); err != nil {
logr.FromContext(ctx).Error(err, "unable to send event")
return
}
}

Expand Down

0 comments on commit b823a44

Please sign in to comment.