Merge pull request #522 from pjbgf/audit-followup

Fix inconsistent code-style raised at security audit
This commit is contained in:
Stefan Prodan 2021-12-22 10:35:00 +02:00 committed by GitHub
commit 1e84289623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -904,16 +904,18 @@ func (r *KustomizationReconciler) finalize(ctx context.Context, kustomization ku
func (r *KustomizationReconciler) event(ctx context.Context, kustomization kustomizev1.Kustomization, revision, severity, msg string, metadata map[string]string) { func (r *KustomizationReconciler) event(ctx context.Context, kustomization kustomizev1.Kustomization, revision, severity, msg string, metadata map[string]string) {
log := logr.FromContext(ctx) log := logr.FromContext(ctx)
annotations := map[string]string{ if r.EventRecorder != nil {
kustomizev1.GroupVersion.Group + "/revision": revision, annotations := map[string]string{
} kustomizev1.GroupVersion.Group + "/revision": revision,
}
eventtype := "Normal" eventtype := "Normal"
if severity == events.EventSeverityError { if severity == events.EventSeverityError {
eventtype = "Warning" eventtype = "Warning"
} }
r.EventRecorder.AnnotatedEventf(&kustomization, annotations, eventtype, severity, msg) r.EventRecorder.AnnotatedEventf(&kustomization, annotations, eventtype, severity, msg)
}
if r.ExternalEventRecorder != nil { if r.ExternalEventRecorder != nil {
objRef, err := reference.GetReference(r.Scheme, &kustomization) objRef, err := reference.GetReference(r.Scheme, &kustomization)