resource

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HashLabel is a common label for each resource.
	HashLabel = "common.infura.io/hash"
	// DefaultRetryAttempts is the number of retry when deleting resource.
	DefaultRetryAttempts = 10
	// DefaultRetryDelay is the duration between each retry when deleting resource.
	DefaultRetryDelay = 1 * time.Second
)

Variables

View Source
var Semantic = conversion.EqualitiesOrDie(
	func(a, b resource.Quantity) bool {

		return a.Cmp(b) == 0
	},
	func(a, b metav1.MicroTime) bool {
		return a.UTC() == b.UTC()
	},
	func(a, b metav1.Time) bool {
		return a.UTC() == b.UTC()
	},
	func(a, b labels.Selector) bool {
		return a.String() == b.String()
	},
	func(a, b fields.Selector) bool {
		return a.String() == b.String()
	},
	func(a, b v1.ContainerPort) bool {

		if a.Protocol == "" {
			a.Protocol = v1.ProtocolTCP
		}
		if b.Protocol == "" {
			b.Protocol = v1.ProtocolTCP
		}

		return reflect.DeepEqual(a, b)
	},

) //nolint:gochecknoglobals

Semantic can do semantic deep equality checks for api objects. Example: apiequality.Semantic.DeepEqual(aPod, aPodWithNonNilButEmptyMaps) == true.

Functions

func DeleteStatefulSet

func DeleteStatefulSet(
	ctx context.Context,
	clientIn client.Client,
	statefulSet *appsv1.StatefulSet,
	propagationPolicy metav1.DeletionPropagation,
) error

DeleteStatefulSet deletes the provided statefulset and waits until the object is cleared.

func NewDeleteStatefulSetError

func NewDeleteStatefulSetError(msg string, err error) error

func ReconcileObject

func ReconcileObject(
	ctx context.Context,
	log logr.Logger,
	client client.Client,
	object ReconciliableObject,
	foundObject ReconciliableObject,
) error

ReconcileObject reconciles an object, either creating or updating if needed.

func ReconcileStatefulSet

func ReconcileStatefulSet(
	ctx context.Context,
	log logr.Logger,
	clientIn client.Client,
	owner ReconciliableObject,
	object *appsv1.StatefulSet,
	scheme *runtime.Scheme,
) error

func SetOwnerAndHash

func SetOwnerAndHash(owner ReconciliableObject, object metav1.Object, scheme *runtime.Scheme) error

SetOwnerAndHash sets an owner reference and hash annotation on the object.

Types

type CompareStatefulSetError

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

func (*CompareStatefulSetError) Error

func (e *CompareStatefulSetError) Error() string

type CompareStatefulsetResult

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

func (*CompareStatefulsetResult) Match

func (c *CompareStatefulsetResult) Match() bool

func (*CompareStatefulsetResult) Reasons

func (c *CompareStatefulsetResult) Reasons() []string

func (*CompareStatefulsetResult) Replace

func (c *CompareStatefulsetResult) Replace() bool

type DeleteStatefulSetError

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

func (*DeleteStatefulSetError) Error

func (d *DeleteStatefulSetError) Error() string

type ReconciliableObject

type ReconciliableObject interface {
	metav1.Object
	runtime.Object
}

type StatefulSetComparer

type StatefulSetComparer struct {
	Statefulset appsv1.StatefulSet
}

StatefulSetComparer enacapsulates logic of comparing two statefulsets.

func NewStatefulSetComparer

func NewStatefulSetComparer(statefulset appsv1.StatefulSet) *StatefulSetComparer

func (*StatefulSetComparer) Compare

Compare runs the comparison by looking at corresponding sub-attributes of the statefulsets. Note that it is still not thorough, comparing the significant differences. Though not highly probable, more comparisons can be added as needed here.

Jump to

Keyboard shortcuts

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