Add the update method

This commit is contained in:
2024-04-30 11:19:56 +02:00
parent 84819c5842
commit a95cf4a436
3 changed files with 116 additions and 1 deletions

View File

@ -22,6 +22,13 @@ func Create(ctx context.Context, client client.Client, obj client.Object, wait b
return nil
}
func Update(ctx context.Context, client client.Client, obj client.Object) error {
if err := client.Update(ctx, obj); err != nil {
return err
}
return nil
}
func SetOwnerRef(ctx context.Context, client client.Client, obj client.Object, owner client.Object) client.Object {
apiVersion := fmt.Sprintf("%s/%s", owner.GetObjectKind().GroupVersionKind().Group, owner.GetObjectKind().GroupVersionKind().Version)
ownerReference := []metav1.OwnerReference{