Skip to content

Commit c3908f1

Browse files
author
Israel Blancas
committed
Fix nil
Signed-off-by: Israel Blancas <[email protected]>
1 parent 24ac77a commit c3908f1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

internal/manifests/collector/collector.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,14 @@ func Build(params manifests.Params) ([]client.Object, error) {
8282
}
8383

8484
if params.Config.CreateRBACPermissions() == rbac.NotAvailable && params.Reviewer != nil {
85-
sa, err := manifests.Factory(ServiceAccount)(params)
86-
if err != nil {
87-
return nil, err
85+
saName := params.OtelCol.Spec.ServiceAccount
86+
if saName == "" {
87+
sa, err := manifests.Factory(ServiceAccount)(params)
88+
if err != nil {
89+
return nil, err
90+
}
91+
saName = sa.GetName()
8892
}
89-
saName := sa.GetName()
9093
warnings, err := CheckRbacRules(params, saName)
9194
if err != nil {
9295
params.Log.Error(err, "Error checking RBAC rules", "serviceAccount", saName)

0 commit comments

Comments
 (0)