Skip to content

Commit

Permalink
Make sure we don't add UI secret to container if it is "".
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles-Garnsey committed Jan 12, 2024
1 parent 507e3ae commit d4c039a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/reaper/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ func NewReaper(
if err != nil {
return desiredReaper, err
}
err = secret.AddInjectionAnnotationReaperContainers(&desiredReaper.Spec.ResourceMeta.Pods, desiredReaper.Spec.UiUserSecretRef.Name)
if err != nil {
return desiredReaper, err
if desiredReaper.Spec.UiUserSecretRef != nil && desiredReaper.Spec.UiUserSecretRef.Name != "" {
err = secret.AddInjectionAnnotationReaperContainers(&desiredReaper.Spec.ResourceMeta.Pods, desiredReaper.Spec.UiUserSecretRef.Name)
if err != nil {
return desiredReaper, err
}

Check warning on line 89 in pkg/reaper/resource.go

View check run for this annotation

Codecov / codecov/patch

pkg/reaper/resource.go#L85-L89

Added lines #L85 - L89 were not covered by tests
}
} else {
logger.Info("Auth not enabled, no secrets added to Reaper spec")

Check warning on line 92 in pkg/reaper/resource.go

View check run for this annotation

Codecov / codecov/patch

pkg/reaper/resource.go#L91-L92

Added lines #L91 - L92 were not covered by tests
Expand Down

0 comments on commit d4c039a

Please sign in to comment.