utils

package
v0.0.0-...-4b4864e Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GraphLayer            = "GraphLayer"
	ObjectIngestionLayer  = "ObjectIngestionLayer"
	LeastConnection       = "LB_ALGORITHM_LEAST_CONNECTIONS"
	RandomConnection      = "RANDOM_CONN"
	PassthroughConnection = "PASSTHROUGH_CONN"
	RoundRobinConnection  = "LB_ALGORITHM_ROUND_ROBIN"
	ServiceInformer       = "ServiceInformer"
	PodInformer           = "PodInformer"
	SecretInformer        = "SecretInformer"
	EndpointInformer      = "EndpointInformer"
	IstioMutualKey        = "key.pem"
	IstioMutualCertChain  = "cert-chain.pem"
	IstioMutualRootCA     = "root-cert.pem"
	IngressInformer       = "IngressInformer"
	RouteInformer         = "RouteInformer"
)
View Source
const (
	CreateEv            EvType = "CREATE"
	UpdateEv            EvType = "UPDATE"
	DeleteEv            EvType = "DELETE"
	NumWorkersIngestion uint32 = 1
	NumWorkersGraph     uint32 = 2
)
View Source
const (
	AVI_DEFAULT_TCP_HM string = "System-TCP"
	AVI_DEFAULT_UDP_HM string = "System-UDP"
)
View Source
const (
	INFORMERS_INSTANTIATE_ONCE string = "instantiateOnce"
	INFORMERS_OPENSHIFT_CLIENT string = "oshiftClient"
)
View Source
const (
	OSHIFT_K8S_CLOUD_CONNECTOR string = "amc-k8s-cloud-connector"
)

Variables

View Source
var CloudName string
View Source
var CtrlVersion string

Functions

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 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 ExtractDNSUuid

func ExtractDNSUuid(word string) string

func ExtractGatewayNamespace

func ExtractGatewayNamespace(key string) (string, string)

func HasElem

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

func Hash

func Hash(s string) uint32

func IsSvcHttp

func IsSvcHttp(svc_name string, port int32) bool

func IsV4

func IsV4(addr string) bool

func ObjKey

func ObjKey(obj interface{}) string

func RandomSeq

func RandomSeq(n int) string

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 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 {
	Trace   *log.Logger
	Info    *log.Logger
	Warning *log.Logger
	Error   *log.Logger
}
var AviLog AviLogger

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 AviObjCache

type AviObjCache struct {
	VsCache         *AviCache
	PgCache         *AviCache
	HTTPCache       *AviCache
	SSLKeyCache     *AviCache
	PkiProfileCache *AviCache
	CloudKeyCache   *AviCache
	PoolCache       *AviCache
	SvcToPoolCache  *AviMultiCache
}

func NewAviObjCache

func NewAviObjCache() *AviObjCache

func SharedAviObjCache

func SharedAviObjCache() *AviObjCache

func (*AviObjCache) AviCloudPropertiesPopulate

func (c *AviObjCache) AviCloudPropertiesPopulate(client *clients.AviClient,
	cloud string)

func (*AviObjCache) AviDNSPropertyPopulate

func (c *AviObjCache) AviDNSPropertyPopulate(client *clients.AviClient,
	nsDNSIpam string) string

func (*AviObjCache) AviHTTPPolicyCachePopulate

func (c *AviObjCache) AviHTTPPolicyCachePopulate(client *clients.AviClient,
	cloud string, vs_uuid string) []NamespaceName

func (*AviObjCache) AviObjCachePopulate

func (c *AviObjCache) AviObjCachePopulate(client *clients.AviClient,
	version string, cloud string)

func (*AviObjCache) AviObjVSCachePopulate

func (c *AviObjCache) AviObjVSCachePopulate(client *clients.AviClient,
	cloud string)

TODO (sudswas): Should this be run inside a go routine for parallel population to reduce bootup time when the system is loaded. Variable duplication expected.

func (*AviObjCache) AviPGCachePopulate

func (c *AviObjCache) AviPGCachePopulate(client *clients.AviClient,
	cloud string, vs_uuid string) []NamespaceName

Design library methods to remove repeatation of code.

func (*AviObjCache) AviPoolCachePopulate

func (c *AviObjCache) AviPoolCachePopulate(client *clients.AviClient,
	cloud string, vs_uuid string) []NamespaceName

func (*AviObjCache) AviSSLKeyAndCertPopulate

func (c *AviObjCache) AviSSLKeyAndCertPopulate(client *clients.AviClient,
	cloud string, vs_uuid string) []NamespaceName

func (*AviObjCache) IstioMutualPkiProfile

func (c *AviObjCache) IstioMutualPkiProfile(client *clients.AviClient,
	cloud string)

func (*AviObjCache) IstioMutualSSLKeyCert

func (c *AviObjCache) IstioMutualSSLKeyCert(client *clients.AviClient,
	cloud 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 {
	AviClient []*clients.AviClient
}
var AviClientInstance *AviRestClientPool

func NewAviRestClientPool

func NewAviRestClientPool(num uint32, api_ep string, username string,
	password string) (*AviRestClientPool, error)

func SharedAVIClients

func SharedAVIClients() *AviRestClientPool

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 EvType

type EvType string

type FullSyncThread

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

func NewFullSyncThread

func NewFullSyncThread(interval time.Duration) *FullSyncThread

func (*FullSyncThread) Run

func (w *FullSyncThread) Run()

func (*FullSyncThread) Shutdown

func (w *FullSyncThread) Shutdown()

type Informers

type Informers struct {
	ServiceInformer coreinformers.ServiceInformer
	EpInformer      coreinformers.EndpointsInformer
	PodInformer     coreinformers.PodInformer
	SecretInformer  coreinformers.SecretInformer
	IngressInformer extensioninformers.IngressInformer
	RouteInformer   oshiftinformers.RouteInformer
}

func GetInformers

func GetInformers() *Informers

func NewInformers

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

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 NamespaceName

type NamespaceName struct {
	Namespace string
	Name      string
}

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
	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 WebSyncError

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

func (*WebSyncError) Error

func (e *WebSyncError) Error() string

type WorkQueueWrapper

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

func SharedWorkQueue

func SharedWorkQueue() *WorkQueueWrapper

func (*WorkQueueWrapper) GetQueueByName

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

type WorkerQueue

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

	SyncFunc func(string) error
	// 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) *WorkerQueue

func (*WorkerQueue) Run

func (c *WorkerQueue) Run(stopCh <-chan struct{}) 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