utils

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package utils implements the util functions

Index

Constants

View Source
const (
	// ManagedAnnotation indicates the object is managed by the controller
	ManagedAnnotation = "cloud.streamnative.io/managed"
)

Variables

This section is empty.

Functions

func CalculateSecretKeyMd5 added in v0.4.5

func CalculateSecretKeyMd5(secret *corev1.Secret, key string) (string, error)

CalculateSecretKeyMd5 calculates the hash of the secret key.

func ConvertJSONToMapStringInterface added in v0.5.0

func ConvertJSONToMapStringInterface(raw *apiextensionsv1.JSON) (map[string]interface{}, error)

ConvertJSONToMapStringInterface converts a JSON object to a map[string]interface{}

func ConvertMap added in v0.5.0

func ConvertMap(input map[string]string) map[string]interface{}

ConvertMap converts a map[string]string to a map[string]interface{}

func IsManaged

func IsManaged(object metav1.Object) bool

IsManaged returns true if the object is under control of the controller by checking the specific annotation

Types

type ClientCredentials added in v0.5.5

type ClientCredentials struct {
	IssuerURL  string `json:"issuerUrl,omitempty"`
	Audience   string `json:"audience,omitempty"`
	Scope      string `json:"scope,omitempty"`
	PrivateKey string `json:"privateKey,omitempty"`
	ClientID   string `json:"clientId,omitempty"`
}

ClientCredentials represents the client credentials for OAuth2

type Duration added in v0.4.0

type Duration string

Duration represents a elapsed time in string.

func (*Duration) Parse added in v0.4.0

func (d *Duration) Parse() (time.Duration, error)

Parse parses a duration from string. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w".

type Event added in v0.5.5

type Event struct {
	client.Object
}

Event is a custom event that can be used to trigger reconcile

type EventSource added in v0.5.5

type EventSource struct {
	Log    logr.Logger
	Events chan event.GenericEvent
	// contains filtered or unexported fields
}

EventSource is a custom event source that can be used to trigger reconcile

func NewEventSource added in v0.5.5

func NewEventSource(log logr.Logger) *EventSource

NewEventSource creates a new EventSource

func (*EventSource) Close added in v0.5.5

func (s *EventSource) Close()

Close closes the EventSource

func (*EventSource) Contains added in v0.5.5

func (s *EventSource) Contains(key string) bool

Contains checks if the key exists in the event source

func (*EventSource) CreateIfAbsent added in v0.5.5

func (s *EventSource) CreateIfAbsent(delay time.Duration, obj client.Object, key string)

CreateIfAbsent triggers reconcile after delay, idempotent operation for the same key

func (*EventSource) Remove added in v0.5.5

func (s *EventSource) Remove(key string)

Remove removes the reconcile event

func (*EventSource) Update added in v0.5.5

func (s *EventSource) Update(key string, delay time.Duration)

Update updates the delay of the reconcile event

type ReconcileRetryer added in v0.5.5

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

ReconcileRetryer is a helper to trigger reconcile with retry

func NewReconcileRetryer added in v0.5.5

func NewReconcileRetryer(maxRetries int, source *EventSource) *ReconcileRetryer

NewReconcileRetryer creates a new ReconcileRetryer

func (*ReconcileRetryer) Close added in v0.5.5

func (r *ReconcileRetryer) Close()

Close closes the ReconcileRetryer

func (*ReconcileRetryer) Contains added in v0.5.5

func (r *ReconcileRetryer) Contains(obj client.Object) bool

func (*ReconcileRetryer) CreateIfAbsent added in v0.5.5

func (r *ReconcileRetryer) CreateIfAbsent(obj client.Object)

CreateIfAbsent creates a new task if not exist

func (*ReconcileRetryer) Remove added in v0.5.5

func (r *ReconcileRetryer) Remove(obj client.Object)

Remove removes the task

func (*ReconcileRetryer) Source added in v0.5.5

func (r *ReconcileRetryer) Source() <-chan event.GenericEvent

Source returns the event source

Jump to

Keyboard shortcuts

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