Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyConfig ¶
type ApplyConfig struct { Client client.Client Codec runtime.Codec Context context.Context Logger logr.Logger Overwrite bool Scheme *runtime.Scheme // contains filtered or unexported fields }
ApplyConfig is the configuration that is used for applying object changes.
The configuration requires a Kubernetes API Client to work properly. You can uses different options to provide the client interface, including through runtime Context, via the Manager, or directly from the Reconciler interface.
type ApplyOption ¶
type ApplyOption = func(*ApplyConfig)
ApplyOption represents an individual option of ApplyObject. The available options are:
- WithClient
- WithCodec
- WithContext
- WithLogger
- WithManager
- WithScheme
See each option for further details.
type ApplyOutcome ¶
type ApplyOutcome string
ApplyOutcome is the action result of ApplyObject call.
const ( // ObjectUnchanged indicates that the resource has not been changed. ObjectUnchanged ApplyOutcome = "unchanged" // ObjectCreated indicates that a new resource is created. ObjectCreated ApplyOutcome = "created" // ObjectUpdated indicates that changes are applied to the existing resource. ObjectUpdated ApplyOutcome = "updated" )
func ApplyObject ¶
func ApplyObject(object client.Object, options ...ApplyOption) (ApplyOutcome, error)
ApplyObject creates or patches the given object in the Kubernetes cluster.
It imitates `kubectl apply` and utilizes three-way strategic merge patch. It falls back to JSON merge patch when strategic merge patch is not possible. It annotates objects with the last configuration that was used to create or update them with the same annotation that `kubectl apply` uses.
It returns the executed operation and an error.