manage status

This commit is contained in:
kkb0318
2024-05-07 19:06:51 +09:00
parent e0cd191793
commit 16813de7cd
14 changed files with 138 additions and 101 deletions
+21
View File
@@ -0,0 +1,21 @@
package kubernetes
import (
"context"
"sigs.k8s.io/controller-runtime/pkg/client"
)
func (c KubernetesClient) PatchStatus(ctx context.Context, obj client.Object) error {
opts := &client.SubResourcePatchOptions{
PatchOptions: client.PatchOptions{
FieldManager: c.owner.Field,
},
}
u, err := c.toUnstructured(obj)
if err != nil {
return err
}
return c.client.Status().Patch(ctx, u, client.Apply, opts)
}