Introduce new preview auto-scaling mode for ARC. (#2153)
Co-authored-by: Cory Miller <[email protected]> Co-authored-by: Nikola Jokic <[email protected]> Co-authored-by: Ava Stancu <[email protected]> Co-authored-by: Ferenc Hammerl <[email protected]> Co-authored-by: Francesco Renzi <[email protected]> Co-authored-by: Bassem Dghaidi <[email protected]>
This commit is contained in:
co-authored by
Cory Miller
Nikola Jokic
Ava Stancu
Ferenc Hammerl
Francesco Renzi
Bassem Dghaidi
parent
619667fc3b
commit
622eaa34f8
@@ -0,0 +1,22 @@
|
||||
package actionsgithubcom
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
kclient "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
type object[T kclient.Object] interface {
|
||||
kclient.Object
|
||||
DeepCopy() T
|
||||
}
|
||||
|
||||
type patcher interface {
|
||||
Patch(ctx context.Context, obj kclient.Object, patch kclient.Patch, opts ...kclient.PatchOption) error
|
||||
}
|
||||
|
||||
func patch[T object[T]](ctx context.Context, client patcher, obj T, update func(obj T)) error {
|
||||
original := obj.DeepCopy()
|
||||
update(obj)
|
||||
return client.Patch(ctx, obj, kclient.MergeFrom(original))
|
||||
}
|
||||
Reference in New Issue
Block a user