Skip to content

🐛 Use metav1.Object instead of Object #1087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/controller/controllerutil/controllerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func mutate(f MutateFn, key client.ObjectKey, obj runtime.Object) error {
type MutateFn func() error

// AddFinalizer accepts an Object and adds the provided finalizer if not present.
func AddFinalizer(o Object, finalizer string) {
func AddFinalizer(o metav1.Object, finalizer string) {
f := o.GetFinalizers()
for _, e := range f {
if e == finalizer {
Expand All @@ -257,12 +257,12 @@ func AddFinalizerWithError(o runtime.Object, finalizer string) error {
if err != nil {
return err
}
AddFinalizer(m.(Object), finalizer)
AddFinalizer(m, finalizer)
return nil
}

// RemoveFinalizer accepts an Object and removes the provided finalizer if present.
func RemoveFinalizer(o Object, finalizer string) {
func RemoveFinalizer(o metav1.Object, finalizer string) {
f := o.GetFinalizers()
for i := 0; i < len(f); i++ {
if f[i] == finalizer {
Expand All @@ -282,12 +282,12 @@ func RemoveFinalizerWithError(o runtime.Object, finalizer string) error {
if err != nil {
return err
}
RemoveFinalizer(m.(Object), finalizer)
RemoveFinalizer(m, finalizer)
return nil
}

// ContainsFinalizer checks an Object that the provided finalizer is present.
func ContainsFinalizer(o Object, finalizer string) bool {
func ContainsFinalizer(o metav1.Object, finalizer string) bool {
f := o.GetFinalizers()
for _, e := range f {
if e == finalizer {
Expand Down