healthcheck

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateProviderConfigStatus

func UpdateProviderConfigStatus(ctx context.Context, kubeClient client.Client, pc *apisv1alpha1.ProviderConfig, callback func(*apisv1alpha1.ProviderConfig, *apisv1alpha1.ProviderConfig)) error

UpdateProviderConfigStatus updates the status of a ProviderConfig resource by applying a callback. The function uses an exponential backoff retry mechanism to handle potential conflicts during updates.

The callback takes two ProviderConfig parameters. Before the callback is called, the first ProviderConfig parameter will become a DeepCopy of pc. The second will become the latest version of pc, as it is fetched from the Kube API. A callback function should aim to update the latest version of the pc (second parameter) with the changes which will be persisted in pc (and as a result, it's DeepCopy).

Callback example 1, updating the latest version of pc with a field from your version of pc:

func(pcDeepCopy, pcLatest *apisv1alpha1.ProviderConfig) {
  pcLatest.Status.SomeOtherField = pcDeepCopy.Status.SomeOtherField
},

Callback example 2, updating the latest version of pc with a string:

func(_, pcLatest *apisv1alpha1.ProviderConfig) {
  pcLatest.Status.SomeOtherField = "some-value"
},

Example usage with above callback example 1:

err := UpdateProviderConfigStatus(ctx, pc, func(pcDeepCopy, pcLatest *apisv1alpha1.ProviderConfig) {
  pcLatest.Status.SomeOtherField = pcDeepCopy.Status.SomeOtherField
})

if err != nil {
  // Handle error
}

func WithAutoPause

func WithAutoPause(autoPause *bool) func(*Controller)

func WithBackendStore

func WithBackendStore(b *backendstore.BackendStore) func(*Controller)

func WithKubeClient

func WithKubeClient(k client.Client) func(*Controller)

func WithLogger

func WithLogger(l logging.Logger) func(*Controller)

Types

type Controller

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

func NewController

func NewController(options ...func(*Controller)) *Controller

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*Controller) SetupWithManager

func (r *Controller) SetupWithManager(mgr ctrl.Manager) error

Jump to

Keyboard shortcuts

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