k8sutil

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceRevisionLabel = "resource.alpha.apache.io/revision"
)

Variables

This section is empty.

Functions

func CheckResourceRevision

func CheckResourceRevision(obj runtime.Object, revisionConstraint string) (bool, error)

func DetachPodsFromStatefulset

func DetachPodsFromStatefulset(c client.Client, statefulset *appsv1.StatefulSet, log logr.Logger, additionalLabels ...map[string]string) error

DetachPodsFromStatefulset .

func GetResourceRevision

func GetResourceRevision(obj runtime.Object) (string, error)

func GetWatchPredicateForOwnedResources

func GetWatchPredicateForOwnedResources(owner runtime.Object, isController bool, scheme *runtime.Scheme, logger logr.Logger) predicate.Funcs

func GetWatchPredicateForPinot

func GetWatchPredicateForPinot() predicate.Funcs

func GetWatchPredicateForPinotService

func GetWatchPredicateForPinotService(name string) predicate.Funcs

func GetWatchPredicateForPinotServicePods

func GetWatchPredicateForPinotServicePods() predicate.Funcs

func GetWatchPredicateForTenant added in v0.0.2

func GetWatchPredicateForTenant() predicate.Funcs

func IsObjectChanged

func IsObjectChanged(oldObj, newObj runtime.Object, ignoreStatusChange bool) (bool, error)

IsObjectChanged checks whether there is an actual difference between the two objects

func NewCachedRESTMapper

func NewCachedRESTMapper(config *rest.Config) (meta.RESTMapper, error)

NewCachedRESTMapper .

func Reconcile

func Reconcile(log logr.Logger, client runtimeClient.Client, desired runtime.Object, desiredState DesiredState) error

Reconcile .

func ReconcileNamespaceLabelsIgnoreNotFound

func ReconcileNamespaceLabelsIgnoreNotFound(log logr.Logger, client runtimeClient.Client, namespace string, labels map[string]string, labelsToRemove []string, customLabelsToIgnoreReconcile ...string) error

ReconcileNamespaceLabelsIgnoreNotFound patches namespaces by adding/removing labels, returns without error if namespace is not found

func SetOwnerReferenceToObject

func SetOwnerReferenceToObject(obj runtime.Object, owner runtime.Object) ([]metav1.OwnerReference, error)

func SetResourceRevision

func SetResourceRevision(obj runtime.Object, revision string) error

Types

type Cached

type Cached struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Cached .

func (*Cached) KindFor

KindFor .

func (*Cached) KindsFor

func (c *Cached) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error)

KindsFor .

func (*Cached) RESTMapping

func (c *Cached) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)

RESTMapping .

func (*Cached) RESTMappings

func (c *Cached) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error)

RESTMappings .

func (*Cached) ResourceFor

ResourceFor .

func (*Cached) ResourceSingularizer

func (c *Cached) ResourceSingularizer(resource string) (singular string, err error)

ResourceSingularizer .

func (*Cached) ResourcesFor

func (c *Cached) ResourcesFor(input schema.GroupVersionResource) ([]schema.GroupVersionResource, error)

ResourcesFor .

type DesiredState

type DesiredState interface {
	AfterRecreate(current, desired runtime.Object) error
	BeforeRecreate(current, desired runtime.Object) error
	ShouldRecreate(current, desired runtime.Object) (bool, error)
	AfterCreate(desired runtime.Object) error
	BeforeCreate(desired runtime.Object) error
	ShouldCreate(desired runtime.Object) (bool, error)
	AfterUpdate(current, desired runtime.Object, inSync bool) error
	BeforeUpdate(current, desired runtime.Object) error
	ShouldUpdate(current, desired runtime.Object) (bool, error)
	AfterDelete(current runtime.Object) error
	BeforeDelete(current runtime.Object) error
	ShouldDelete(current runtime.Object) (bool, error)
}

DesiredState .

type OwnerReferenceMatcher

type OwnerReferenceMatcher struct {
	// contains filtered or unexported fields
}

func NewOwnerReferenceMatcher

func NewOwnerReferenceMatcher(owner runtime.Object, ctrl bool, scheme *runtime.Scheme) *OwnerReferenceMatcher

NewOwnerReferenceMatcher initializes a new owner reference matcher

func (*OwnerReferenceMatcher) Match

Match matches if an object is owned by the initialised owner

type RecreateAwareStatefulsetDesiredState

type RecreateAwareStatefulsetDesiredState struct {
	StaticDesiredState
	// contains filtered or unexported fields
}

RecreateAwareStatefulsetDesiredState .

func NewRecreateAwareDeploymentDesiredState

func NewRecreateAwareDeploymentDesiredState(c client.Client, scheme *runtime.Scheme, log logr.Logger, podLabels map[string]string) RecreateAwareStatefulsetDesiredState

NewRecreateAwareDeploymentDesiredState .

func (RecreateAwareStatefulsetDesiredState) AfterRecreate

func (r RecreateAwareStatefulsetDesiredState) AfterRecreate(current, desired runtime.Object) error

AfterRecreate .

func (RecreateAwareStatefulsetDesiredState) AfterUpdate

func (r RecreateAwareStatefulsetDesiredState) AfterUpdate(current, desired runtime.Object, inSync bool) error

AfterUpdate .

func (RecreateAwareStatefulsetDesiredState) BeforeRecreate

func (r RecreateAwareStatefulsetDesiredState) BeforeRecreate(current, desired runtime.Object) error

BeforeRecreate .

type StaticDesiredState

type StaticDesiredState string

StaticDesiredState .

const (
	// DesiredStatePresent .
	DesiredStatePresent StaticDesiredState = "present"
	// DesiredStateAbsent .
	DesiredStateAbsent StaticDesiredState = "absent"
	// DesiredStateExists .
	DesiredStateExists StaticDesiredState = "exists"
)

func (StaticDesiredState) AfterCreate

func (s StaticDesiredState) AfterCreate(_ runtime.Object) error

AfterCreate .

func (StaticDesiredState) AfterDelete

func (s StaticDesiredState) AfterDelete(_ runtime.Object) error

AfterDelete .

func (StaticDesiredState) AfterRecreate

func (s StaticDesiredState) AfterRecreate(_, _ runtime.Object) error

AfterRecreate .

func (StaticDesiredState) AfterUpdate

func (s StaticDesiredState) AfterUpdate(_, _ runtime.Object, _ bool) error

AfterUpdate .

func (StaticDesiredState) BeforeCreate

func (s StaticDesiredState) BeforeCreate(_ runtime.Object) error

BeforeCreate .

func (StaticDesiredState) BeforeDelete

func (s StaticDesiredState) BeforeDelete(_ runtime.Object) error

BeforeDelete .

func (StaticDesiredState) BeforeRecreate

func (s StaticDesiredState) BeforeRecreate(_, _ runtime.Object) error

BeforeRecreate .

func (StaticDesiredState) BeforeUpdate

func (s StaticDesiredState) BeforeUpdate(_, _ runtime.Object) error

BeforeUpdate .

func (StaticDesiredState) ShouldCreate

func (s StaticDesiredState) ShouldCreate(_ runtime.Object) (bool, error)

ShouldCreate .

func (StaticDesiredState) ShouldDelete

func (s StaticDesiredState) ShouldDelete(_ runtime.Object) (bool, error)

ShouldDelete .

func (StaticDesiredState) ShouldRecreate

func (s StaticDesiredState) ShouldRecreate(_, _ runtime.Object) (bool, error)

ShouldRecreate .

func (StaticDesiredState) ShouldUpdate

func (s StaticDesiredState) ShouldUpdate(_, _ runtime.Object) (bool, error)

ShouldUpdate .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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