pull/104285/head
Andres Martinez Gotor 2 months ago
parent 2f3eb01486
commit a608276987
  1. 32
      apps/advisor/pkg/app/utils.go

@ -75,23 +75,25 @@ func processCheck(ctx context.Context, log logging.Logger, client resource.Clien
}
c.Status.Report = *report
c.SetAnnotations(obj.GetAnnotations())
// This works, the updated object contains the new status
updated, err := client.Update(ctx, obj.GetStaticMetadata().Identifier(), c, resource.UpdateOptions{
// // This works, the updated object contains the new status
// updated, err := client.Update(ctx, obj.GetStaticMetadata().Identifier(), c, resource.UpdateOptions{
// Subresource: "status",
// })
// if err != nil {
// return err
// }
// log.Info("updated", "updated", updated)
// This also works now, need to use "status" subresource
patched, err := client.Patch(ctx, obj.GetStaticMetadata().Identifier(), resource.PatchRequest{
Operations: []resource.PatchOperation{{
Operation: resource.PatchOpAdd,
Path: "/status",
Value: c.Status,
}},
}, resource.PatchOptions{
Subresource: "status",
})
if err != nil {
return err
}
log.Info("updated", "updated", updated)
// This doesn't work, the patched object contains the old status
// patched, err := client.Patch(ctx, obj.GetStaticMetadata().Identifier(), resource.PatchRequest{
// Operations: []resource.PatchOperation{{
// Operation: resource.PatchOpAdd,
// Path: "/status",
// Value: c.Status,
// }},
// }, resource.PatchOptions{})
// log.Info("patched", "patched", patched)
log.Info("patched", "patched", patched)
return err
}

Loading…
Cancel
Save