Documentation
¶
Index ¶
- Constants
- func Abbreviate(str string, maxLength uint32) string
- func AddAndUpdateFinalizer(client client.Client, obj client.Object, finalizer string) error
- func AdmissionRequestObjectKeyString(req admission.Request) string
- func DeleteWithFinalizer(ctx context.Context, client client.Client, obj client.Object, finalizer string) error
- func Escape(key string) string
- func GetMapValue(m map[string]string, key string) (string, bool)
- func GetMapValueByDefault(m map[string]string, key, def string) string
- func MutateAnnotations(obj client.Object, mutateFn func(annotations map[string]string))
- func MutateLabels(obj client.Object, mutateFn func(labels map[string]string))
- func ObjectKeyString(obj client.Object) string
- func RemoveAndUpdateFinalizer(client client.Client, obj client.Object, finalizer string) error
- func SliceTopologyInfoEqual(a, b []v1alpha1.TopologyInfo) bool
- func SlowStartBatch(count int, initialBatchSize int, shortCircuit bool, fn func(int, error) error) (int, error)
- func UpdateOnConflict(ctx context.Context, reader client.Reader, writer UpdateWriter, ...) (controllerutil.OperationResult, error)
- type UpdateWriter
Constants ¶
const (
SlowStartInitialBatchSize = 1
)
Variables ¶
This section is empty.
Functions ¶
func Abbreviate ¶
Abbreviate abbreviates a string using ellipses
func AddAndUpdateFinalizer ¶
func AdmissionRequestObjectKeyString ¶ added in v0.1.0
func DeleteWithFinalizer ¶ added in v0.1.0
func MutateAnnotations ¶ added in v0.1.0
func MutateLabels ¶ added in v0.1.0
func ObjectKeyString ¶
func SliceTopologyInfoEqual ¶ added in v0.1.0
func SliceTopologyInfoEqual(a, b []v1alpha1.TopologyInfo) bool
func SlowStartBatch ¶
func SlowStartBatch(count int, initialBatchSize int, shortCircuit bool, fn func(int, error) error) (int, error)
SlowStartBatch tries to call the provided function a total of 'count' times, starting slow to check for errors, then speeding up if calls succeed.
It groups the calls into batches, starting with a group of initialBatchSize. Within each batch, it may call the function multiple times concurrently.
If a whole batch succeeds, the next batch may get exponentially larger. If there are any failures in a batch, all remaining batches are skipped after waiting for the current batch to complete.
It returns the number of successful calls to the function.
func UpdateOnConflict ¶
func UpdateOnConflict(ctx context.Context, reader client.Reader, writer UpdateWriter, obj client.Object, mutateFn controllerutil.MutateFn) (controllerutil.OperationResult, error)
reader is used to get freshest object writer can be client.Writer or client.StatusWriter
Types ¶
type UpdateWriter ¶
type UpdateWriter interface { // Update updates the fields corresponding to the status subresource for the // given obj. obj must be a struct pointer so that obj can be updated // with the content returned by the Server. Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error // Patch patches the given object's subresource. obj must be a struct // pointer so that obj can be updated with the content returned by the // Server. Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error }