Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteStatefulSet(ctx context.Context, clientIn client.Client, statefulSet *appsv1.StatefulSet, ...) error
- func NewDeleteStatefulSetError(msg string, err error) error
- func ReconcileObject(ctx context.Context, log logr.Logger, client client.Client, ...) error
- func ReconcileStatefulSet(ctx context.Context, log logr.Logger, clientIn client.Client, ...) error
- func SetOwnerAndHash(owner ReconciliableObject, object metav1.Object, scheme *runtime.Scheme) error
- type CompareStatefulSetError
- type CompareStatefulsetResult
- type DeleteStatefulSetError
- type ReconciliableObject
- type StatefulSetComparer
Constants ¶
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 ¶
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 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 SetOwnerAndHash ¶
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 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 ¶
func (c *StatefulSetComparer) Compare(statefulSet appsv1.StatefulSet) (*CompareStatefulsetResult, error)
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.