utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 55 Imported by: 13

Documentation

Overview

  • Copyright 2019-2020 VMware, Inc.
  • All Rights Reserved.

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	GraphLayer                    = "GraphLayer"
	ObjectIngestionLayer          = "ObjectIngestionLayer"
	StatusQueue                   = "StatusQueue"
	LeastConnection               = "LB_ALGORITHM_LEAST_CONNECTIONS"
	RandomConnection              = "RANDOM_CONN"
	PassthroughConnection         = "PASSTHROUGH_CONN"
	RoundRobinConnection          = "LB_ALGORITHM_ROUND_ROBIN"
	ServiceInformer               = "ServiceInformer"
	PodInformer                   = "PodInformer"
	SecretInformer                = "SecretInformer"
	NodeInformer                  = "NodeInformer"
	EndpointInformer              = "EndpointInformer"
	ConfigMapInformer             = "ConfigMapInformer"
	MultiClusterIngressInformer   = "MultiClusterIngressInformer"
	ServiceImportInformer         = "ServiceImportInformer"
	K8S_TLS_SECRET_CERT           = "tls.crt"
	K8S_TLS_SECRET_KEY            = "tls.key"
	K8S_TLS_SECRET_ALT_CERT       = "alt.crt"
	K8S_TLS_SECRET_ALT_KEY        = "alt.key"
	IngressInformer               = "IngressInformer"
	RouteInformer                 = "RouteInformer"
	IngressClassInformer          = "IngressClassInformer"
	NSInformer                    = "NamespaceInformer"
	L4LBService                   = "L4LBService"
	LoadBalancer                  = "LoadBalancer"
	Pod                           = "Pod"
	Endpoints                     = "Endpoints"
	Ingress                       = "Ingress"
	IngressClass                  = "IngressClass"
	OshiftRoute                   = "OshiftRoute"
	Service                       = "Service"
	Secret                        = "Secret"
	HTTP                          = "HTTP"
	HTTPRoute                     = "HTTPRoute"
	HeaderMethod                  = ":method"
	HeaderAuthority               = ":authority"
	HeaderScheme                  = ":scheme"
	TLS                           = "TLS"
	HTTPS                         = "HTTPS"
	TCP                           = "TCP"
	UDP                           = "UDP"
	SCTP                          = "SCTP"
	SYSTEM_UDP_FAST_PATH          = "System-UDP-Fast-Path"
	TCP_NW_FAST_PATH              = "System-TCP-Fast-Path"
	DEFAULT_TCP_NW_PROFILE        = "System-TCP-Proxy"
	SYSTEM_SCTP_PROXY             = "System-SCTP-Proxy"
	MIXED_NET_PROFILE             = "Mixed-Network-Profile-Internal"
	DEFAULT_L4_APP_PROFILE        = "System-L4-Application"
	DEFAULT_L4_SSL_APP_PROFILE    = "System-SSL-Application"
	DEFAULT_L7_APP_PROFILE        = "System-HTTP"
	DEFAULT_L7_SECURE_APP_PROFILE = "System-Secure-HTTP"
	DEFAULT_SHARD_VS_PREFIX       = "Shard-VS-"
	L7_PG_PREFIX                  = "-PG-l7"
	VS_DATASCRIPT_EVT_HTTP_REQ    = "VS_DATASCRIPT_EVT_HTTP_REQ"
	HTTP_DS_SCRIPT                = "" /* 198-byte string literal not displayed */
	HTTP_DS_SCRIPT_MODIFIED       = "" /* 337-byte string literal not displayed */
	ADMIN_NS                      = "admin"
	TLS_PASSTHROUGH               = "TLS_PASSTHROUGH"
	VS_TYPE_VH_PARENT             = "VS_TYPE_VH_PARENT"
	VS_TYPE_NORMAL                = "VS_TYPE_NORMAL"
	VS_TYPE_VH_CHILD              = "VS_TYPE_VH_CHILD"
	VS_TYPE_VH_ENHANCED           = "VS_TYPE_VH_ENHANCED"
	NodeObj                       = "Node"
	GlobalVRF                     = "global"
	VRF_CONTEXT                   = "VRF_CONTEXT"
	FULL_SYNC_INTERVAL            = "FULL_SYNC_INTERVAL"
	DEFAULT_FILE_SUFFIX           = "avi.log"
	K8S_ETIMEDOUT                 = "timed out"
	K8S_UNAUTHORIZED              = "Unauthorized"
	ADVANCED_L4                   = "ADVANCED_L4"
	SERVICES_API                  = "SERVICES_API"
	ENV_CTRL_USERNAME             = "CTRL_USERNAME"
	ENV_CTRL_PASSWORD             = "CTRL_PASSWORD"
	ENV_CTRL_AUTHTOKEN            = "CTRL_AUTHTOKEN"
	ENV_CTRL_IPADDRESS            = "CTRL_IPADDRESS"
	ENV_CTRL_CADATA               = "CTRL_CA_DATA"
	POD_NAMESPACE                 = "POD_NAMESPACE"
	VCF_CLUSTER                   = "VCF_CLUSTER"
	MCI_ENABLED                   = "MCI_ENABLED"
	USE_DEFAULT_SECRETS_ONLY      = "USE_DEFAULT_SECRETS_ONLY"
	Namespace                     = "Namespace"
	MaxAviVersion                 = "30.2.1"
	NamespaceNetworkInfo          = "NamespaceNetworkInfos"

	RefreshAuthTokenInterval = 12  //hours
	AuthTokenExpiry          = 240 //hours
	RefreshAuthTokenPeriod   = 0.5 //ratio

	// container-lib/api constants
	AVIAPI_INITIATING   = "INITIATING"
	AVIAPI_CONNECTED    = "CONNECTED"
	AVIAPI_DISCONNECTED = "DISCONNECTED"
)
View Source
const (
	DebugLevel = zapcore.DebugLevel
	InfoLevel  = zapcore.InfoLevel
	WarnLevel  = zapcore.WarnLevel
	ErrorLevel = zapcore.ErrorLevel
)
View Source
const (
	CreateEv            EvType = "CREATE"
	UpdateEv            EvType = "UPDATE"
	DeleteEv            EvType = "DELETE"
	NumWorkersIngestion uint32 = 2
	NumWorkersGraph     uint32 = 2
)
View Source
const (
	AVI_DEFAULT_TCP_HM  string = "System-TCP"
	AVI_DEFAULT_UDP_HM  string = "System-UDP"
	AVI_DEFAULT_SCTP_HM string = "System-SCTP"
)
View Source
const (
	PatchAddOp     string = "add"
	PatchReplaceOp string = "replace"
	PatchDeleteOp  string = "delete"
)
View Source
const (
	INFORMERS_INSTANTIATE_ONCE string = "instantiateOnce"
	INFORMERS_OPENSHIFT_CLIENT string = "oshiftClient"
	INFORMERS_AKO_CLIENT       string = "akoClient"
	INFORMERS_NAMESPACE        string = "namespace"
	INFORMERS_ADVANCED_L4      string = "informersAdvL4"
	VMWARE_SYSTEM_AKO          string = "vmware-system-ako"
	AKO_DEFAULT_NS             string = "avi-system"
)
View Source
const (
	OSHIFT_K8S_CLOUD_CONNECTOR string = "amc-k8s-cloud-connector"
)

Variables

View Source
var AddToScheme = localSchemeBuilder.AddToScheme
View Source
var CloudName string
View Source
var CtrlVersion string
View Source
var EventScheme = runtime.NewScheme()
View Source
var InformerDefaultResync = 12 * time.Hour
View Source
var LogLevelMap = map[string]zapcore.Level{
	"DEBUG": DebugLevel,
	"INFO":  InfoLevel,
	"WARN":  WarnLevel,
	"ERROR": ErrorLevel,
}

Functions

func AddNamespaceToFilter

func AddNamespaceToFilter(namespace string)

func AviModelToUrl

func AviModelToUrl(model string) string

func AviUrlToObjType

func AviUrlToObjType(aviurl string) (string, error)

func Bkt

func Bkt(key string, num_workers uint32) uint32

func CheckIfNamespaceAccepted

func CheckIfNamespaceAccepted(namespace string, opts ...interface{}) bool

func ContainsDuplicate

func ContainsDuplicate(arr interface{}) bool

func CreateAuthTokenWithRetry

func CreateAuthTokenWithRetry(c *clients.AviClient, retryCount int) (interface{}, error)

func CrudHashKey

func CrudHashKey(obj_type string, obj interface{}) string

func DeepCopy

func DeepCopy(a, b interface{})

DeepCopy deepcopies a to b using json marshaling

func DeleteAuthTokenWithRetry

func DeleteAuthTokenWithRetry(c *clients.AviClient, tokenID string, retryCount int) error

func DeleteNamespaceFromFilter

func DeleteNamespaceFromFilter(namespace string)

func ExtractNamespaceObjectName

func ExtractNamespaceObjectName(key string) (string, string)

func FindAndRemove

func FindAndRemove(arr []string, item string) (bool, []string)

func GetAKONamespace

func GetAKONamespace() string

GetAKONamespace returns the namespace of AKO pod. In AdvancedL4 Mode this is vmware-system-ako In all other cases this is the namespace in which the statefulset runs.

func GetAdvancedL4

func GetAdvancedL4() bool

This utility returns a true/false depending on whether the user requires advanced L4 functionality

func GetAuthTokenMapWithRetry

func GetAuthTokenMapWithRetry(c *clients.AviClient, tokens map[string]interface{}, retryCount int, overrideURI ...string) error

func GetAuthTokenWithRetry

func GetAuthTokenWithRetry(c *clients.AviClient, retryCount int, nextPage ...string) (interface{}, error)

func GetAuthtokenFromCache

func GetAuthtokenFromCache() (string, error)

func GetCloudRef

func GetCloudRef(tenant string) string

func GetHTTPTransportWithCert

func GetHTTPTransportWithCert(rootPEMCerts string) (*http.Transport, bool)

func GetNSFilter

func GetNSFilter(obj *K8ValidNamespaces) (string, string)

Get namespace label filter key and value

func GetTokenFromRestObj

func GetTokenFromRestObj(robj interface{}, ctrlAuthToken string) (oldTokenID string, refresh bool, err error)

func GetVipNetworkList

func GetVipNetworkList() []akov1beta1.AviInfraSettingVipNetwork

func HasElem

func HasElem(s interface{}, elem interface{}) bool

func Hash

func Hash(s string) uint32

func InitializeNSSync

func InitializeNSSync(labelKey, labelVal string)

func IsMultiClusterIngressEnabled

func IsMultiClusterIngressEnabled() bool

func IsNSPresent

func IsNSPresent(namespace string, obj *K8ValidNamespaces) bool

func IsSecretsHandlingRestrictedToAKONS

func IsSecretsHandlingRestrictedToAKONS() bool

This utility returns a true/false depending on whether the secret handling is restricted to the namespace where the AKO is installed.

func IsServiceNSValid

func IsServiceNSValid(namespace string) bool

func IsSvcHttp

func IsSvcHttp(svc_name string, port int32) bool

func IsV4

func IsV4(addr string) bool

func IsVCFCluster

func IsVCFCluster() bool

func LogApi

func LogApi(next http.Handler) http.Handler

func ObjKey

func ObjKey(obj interface{}) string

func RandomSeq

func RandomSeq(n int) string

func Remove

func Remove(arr []string, item string) []string

func Respond

func Respond(w http.ResponseWriter, data interface{})

func SetCloudName

func SetCloudName(cloudName string)

func SetVipNetworkList

func SetVipNetworkList(vipNetworks []akov1beta1.AviInfraSettingVipNetwork)

func SetupSignalHandler

func SetupSignalHandler() (stopCh <-chan struct{})

SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1.

func String

func String(s *string) string

func Stringify

func Stringify(serialize interface{}) string

Types

type AviCache

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

func NewAviCache

func NewAviCache() *AviCache

func (*AviCache) AviCacheAdd

func (c *AviCache) AviCacheAdd(k interface{}, val interface{})

func (*AviCache) AviCacheDelete

func (c *AviCache) AviCacheDelete(k interface{})

func (*AviCache) AviCacheGet

func (c *AviCache) AviCacheGet(k interface{}) (interface{}, bool)

func (*AviCache) AviCacheGetKeyByUuid

func (c *AviCache) AviCacheGetKeyByUuid(uuid string) (interface{}, bool)

type AviCloudPropertyCache

type AviCloudPropertyCache struct {
	Name      string
	VType     string
	NSIpam    string
	NSIpamDNS string
}

type AviHTTPCache

type AviHTTPCache struct {
	Name             string
	Tenant           string
	Uuid             string
	CloudConfigCksum string
}

type AviHostPathPortPoolPG

type AviHostPathPortPoolPG struct {
	Host      string
	Path      string
	Port      uint32
	Pool      string
	PoolGroup string
}

type AviHttpPolicySetMeta

type AviHttpPolicySetMeta struct {
	Name             string
	Tenant           string
	CloudConfigCksum string
	HppMap           []AviHostPathPortPoolPG
}

type AviLogger

type AviLogger struct {
	// contains filtered or unexported fields
}
var AviLog AviLogger

func (*AviLogger) Debug

func (aviLogger *AviLogger) Debug(args ...interface{})

func (*AviLogger) Debugf

func (aviLogger *AviLogger) Debugf(template string, args ...interface{})

func (AviLogger) Enabled

func (aviLogger AviLogger) Enabled(level int) bool

func (AviLogger) Error

func (aviLogger AviLogger) Error(err error, msg string, args ...interface{})

func (*AviLogger) Errorf

func (aviLogger *AviLogger) Errorf(template string, args ...interface{})

func (*AviLogger) Fatal

func (aviLogger *AviLogger) Fatal(args ...interface{})

func (*AviLogger) Fatalf

func (aviLogger *AviLogger) Fatalf(template string, args ...interface{})

func (AviLogger) Info

func (aviLogger AviLogger) Info(level int, msg string, args ...interface{})

func (*AviLogger) Infof

func (aviLogger *AviLogger) Infof(template string, args ...interface{})

func (AviLogger) Init

func (AviLogger) Init(info logr.RuntimeInfo)

Init implements logr.LogSink.

func (*AviLogger) SetLevel

func (aviLogger *AviLogger) SetLevel(l string)

SetLevel changes loglevel during runtime

func (AviLogger) V

func (aviLogger AviLogger) V(level int) logr.LogSink

func (*AviLogger) Warn

func (aviLogger *AviLogger) Warn(args ...interface{})

func (*AviLogger) Warnf

func (aviLogger *AviLogger) Warnf(template string, args ...interface{})

func (AviLogger) WithName

func (aviLogger AviLogger) WithName(name string) logr.LogSink

func (AviLogger) WithValues

func (aviLogger AviLogger) WithValues(keysAndValues ...interface{}) logr.LogSink

type AviMultiCache

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

func NewAviMultiCache

func NewAviMultiCache() *AviMultiCache

func (*AviMultiCache) AviMultiCacheAdd

func (c *AviMultiCache) AviMultiCacheAdd(k interface{}, val interface{})

func (*AviMultiCache) AviMultiCacheDeleteKey

func (c *AviMultiCache) AviMultiCacheDeleteKey(k interface{})

func (*AviMultiCache) AviMultiCacheDeleteVal

func (c *AviMultiCache) AviMultiCacheDeleteVal(k interface{}, dval interface{})

func (*AviMultiCache) AviMultiCacheGetKey

func (c *AviMultiCache) AviMultiCacheGetKey(k interface{}) (map[interface{}]bool, bool)

func (*AviMultiCache) AviMultiCacheLookup

func (c *AviMultiCache) AviMultiCacheLookup(k interface{}, lval interface{}) bool

type AviObjectMarkers

type AviObjectMarkers struct {
	Namespace        string
	Host             []string
	InfrasettingName string
	ServiceName      string
	Path             []string
	Port             string
	Protocol         string
	IngressName      []string
	GatewayName      string
}

type AviPGCache

type AviPGCache struct {
	Name             string
	Tenant           string
	Uuid             string
	ServiceMetadata  ServiceMetadataObj
	CloudConfigCksum string
}

type AviPkiProfileCache

type AviPkiProfileCache struct {
	Name   string
	Tenant string
	Uuid   string
}

type AviPoolCache

type AviPoolCache struct {
	Name             string
	Tenant           string
	Uuid             string
	LbAlgorithm      string
	ServiceMetadata  ServiceMetadataObj
	CloudConfigCksum string
}

type AviPoolMetaServer

type AviPoolMetaServer struct {
	Ip         avimodels.IPAddr
	ServerNode string
}

type AviPortProtocol

type AviPortProtocol struct {
	Port     int32
	Protocol string
}

type AviPortStrProtocol

type AviPortStrProtocol struct {
	Port     string // Can be Port name or int32 string
	Protocol string
}

type AviRestClientPool

type AviRestClientPool struct {
	// stores clients per tenant
	AviClient map[string][]*clients.AviClient
}
var AviClientInstance *AviRestClientPool

func NewAviRestClientPool

func NewAviRestClientPool(num uint32, api_ep, username,
	password, authToken, controllerVersion, ctrlCAData, tenant string) (*AviRestClientPool, string, error)

func (*AviRestClientPool) AviRestOperate

func (p *AviRestClientPool) AviRestOperate(c *clients.AviClient, rest_ops []*RestOp) error

type AviRestObjMacro

type AviRestObjMacro struct {
	ModelName string      `json:"model_name"`
	Data      interface{} `json:"data"`
}

type AviSSLCache

type AviSSLCache struct {
	Name   string
	Tenant string
	Uuid   string
}

type AviVsCache

type AviVsCache struct {
	Name                 string
	Tenant               string
	Uuid                 string
	Vip                  []*avimodels.Vip
	ServiceMetadata      ServiceMetadataObj
	CloudConfigCksum     string
	PGKeyCollection      []NamespaceName
	PoolKeyCollection    []NamespaceName
	HTTPKeyCollection    []NamespaceName
	SSLKeyCertCollection []NamespaceName
	SNIChildCollection   []string
}

type CtrlPropCache

type CtrlPropCache struct {
	*AviCache
}

func SharedCtrlProp

func SharedCtrlProp() *CtrlPropCache

func (*CtrlPropCache) GetAllCtrlProp

func (o *CtrlPropCache) GetAllCtrlProp() map[string]string

func (*CtrlPropCache) PopulateCtrlProp

func (o *CtrlPropCache) PopulateCtrlProp(cp map[string]string)

type EvType

type EvType string

type EventRecorder

type EventRecorder struct {
	Recorder record.EventRecorder
	Enabled  bool
	Fake     bool
}

func NewEventRecorder

func NewEventRecorder(id string, kubeClient kubernetes.Interface, fake bool) *EventRecorder

func (*EventRecorder) Event

func (e *EventRecorder) Event(object runtime.Object, eventtype, reason, messageFmt string)

func (*EventRecorder) Eventf

func (e *EventRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})

type FullSyncThread

type FullSyncThread struct {
	Stopped           bool
	ShutdownChan      chan string
	QuickSyncChan     chan struct{}
	Interval          time.Duration
	SyncFunction      func()
	QuickSyncFunction func(bool) error
}

func NewFullSyncThread

func NewFullSyncThread(interval time.Duration) *FullSyncThread

func (*FullSyncThread) QuickSync

func (w *FullSyncThread) QuickSync()

func (*FullSyncThread) Run

func (w *FullSyncThread) Run()

func (*FullSyncThread) Shutdown

func (w *FullSyncThread) Shutdown()

type Informers

type Informers struct {
	ConfigMapInformer           coreinformers.ConfigMapInformer
	ServiceInformer             coreinformers.ServiceInformer
	EpInformer                  coreinformers.EndpointsInformer
	PodInformer                 coreinformers.PodInformer
	NSInformer                  coreinformers.NamespaceInformer
	SecretInformer              coreinformers.SecretInformer
	RouteInformer               oshiftinformers.RouteInformer
	NodeInformer                coreinformers.NodeInformer
	IngressInformer             netinformers.IngressInformer
	IngressClassInformer        netinformers.IngressClassInformer
	MultiClusterIngressInformer akoinformers.MultiClusterIngressInformer
	ServiceImportInformer       akoinformers.ServiceImportInformer
	OshiftClient                oshiftclientset.Interface
	IngressVersion              string
	KubeClientIntf
}

func GetInformers

func GetInformers() *Informers

func NewInformers

func NewInformers(kubeClient KubeClientIntf, registeredInformers []string, args ...map[string]interface{}) *Informers

type K8NamespaceList

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

Stores list of valid namespaces with lock

type K8ValidNamespaces

type K8ValidNamespaces struct {
	EnableMigration bool
	// contains filtered or unexported fields
}

func GetGlobalNSFilter

func GetGlobalNSFilter() *K8ValidNamespaces

type K8sAviPoolGroupMeta

type K8sAviPoolGroupMeta struct {
	Name             string
	Tenant           string
	ServiceMetadata  ServiceMetadataObj
	CloudConfigCksum string
	Members          []*avimodels.PoolGroupMember
}

type K8sAviPoolMeta

type K8sAviPoolMeta struct {
	Name             string
	Tenant           string
	ServiceMetadata  ServiceMetadataObj
	CloudConfigCksum string
	Port             int32
	Servers          []AviPoolMetaServer
	Protocol         string
}

type K8sAviVsMeta

type K8sAviVsMeta struct {
	Name               string
	Tenant             string
	ServiceMetadata    ServiceMetadataObj
	ApplicationProfile string
	NetworkProfile     string
	PortProto          []AviPortProtocol          // for listeners
	PoolGroupMap       map[AviPortProtocol]string // for mapping listener to Pools
	DefaultPool        string
	EastWest           bool
	CloudConfigCksum   string
	DefaultPoolGroup   string
}

type KubeClientIntf

type KubeClientIntf struct {
	ClientSet kubernetes.Interface
}

type LeaderElector

type LeaderElector interface {
	Run(ctx context.Context, wg *sync.WaitGroup) chan struct{}
}

func NewLeaderElector

func NewLeaderElector(clientset kubernetes.Interface,
	OnStartedLeadingCallback, OnStoppedLeadingCallback, OnNewLeaderCallback callBackFunc) (LeaderElector, error)

type NamespaceFilter

type NamespaceFilter struct {
	// contains filtered or unexported fields
}
  • Structures related with Namespace migration functionality

stores key and values fetched from values.yaml"

type NamespaceName

type NamespaceName struct {
	Namespace string
	Name      string
}

func RemoveNamespaceName

func RemoveNamespaceName(s []NamespaceName, r NamespaceName) []NamespaceName

type RestMethod

type RestMethod string
const (
	RestPost   RestMethod = "POST"
	RestPut    RestMethod = "PUT"
	RestDelete RestMethod = "DELETE"
	RestPatch  RestMethod = "PATCH"
	RestGet    RestMethod = "GET"
)

type RestOp

type RestOp struct {
	Path     string
	Method   RestMethod
	Obj      interface{}
	Tenant   string
	PatchOp  string
	Response interface{}
	Err      error
	Message  string // Optional field - can be used to carry forward err/msgs to k8s objects
	Model    string
	Version  string
	ObjName  string // Optional field - right only to be used for delete.
}

type ServiceMetadataObj

type ServiceMetadataObj struct {
	CrudHashKey string `json:"crud_hash_key"`
}

type SkipSyncError

type SkipSyncError struct {
	Msg string
}

func (*SkipSyncError) Error

func (e *SkipSyncError) Error() string

type Version

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

func NewVersion

func NewVersion(version string) (*Version, error)

func (*Version) Compare

func (v *Version) Compare(v1 *Version) int

type WebSyncError

type WebSyncError struct {
	Err       error
	Operation string
}

func (*WebSyncError) Error

func (e *WebSyncError) Error() string

func (*WebSyncError) GetWebAPIError

func (e *WebSyncError) GetWebAPIError() error

type WorkQueueWrapper

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

func SharedWorkQueue

func SharedWorkQueue(queueParams ...*WorkerQueue) *WorkQueueWrapper

func (*WorkQueueWrapper) GetQueueByName

func (w *WorkQueueWrapper) GetQueueByName(queueName string) *WorkerQueue

type WorkerQueue

type WorkerQueue struct {
	NumWorkers    uint32
	Workqueue     []workqueue.RateLimitingInterface
	WorkqueueName string

	SyncFunc     func(interface{}, *sync.WaitGroup) error
	SlowSyncTime int
	// contains filtered or unexported fields
}

Common utils like processing worker queue, that is common for all objects.

func NewWorkQueue

func NewWorkQueue(num_workers uint32, workerQueueName string, slowSyncTime ...int) *WorkerQueue

func (*WorkerQueue) Run

func (c *WorkerQueue) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) error

func (*WorkerQueue) StopWorkers

func (c *WorkerQueue) StopWorkers(stopCh <-chan struct{})

Jump to

Keyboard shortcuts

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