{"modulePath":"github.com/afirth/controller-runtime","version":"v0.1.12","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package controllerutil\n\nPackage controllerutil contains utility functions for working with and implementing Controllers.\n\n## Functions\n\n```go\nfunc SetControllerReference(owner, object v1.Object, scheme *runtime.Scheme) error\n```\nSetControllerReference sets owner as a Controller OwnerReference on owned. This is used for garbage collection of the owned object and for reconciling the owner object on changes to owned (with a Watch + EnqueueRequestForOwner). Since only one OwnerReference can be a controller, it returns an error if there is another OwnerReference with Controller flag set.\n\n## Types\n\n```go\ntype AlreadyOwnedError struct {\n\tObject v1.Object\n\tOwner  v1.OwnerReference\n}\n```\nAlreadyOwnedError is an error returned if the object you are trying to assign a controller reference is already owned by another controller Object is the subject and Owner is the reference for the current owner\n\n```go\nfunc (e *AlreadyOwnedError) Error() string\n```\n\n```go\ntype MutateFn func(existing runtime.Object) error\n```\nMutateFn is a function which mutates the existing object into it's desired state.\n\n```go\ntype OperationResult string\n```\nOperationResult is the action result of a CreateOrUpdate call\n\n```go\nconst (\n\t// OperationResultNone means that the resource has not been changed\n\tOperationResultNone OperationResult = \"unchanged\"\n\t// OperationResultCreated means that a new resource is created\n\tOperationResultCreated OperationResult = \"created\"\n\t// OperationResultUpdated means that an existing resource is updated\n\tOperationResultUpdated OperationResult = \"updated\"\n)\n```\n\n```go\nfunc CreateOrUpdate(ctx context.Context, c client.Client, obj runtime.Object, f MutateFn) (OperationResult, error)\n```\nCreateOrUpdate creates or updates the given object obj in the Kubernetes cluster. The object's desired state should be reconciled with the existing state using the passed in ReconcileFn. obj must be a struct pointer so that obj can be updated with the content returned by the Server.\n\nIt returns the executed operation and an error.\n\n","path":"github.com/afirth/controller-runtime/pkg/controller/controllerutil","name":"controllerutil","synopsis":"Package controllerutil contains utility functions for working with and implementing Controllers.","isRedistributable":true}
