helper

package
v0.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppliedManifestworkAgentIDFilter

func AppliedManifestworkAgentIDFilter(agentID string) factory.EventFilterFunc

AppliedManifestworkAgentIDFilter filter the appliedmanifestwork belonging to this work agent

func AppliedManifestworkHubHashFilter

func AppliedManifestworkHubHashFilter(hubHash string) factory.EventFilterFunc

AppliedManifestworkHubHashFilter filter the appliedmanifestwork belonging to this hub

func AppliedManifestworkQueueKeyFunc

func AppliedManifestworkQueueKeyFunc(hubhash string) factory.ObjectQueueKeyFunc

AppliedManifestworkQueueKeyFunc return manifestwork key from appliedmanifestwork

func ApplyOwnerReferences

func ApplyOwnerReferences(ctx context.Context, dynamicClient dynamic.Interface, gvr schema.GroupVersionResource,
	existing runtime.Object, requiredOwner metav1.OwnerReference) error

func BuildResourceMeta

func BuildResourceMeta(
	index int,
	object runtime.Object,
	restMapper meta.RESTMapper) (workapiv1.ManifestResourceMeta, schema.GroupVersionResource, error)

BuildResourceMeta builds manifest resource meta for the object

func DeleteAppliedResources

func DeleteAppliedResources(
	ctx context.Context,
	resources []workapiv1.AppliedManifestResourceMeta,
	reason string,
	dynamicClient dynamic.Interface,
	recorder events.Recorder,
	owner metav1.OwnerReference) ([]workapiv1.AppliedManifestResourceMeta, []error)

DeleteAppliedResources deletes all given applied resources and returns those pending for finalization If the uid recorded in resources is different from what we get by client, ignore the deletion.

func FindManifestConiguration

func FindManifestConiguration(resourceMeta workapiv1.ManifestResourceMeta, manifestOptions []workapiv1.ManifestConfigOption) *workapiv1.ManifestConfigOption

func GetPlacementTracker added in v0.13.0

func GuessObjectGroupVersionKind

func GuessObjectGroupVersionKind(object runtime.Object) (*schema.GroupVersionKind, error)

GuessObjectGroupVersionKind returns GVK for the passed runtime object.

func HasFinalizer

func HasFinalizer(finalizers []string, finalizer string) bool

func HubHash

func HubHash(hubServer string) string

HubHash returns a hash of hubserver NOTE: the length of hash string is 64, meaning the length of manifestwork name should be less than 189

func IsOwnedBy

func IsOwnedBy(myOwner metav1.OwnerReference, existingOwners []metav1.OwnerReference) bool

IsOwnedBy check if owner exists in the ownerrefs.

func MergeManifestConditions

func MergeManifestConditions(conditions, newConditions []workapiv1.ManifestCondition) []workapiv1.ManifestCondition

MergeManifestConditions return a new ManifestCondition array which merges the existing manifest conditions and the new manifest conditions. Rules to match ManifestCondition between two arrays: 1. match the manifest condition with the whole ManifestResourceMeta; 2. if not matched, try to match with properties other than ordinal in ManifestResourceMeta If no existing manifest condition is matched, the new manifest condition will be used.

func MergeStatusConditions

func MergeStatusConditions(conditions []metav1.Condition, newConditions []metav1.Condition) []metav1.Condition

MergeStatusConditions returns a new status condition array with merged status conditions. It is based on newConditions, and merges the corresponding existing conditions if exists.

func NewAppliedManifestWorkOwner

func NewAppliedManifestWorkOwner(appliedWork *workapiv1.AppliedManifestWork) *metav1.OwnerReference

func OwnedByTheWork

func OwnedByTheWork(gvr schema.GroupVersionResource,
	namespace, name string,
	deleteOption *workapiv1.DeleteOption) bool

OwnedByTheWork checks whether the manifest resource will be owned by the manifest work based on the deleteOption

Types

type PlacementDecisionGetter

type PlacementDecisionGetter struct {
	Client clusterlister.PlacementDecisionLister
}

func (PlacementDecisionGetter) List

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL