...

Source file src/k8s.io/apimachinery/pkg/util/managedfields/internal/manager.go

Documentation: k8s.io/apimachinery/pkg/util/managedfields/internal

     1  /*
     2  Copyright 2022 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package internal
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  	"k8s.io/apimachinery/pkg/runtime"
    22  	"sigs.k8s.io/structured-merge-diff/v4/fieldpath"
    23  )
    24  
    25  // Managed groups a fieldpath.ManagedFields together with the timestamps associated with each operation.
    26  type Managed interface {
    27  	// Fields gets the fieldpath.ManagedFields.
    28  	Fields() fieldpath.ManagedFields
    29  
    30  	// Times gets the timestamps associated with each operation.
    31  	Times() map[string]*metav1.Time
    32  }
    33  
    34  // Manager updates the managed fields and merges applied configurations.
    35  type Manager interface {
    36  	// Update is used when the object has already been merged (non-apply
    37  	// use-case), and simply updates the managed fields in the output
    38  	// object.
    39  	//  * `liveObj` is not mutated by this function
    40  	//  * `newObj` may be mutated by this function
    41  	// Returns the new object with managedFields removed, and the object's new
    42  	// proposed managedFields separately.
    43  	Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error)
    44  
    45  	// Apply is used when server-side apply is called, as it merges the
    46  	// object and updates the managed fields.
    47  	//  * `liveObj` is not mutated by this function
    48  	//  * `newObj` may be mutated by this function
    49  	// Returns the new object with managedFields removed, and the object's new
    50  	// proposed managedFields separately.
    51  	Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error)
    52  }
    53  

View as plain text