Documentation ¶
Index ¶
- Variables
- func AsListOfUnstructured(lockedResources []LockedResource) []unstructured.Unstructured
- func GetResources(lockedResources []LockedResource) []apis.Resource
- type LockedResource
- type Set
- func (s *Set) Add(items ...LockedResource)
- func (s *Set) Clear()
- func (s *Set) Copy() *Set
- func (s *Set) Each(f func(item LockedResource) bool)
- func (s *Set) Has(items ...LockedResource) bool
- func (s *Set) HasAny(items ...LockedResource) bool
- func (s *Set) IsEmpty() bool
- func (s *Set) IsEqual(t *Set) bool
- func (s *Set) IsSubset(t *Set) bool
- func (s *Set) IsSuperset(t *Set) bool
- func (s *Set) List() []LockedResource
- func (s *Set) Merge(t *Set)
- func (s *Set) Pop() LockedResource
- func (s *Set) Pop2() (LockedResource, bool)
- func (s *Set) Remove(items ...LockedResource)
- func (s *Set) Separate(t *Set)
- func (s *Set) Size() int
- func (s *Set) String() string
Constants ¶
This section is empty.
Variables ¶
var DefaultExcludedPaths = []string{".metadata", ".status", ".spec.replicas"}
DefaultExcludedPaths represents paths that are exlcuded by default in all resources
var DefaultExcludedPathsSet = strset.New(DefaultExcludedPaths...)
DefaultExcludedPathsSet represents paths that are exlcuded by default in all resources
Functions ¶
func AsListOfUnstructured ¶
func AsListOfUnstructured(lockedResources []LockedResource) []unstructured.Unstructured
AsListOfUnstructured given a list of LockedResource, returns a list of unstructured.Unstructured
func GetResources ¶ added in v0.2.1
func GetResources(lockedResources []LockedResource) []apis.Resource
GetResources returs an arrays of apis.Resources from an arya of LockedResources, useful for mass operations on the LockedResources
Types ¶
type LockedResource ¶
type LockedResource struct { // unstructured.Unstructured is the resource to be locked unstructured.Unstructured // ExcludedPaths are the jsonPaths to be excluded when consider whether the resource has changed ExcludedPaths []string }
LockedResource represents a resource to be locked down by a LockedResourceReconciler within a LockedResourceManager
func GetLockedResources ¶
func GetLockedResources(resources []apis.LockedResource) ([]LockedResource, error)
GetLockedResources turns an array of Resources as read from an API into an array of LockedResources, usable by the LockedResourceManager
func GetLockedResourcesFromTemplates ¶ added in v0.2.1
func GetLockedResourcesFromTemplates(resources []apis.LockedResourceTemplate, params interface{}) ([]LockedResource, error)
GetLockedResourcesFromTemplate turns an array of ResourceTemplates as read from an API into an array of LockedResources using a params to process the templates
func (*LockedResource) GetKey ¶
func (lr *LockedResource) GetKey() string
GetKey returns a unique key from a locked reosurce, the key is the concatenation of apiVersion/kind/namespace/name
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is the main set structure that holds all the data and methods used to working with the set.
func Difference ¶
Difference returns a new set which contains items which are in in the first set but not in the others.
func Intersection ¶
Intersection returns a new set which contains items that only exist in all given sets.
func NewWithSize ¶
NewWithSize creates a new Set and gives make map a size hint.
func SymmetricDifference ¶
SymmetricDifference returns a new set which s is the difference of items which are in one of either, but not in both.
func Union ¶
Union is the merger of multiple sets. It returns a new set with all the elements present in all the sets that are passed.
func (*Set) Add ¶
func (s *Set) Add(items ...LockedResource)
Add includes the specified items (one or more) to the Set. The underlying Set s is modified. If passed nothing it silently returns.
func (*Set) Each ¶
func (s *Set) Each(f func(item LockedResource) bool)
Each traverses the items in the Set, calling the provided function for each Set member. Traversal will continue until all items in the Set have been visited, or if the closure returns false.
func (*Set) Has ¶
func (s *Set) Has(items ...LockedResource) bool
Has looks for the existence of items passed. It returns false if nothing is passed. For multiple items it returns true only if all of the items exist.
func (*Set) HasAny ¶
func (s *Set) HasAny(items ...LockedResource) bool
HasAny looks for the existence of any of the items passed. It returns false if nothing is passed. For multiple items it returns true if any of the items exist.
func (*Set) IsSuperset ¶
IsSuperset tests whether t is a superset of s.
func (*Set) List ¶
func (s *Set) List() []LockedResource
List returns a slice of all items. There is also StringSlice() and IntSlice() methods for returning slices of type string or int.
func (*Set) Merge ¶
Merge is like Union, however it modifies the current Set it's applied on with the given t Set.
func (*Set) Pop ¶
func (s *Set) Pop() LockedResource
Pop deletes and returns an item from the Set. The underlying Set s is modified. If Set is empty, the zero value is returned.
func (*Set) Pop2 ¶
func (s *Set) Pop2() (LockedResource, bool)
Pop2 tries to delete and return an item from the Set. The underlying Set s is modified. The second value is a bool that is true if the item existed in the set, and false if not. If Set is empty, the zero value and false are returned.
func (*Set) Remove ¶
func (s *Set) Remove(items ...LockedResource)
Remove deletes the specified items from the Set. The underlying Set s is modified. If passed nothing it silently returns.