util

package
v0.0.0-...-591a441 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalPlugMutex *sync.Mutex = &sync.Mutex{}
View Source
var GlobalSocketMutex *sync.Mutex = &sync.Mutex{}

Functions

func CalculateExponentialRequireAfter

func CalculateExponentialRequireAfter(
	lastUpdate metav1.Time,
	factor int64,
) time.Duration

func Default

func Default(value string, defaultValue string) string

func EnsureNamespacedName

func EnsureNamespacedName(
	partialNamespacedName *integrationv1alpha2.NamespacedName,
	defaultNamespace string,
) types.NamespacedName

func GetOperatorNamespace

func GetOperatorNamespace() string

func JsonToHashMap

func JsonToHashMap(body []byte) (map[string]string, error)

func WhenInWhenSlice

func WhenInWhenSlice(when integrationv1alpha2.When, whenSlice *[]integrationv1alpha2.When) bool

Types

type ApparatusUtil

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

func NewApparatusUtil

func NewApparatusUtil(
	ctx *context.Context,
) *ApparatusUtil

func (*ApparatusUtil) GetPlugConfig

func (u *ApparatusUtil) GetPlugConfig(
	plug *integrationv1alpha2.Plug,
) ([]byte, error)

func (*ApparatusUtil) GetSocketConfig

func (u *ApparatusUtil) GetSocketConfig(
	socket *integrationv1alpha2.Socket,
) ([]byte, error)

func (*ApparatusUtil) NotRunning

func (u *ApparatusUtil) NotRunning(err error) bool

func (*ApparatusUtil) PlugBroken

func (u *ApparatusUtil) PlugBroken(
	plug *integrationv1alpha2.Plug,
) error

func (*ApparatusUtil) PlugCoupled

func (u *ApparatusUtil) PlugCoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ApparatusUtil) PlugCreated

func (u *ApparatusUtil) PlugCreated(plug *integrationv1alpha2.Plug) error

func (*ApparatusUtil) PlugDecoupled

func (u *ApparatusUtil) PlugDecoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ApparatusUtil) PlugDeleted

func (u *ApparatusUtil) PlugDeleted(
	plug *integrationv1alpha2.Plug,
) error

func (*ApparatusUtil) PlugUpdated

func (u *ApparatusUtil) PlugUpdated(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ApparatusUtil) RenewIdleTimeout

func (u *ApparatusUtil) RenewIdleTimeout(
	apparatus *integrationv1alpha2.SpecApparatus,
	name string,
	namespace string,
	uid string,
)

func (*ApparatusUtil) SocketBroken

func (u *ApparatusUtil) SocketBroken(
	socket *integrationv1alpha2.Socket,
) error

func (*ApparatusUtil) SocketCoupled

func (u *ApparatusUtil) SocketCoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ApparatusUtil) SocketCreated

func (u *ApparatusUtil) SocketCreated(socket *integrationv1alpha2.Socket) error

func (*ApparatusUtil) SocketDecoupled

func (u *ApparatusUtil) SocketDecoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ApparatusUtil) SocketDeleted

func (u *ApparatusUtil) SocketDeleted(
	socket *integrationv1alpha2.Socket,
) error

func (*ApparatusUtil) SocketUpdated

func (u *ApparatusUtil) SocketUpdated(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ApparatusUtil) StartFromPlug

func (u *ApparatusUtil) StartFromPlug(plug *integrationv1alpha2.Plug, requeueAfter *time.Duration) (bool, error)

func (*ApparatusUtil) StartFromSocket

func (u *ApparatusUtil) StartFromSocket(socket *integrationv1alpha2.Socket, requeueAfter *time.Duration) (bool, error)

type Condition

type Condition struct {
	Message string
	Reason  string
	Status  bool
	Type    string
}

type ConfigUtil

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

func NewConfigUtil

func NewConfigUtil(
	ctx *context.Context,
) *ConfigUtil

func (*ConfigUtil) GetPlugConfig

func (u *ConfigUtil) GetPlugConfig(
	plug *integrationv1alpha2.Plug,
	plugInterface *integrationv1alpha2.Interface,
) (map[string]string, error)

func (*ConfigUtil) GetSocketConfig

func (u *ConfigUtil) GetSocketConfig(
	socket *integrationv1alpha2.Socket,
	socketInterface *integrationv1alpha2.Interface,
) (map[string]string, error)

func (*ConfigUtil) ValidatePlugConfig

func (u *ConfigUtil) ValidatePlugConfig(
	plug *integrationv1alpha2.Plug,
	plugInterface *integrationv1alpha2.Interface,
	plugConfig map[string]string,
) (map[string]string, error)

func (*ConfigUtil) ValidateSocketConfig

func (u *ConfigUtil) ValidateSocketConfig(
	socket *integrationv1alpha2.Socket,
	socketInterface *integrationv1alpha2.Interface,
	socketConfig map[string]string,
) (map[string]string, error)

type DataUtil

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

func NewDataUtil

func NewDataUtil(ctx *context.Context) *DataUtil

func (*DataUtil) GetPlugData

func (u *DataUtil) GetPlugData(plug *integrationv1alpha2.Plug) (map[string]string, error)

func (*DataUtil) GetSocketData

func (u *DataUtil) GetSocketData(socket *integrationv1alpha2.Socket) (map[string]string, error)

type EventUtil

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

func NewEventUtil

func NewEventUtil(ctx *context.Context) *EventUtil

func (*EventUtil) PlugBroken

func (u *EventUtil) PlugBroken(
	plug *integrationv1alpha2.Plug,
) error

func (*EventUtil) PlugCoupled

func (u *EventUtil) PlugCoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*EventUtil) PlugCreated

func (u *EventUtil) PlugCreated(plug *integrationv1alpha2.Plug) error

func (*EventUtil) PlugDecoupled

func (u *EventUtil) PlugDecoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*EventUtil) PlugDeleted

func (u *EventUtil) PlugDeleted(
	plug *integrationv1alpha2.Plug,
) error

func (*EventUtil) PlugUpdated

func (u *EventUtil) PlugUpdated(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*EventUtil) SocketBroken

func (u *EventUtil) SocketBroken(
	socket *integrationv1alpha2.Socket,
) error

func (*EventUtil) SocketCoupled

func (u *EventUtil) SocketCoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*EventUtil) SocketCreated

func (u *EventUtil) SocketCreated(socket *integrationv1alpha2.Socket) error

func (*EventUtil) SocketDecoupled

func (u *EventUtil) SocketDecoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*EventUtil) SocketDeleted

func (u *EventUtil) SocketDeleted(
	socket *integrationv1alpha2.Socket,
) error

func (*EventUtil) SocketUpdated

func (u *EventUtil) SocketUpdated(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

type InterfaceUtil

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

func NewInterfaceUtil

func NewInterfaceUtil(
	client *client.Client,
	ctx *context.Context,
	namespacedName *integrationv1alpha2.NamespacedName,
) *InterfaceUtil

func (*InterfaceUtil) Get

type KubectlUtil

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

func NewKubectlUtil

func NewKubectlUtil(ctx *context.Context) *KubectlUtil

func (*KubectlUtil) Apply

func (u *KubectlUtil) Apply(body []byte) error

func (*KubectlUtil) Create

func (u *KubectlUtil) Create(body []byte) error

func (*KubectlUtil) Delete

func (u *KubectlUtil) Delete(body []byte) error

func (*KubectlUtil) Get

func (u *KubectlUtil) Get(body []byte) (*unstructured.Unstructured, error)

func (*KubectlUtil) Update

func (u *KubectlUtil) Update(body []byte) error

type PlugUtil

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

func NewPlugUtil

func NewPlugUtil(
	client *client.Client,
	ctx *context.Context,
	req *ctrl.Request,
	log *logr.Logger,
	namespacedName *integrationv1alpha2.NamespacedName,
	mutex *sync.Mutex,
) *PlugUtil

func (*PlugUtil) Error

func (u *PlugUtil) Error(err error) (ctrl.Result, error)

func (*PlugUtil) Get

func (u *PlugUtil) Get() (*integrationv1alpha2.Plug, error)

func (*PlugUtil) GetCoupledCondition

func (u *PlugUtil) GetCoupledCondition() (*metav1.Condition, error)

func (*PlugUtil) IsCoupled

func (u *PlugUtil) IsCoupled(
	plug *integrationv1alpha2.Plug,
	coupledCondition *metav1.Condition,
) (bool, error)

func (*PlugUtil) SocketError

func (u *PlugUtil) SocketError(err error) error

func (*PlugUtil) Update

func (u *PlugUtil) Update(plug *integrationv1alpha2.Plug) error

func (*PlugUtil) UpdateErrorStatus

func (u *PlugUtil) UpdateErrorStatus(err error, requeue bool) (ctrl.Result, error)

func (*PlugUtil) UpdateStatus

func (u *PlugUtil) UpdateStatus(
	plug *integrationv1alpha2.Plug,
	requeue bool,
	exponentialBackoff bool,
) error

func (*PlugUtil) UpdateStatusSimple

func (u *PlugUtil) UpdateStatusSimple(
	phase integrationv1alpha2.Phase,
	coupledStatusCondition StatusCondition,
	socket *integrationv1alpha2.Socket,
	requeue bool,
) (ctrl.Result, error)

type ResourceUtil

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

func NewResourceUtil

func NewResourceUtil(ctx *context.Context) *ResourceUtil

func (*ResourceUtil) GetResource

func (u *ResourceUtil) GetResource(namespace string, objRef kustomizeTypes.Target) (*unstructured.Unstructured, error)

func (*ResourceUtil) PlugBroken

func (u *ResourceUtil) PlugBroken(
	plug *integrationv1alpha2.Plug,
) error

func (*ResourceUtil) PlugCoupled

func (u *ResourceUtil) PlugCoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ResourceUtil) PlugCreated

func (u *ResourceUtil) PlugCreated(plug *integrationv1alpha2.Plug) error

func (*ResourceUtil) PlugDecoupled

func (u *ResourceUtil) PlugDecoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ResourceUtil) PlugDeleted

func (u *ResourceUtil) PlugDeleted(
	plug *integrationv1alpha2.Plug,
) error

func (*ResourceUtil) PlugUpdated

func (u *ResourceUtil) PlugUpdated(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ResourceUtil) ProcessResources

func (u *ResourceUtil) ProcessResources(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
	namespace string,
	resources []*integrationv1alpha2.Resource,
) error

func (*ResourceUtil) SocketBroken

func (u *ResourceUtil) SocketBroken(
	socket *integrationv1alpha2.Socket,
) error

func (*ResourceUtil) SocketCoupled

func (u *ResourceUtil) SocketCoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ResourceUtil) SocketCreated

func (u *ResourceUtil) SocketCreated(socket *integrationv1alpha2.Socket) error

func (*ResourceUtil) SocketDecoupled

func (u *ResourceUtil) SocketDecoupled(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

func (*ResourceUtil) SocketDeleted

func (u *ResourceUtil) SocketDeleted(
	socket *integrationv1alpha2.Socket,
) error

func (*ResourceUtil) SocketUpdated

func (u *ResourceUtil) SocketUpdated(
	plug *integrationv1alpha2.Plug,
	socket *integrationv1alpha2.Socket,
	plugConfig *map[string]string,
	socketConfig *map[string]string,
) error

type SocketUtil

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

func NewSocketUtil

func NewSocketUtil(
	client *client.Client,
	ctx *context.Context,
	req *ctrl.Request,
	log *logr.Logger,
	namespacedName *integrationv1alpha2.NamespacedName,
	mutex *sync.Mutex,
) *SocketUtil

func (*SocketUtil) CoupledPlugExists

func (u *SocketUtil) CoupledPlugExists(coupledPlugs []*integrationv1alpha2.CoupledPlug, plugUid types.UID) bool

func (*SocketUtil) Error

func (u *SocketUtil) Error(err error) (ctrl.Result, error)

func (*SocketUtil) Get

func (*SocketUtil) GetCoupledCondition

func (u *SocketUtil) GetCoupledCondition() (*metav1.Condition, error)

func (*SocketUtil) PlugError

func (u *SocketUtil) PlugError(err error) error

func (*SocketUtil) Update

func (u *SocketUtil) Update(socket *integrationv1alpha2.Socket) error

func (*SocketUtil) UpdateErrorStatus

func (u *SocketUtil) UpdateErrorStatus(err error, requeue bool) (ctrl.Result, error)

func (*SocketUtil) UpdateStatus

func (u *SocketUtil) UpdateStatus(
	socket *integrationv1alpha2.Socket,
	requeue bool,
	exponentialBackoff bool,
) error

func (*SocketUtil) UpdateStatusAppendPlug

func (u *SocketUtil) UpdateStatusAppendPlug(
	plug *integrationv1alpha2.Plug,
	requeue bool,
) (ctrl.Result, error)

func (*SocketUtil) UpdateStatusRemovePlug

func (u *SocketUtil) UpdateStatusRemovePlug(plugUid types.UID, requeue bool) (ctrl.Result, error)

func (*SocketUtil) UpdateStatusSimple

func (u *SocketUtil) UpdateStatusSimple(
	phase integrationv1alpha2.Phase,
	coupledStatusCondition StatusCondition,
	appendPlug *integrationv1alpha2.Plug,
	requeue bool,
) (ctrl.Result, error)

type StatusCondition

type StatusCondition string
const (
	CouplingInProcessStatusCondition StatusCondition = "CouplingInProcess"
	CouplingSucceededStatusCondition StatusCondition = "CouplingSucceeded"
	ErrorStatusCondition             StatusCondition = "Error"
	PlugCreatedStatusCondition       StatusCondition = "PlugCreated"
	SocketCoupledStatusCondition     StatusCondition = "SocketCoupled"
	SocketCreatedStatusCondition     StatusCondition = "SocketCreated"
	SocketEmptyStatusCondition       StatusCondition = "SocketEmpty"
	SocketNotCreatedStatusCondition  StatusCondition = "SocketNotCreated"
	SocketNotReadyStatusCondition    StatusCondition = "SocketNotReady"
)

type VarUtil

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

func NewVarUtil

func NewVarUtil(ctx *context.Context) *VarUtil

func (*VarUtil) GetVar

func (u *VarUtil) GetVar(namespace string, v *kustomizeTypes.Var) (string, error)

func (*VarUtil) GetVars

func (u *VarUtil) GetVars(namespace string, vars []*kustomizeTypes.Var) (map[string]string, error)

Jump to

Keyboard shortcuts

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