Join GitHub today
Include individual resource sync errors in Sync events #970
A sync can be a partial success, in that we skip lightly over individual resources failing to be applied. This means that bogus manifests don't get noticed, and the symptoms can be difficult to pin down if you are used to thinking
There are other measures we could take, e.g., annotating offending commits (maybe? we may not be able to pin it down); keeping a gauge of sync failures which can be alerted on. But this is a fair start.
Before we had an interface representing resources, they were generally passed around as a pair of (id string, definition byte). We can cut down on the number of representations of resources by just using `resource.Resource`. This includes returning synchronisation errors with the whole resource, rather than simply by name. Doing so means we will be able to better surface sync problems with individual resources.
Include an error report in the sync notification, with resources v. errors (with the latter coming from `kubectl` most likely). The most useful bit of information when a resource fails to sync -- more useful than the error from kubectl, even -- is the file that had a problem. Include that in the notification. Secondarily: to avoid having a long, tmpfile path in messages, make the source of resources relative to the repo.