Refactor repeated calls to 'GetTemplate' function

Summary

Related to #434 (closed)

We have may calls to GetTemplate in various functions that return objects from the template. Rather than calling GetTemplate each time, we can get the template once, check for errors there, and then pass the template as an argument downstream.

Additionally, we currently return nil when there is an error, when we should instead return the error to the controller. This will help us avoid vague reconciler crashes when it fails to find an object.

Acceptance criteria

  • Redundant GetTemplate calls are removed
  • template is passed as an argument where needed
Edited by Mitchell Nielsen