Documentation ¶
Index ¶
- Constants
- func AddSharer(sharedBy string, app *v1beta1.Application) string
- func ContainsSharer(sharedBy string, app *v1beta1.Application) bool
- func FirstSharer(sharedBy string) string
- func GetAppKey(app *v1beta1.Application) string
- func GetControlledBy(existing client.Object) string
- func RemoveSharer(sharedBy string, app *v1beta1.Application) string
- type APIApplicator
- type Applicator
- type ApplyOption
- func DisableUpdateAnnotation() ApplyOption
- func DryRunAll() ApplyOption
- func MakeCustomApplyOption(f func(existing, desired client.Object) error) ApplyOption
- func MustBeControllableBy(u types.UID) ApplyOption
- func MustBeControlledByApp(app *v1beta1.Application) ApplyOption
- func NotUpdateRenderHashEqual() ApplyOption
- func Quiet() ApplyOption
- func ReadOnly() ApplyOption
- func SharedByApp(app *v1beta1.Application) ApplyOption
- func TakeOver() ApplyOption
Constants ¶
const (
// LabelRenderHash is the label that record the hash value of the rendering resource.
LabelRenderHash = "oam.dev/render-hash"
)
Variables ¶
This section is empty.
Functions ¶
func AddSharer ¶ added in v1.5.0
func AddSharer(sharedBy string, app *v1beta1.Application) string
AddSharer add sharer
func ContainsSharer ¶ added in v1.5.0
func ContainsSharer(sharedBy string, app *v1beta1.Application) bool
ContainsSharer check if the shared-by annotation contains the target application
func FirstSharer ¶ added in v1.5.0
FirstSharer get the first sharer of the application
func GetAppKey ¶ added in v1.5.0
func GetAppKey(app *v1beta1.Application) string
GetAppKey construct the key for identifying the application
func GetControlledBy ¶ added in v1.5.0
GetControlledBy extract the application that controls the current resource
func RemoveSharer ¶ added in v1.5.0
func RemoveSharer(sharedBy string, app *v1beta1.Application) string
RemoveSharer remove sharer
Types ¶
type APIApplicator ¶
type APIApplicator struct {
// contains filtered or unexported fields
}
APIApplicator implements Applicator
func NewAPIApplicator ¶
func NewAPIApplicator(c client.Client) *APIApplicator
NewAPIApplicator creates an Applicator that applies state to an object or creates the object if not exist.
func (*APIApplicator) Apply ¶
func (a *APIApplicator) Apply(ctx context.Context, desired client.Object, ao ...ApplyOption) error
Apply applies new state to an object or create it if not exist
type Applicator ¶
Applicator applies new state to an object or create it if not exist. It uses the same mechanism as `kubectl apply`, that is, for each resource being applied, computing a three-way diff merge in client side based on its current state, modified stated, and last-applied-state which is tracked through an specific annotation. If the resource doesn't exist before, Apply will create it.
type ApplyOption ¶
ApplyOption is called before applying state to the object. ApplyOption is still called even if the object does NOT exist. If the object does not exist, `existing` will be assigned as `nil`. nolint
func DisableUpdateAnnotation ¶ added in v1.2.4
func DisableUpdateAnnotation() ApplyOption
DisableUpdateAnnotation disable write last config to annotation
func DryRunAll ¶ added in v1.5.0
func DryRunAll() ApplyOption
DryRunAll executing all validation, etc without persisting the change to storage.
func MakeCustomApplyOption ¶ added in v1.1.7
func MakeCustomApplyOption(f func(existing, desired client.Object) error) ApplyOption
MakeCustomApplyOption let user can generate applyOption that restrict change apply action.
func MustBeControllableBy ¶
func MustBeControllableBy(u types.UID) ApplyOption
MustBeControllableBy requires that the new object is controllable by an object with the supplied UID. An object is controllable if its controller reference includes the supplied UID.
func MustBeControlledByApp ¶ added in v1.2.0
func MustBeControlledByApp(app *v1beta1.Application) ApplyOption
MustBeControlledByApp requires that the new object is controllable by versioned resourcetracker
func NotUpdateRenderHashEqual ¶ added in v1.1.7
func NotUpdateRenderHashEqual() ApplyOption
NotUpdateRenderHashEqual if the render hash of new object equal to the old hash, should not apply.
func SharedByApp ¶ added in v1.5.0
func SharedByApp(app *v1beta1.Application) ApplyOption
SharedByApp let the resource be sharable
func TakeOver ¶ added in v1.7.0
func TakeOver() ApplyOption
TakeOver allow take over resources without app owner