1 // Copyright 2021 The Kubernetes Authors. 2 // SPDX-License-Identifier: Apache-2.0 3 4 package mutator 5 6 import ( 7 "context" 8 9 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 10 ) 11 12 // Interface decouples apply-time-mutation 13 // from the concrete structs used for applying. 14 type Interface interface { 15 // Name returns a filter name (usually for logging). 16 Name() string 17 // Mutate returns true if the object was mutated. 18 // This allows the mutator to decide if mutation is needed. 19 // If mutated, a reason string is returned. 20 // If an error happens during mutation, it is returned. 21 Mutate(ctx context.Context, obj *unstructured.Unstructured) (bool, string, error) 22 } 23