AmitKumarDas / metac

It is metacontroller and more
Apache License 2.0
57 stars 16 forks source link

feat: display internal errors against custom resource status fields #144

Open AmitKumarDas opened 4 years ago

AmitKumarDas commented 4 years ago

ProblemStatement: As a DevOps engineer, I want metac to display internal errors such as RBAC failure, discovery failure, & other runtime errors that happens during reconciliation against the custom resource that was being reconciled. As of now, I have no idea if something has gone wrong unless I check the logs of metac.

Refer:

AmitKumarDas commented 4 years ago

There has been several discussions to expose these errors as events & metrics. However, metac should first make this error available in a way that provides immediate help. Events & metrics will be designed & implemented eventually.

Metac can log these runtime errors against a specific field of custom resource e.g. status.metac.error In addition, this should be enabled only when the sync hook response api desires such a behaviour via a boolean field.

e.g. https://github.com/AmitKumarDas/metac/blob/master/controller/generic/hooks.go#L49

type SyncHookResponse struct {

        ....

        // this is the new boolean flag
        // if true metac will set the custom resource's status.metac.error 
        // with latest runtime error
        LogRuntimeError  bool `json:"logRuntimeError"`
}