...

Source file src/sigs.k8s.io/controller-runtime/pkg/finalizer/types.go

Documentation: sigs.k8s.io/controller-runtime/pkg/finalizer

     1  /*
     2  Copyright 2021 The Kubernetes Authors.
     3  Licensed under the Apache License, Version 2.0 (the "License");
     4  you may not use this file except in compliance with the License.
     5  You may obtain a copy of the License at
     6      http://www.apache.org/licenses/LICENSE-2.0
     7  Unless required by applicable law or agreed to in writing, software
     8  distributed under the License is distributed on an "AS IS" BASIS,
     9  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    10  See the License for the specific language governing permissions and
    11  limitations under the License.
    12  */
    13  
    14  package finalizer
    15  
    16  import (
    17  	"context"
    18  
    19  	"sigs.k8s.io/controller-runtime/pkg/client"
    20  )
    21  
    22  // Registerer holds Register that will check if a key is already registered
    23  // and error out and it does; and if not registered, it will add the finalizer
    24  // to the finalizers map as the value for the provided key.
    25  type Registerer interface {
    26  	Register(key string, f Finalizer) error
    27  }
    28  
    29  // Finalizer holds Finalize that will add/remove a finalizer based on the
    30  // deletion timestamp being set and return an indication of whether the
    31  // obj needs an update or not.
    32  type Finalizer interface {
    33  	Finalize(context.Context, client.Object) (Result, error)
    34  }
    35  
    36  // Finalizers implements Registerer and Finalizer to finalize all registered
    37  // finalizers if the provided object has a deletion timestamp or set all
    38  // registered finalizers if it does not.
    39  type Finalizers interface {
    40  	Registerer
    41  	Finalizer
    42  }
    43  

View as plain text