zero: report resource bundle reconciliation status (#4618)

* zero: report resource bundle reconciliation status

* use latest zero-sdk
This commit is contained in:
Denis Mishin 2023-10-11 10:25:34 -04:00 committed by GitHub
parent 58501896f1
commit 680a32494f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 95 deletions

View file

@ -135,6 +135,7 @@ func (c *service) syncBundle(ctx context.Context, key string) error {
result, err := c.config.api.DownloadClusterResourceBundle(ctx, fd, key, conditional)
if err != nil {
c.ReportBundleAppliedFailure(ctx, key, BundleStatusFailureDownloadError, err)
return fmt.Errorf("download bundle: %w", err)
}
@ -155,6 +156,7 @@ func (c *service) syncBundle(ctx context.Context, key string) error {
bundleRecordTypes, err := c.syncBundleToDatabroker(ctx, fd, cached.GetRecordTypes())
if err != nil {
c.ReportBundleAppliedFailure(ctx, key, BundleStatusFailureDatabrokerError, err)
return fmt.Errorf("apply bundle to databroker: %w", err)
}
current := BundleCacheEntry{
@ -171,9 +173,12 @@ func (c *service) syncBundle(ctx context.Context, key string) error {
err = c.SetBundleCacheEntry(ctx, key, current)
if err != nil {
return fmt.Errorf("set bundle cache entry: %w", err)
err = fmt.Errorf("set bundle cache entry: %w", err)
c.ReportBundleAppliedFailure(ctx, key, BundleStatusFailureDatabrokerError, err)
return err
}
c.ReportBundleAppliedSuccess(ctx, key, result.Metadata)
return nil
}