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
- Variables
- func AddNamespaceToFilter(namespace string)
- func AviModelToUrl(model string) string
- func AviUrlToObjType(aviurl string) (string, error)
- func Bkt(key string, num_workers uint32) uint32
- func CheckIfNamespaceAccepted(namespace string, opts ...interface{}) bool
- func ContainsDuplicate(arr interface{}) bool
- func CreateAuthTokenWithRetry(c *clients.AviClient, retryCount int) (interface{}, error)
- func CrudHashKey(obj_type string, obj interface{}) string
- func DeepCopy(a, b interface{})
- func DeleteAuthTokenWithRetry(c *clients.AviClient, tokenID string, retryCount int) error
- func DeleteNamespaceFromFilter(namespace string)
- func ExtractNamespaceObjectName(key string) (string, string)
- func FindAndRemove(arr []string, item string) (bool, []string)
- func GetAKONamespace() string
- func GetAdvancedL4() bool
- func GetAuthTokenMapWithRetry(c *clients.AviClient, tokens map[string]interface{}, retryCount int, ...) error
- func GetAuthTokenWithRetry(c *clients.AviClient, retryCount int, nextPage ...string) (interface{}, error)
- func GetAuthtokenFromCache() (string, error)
- func GetCloudRef(tenant string) string
- func GetHTTPTransportWithCert(rootPEMCerts string) (*http.Transport, bool)
- func GetNSFilter(obj *K8ValidNamespaces) (string, string)
- func GetTokenFromRestObj(robj interface{}, ctrlAuthToken string) (oldTokenID string, refresh bool, err error)
- func GetVipNetworkList() []akov1beta1.AviInfraSettingVipNetwork
- func HasElem(s interface{}, elem interface{}) bool
- func Hash(s string) uint32
- func InitializeNSSync(labelKey, labelVal string)
- func IsMultiClusterIngressEnabled() bool
- func IsNSPresent(namespace string, obj *K8ValidNamespaces) bool
- func IsSecretsHandlingRestrictedToAKONS() bool
- func IsServiceNSValid(namespace string) bool
- func IsSvcHttp(svc_name string, port int32) bool
- func IsV4(addr string) bool
- func IsVCFCluster() bool
- func LogApi(next http.Handler) http.Handler
- func ObjKey(obj interface{}) string
- func RandomSeq(n int) string
- func Remove(arr []string, item string) []string
- func Respond(w http.ResponseWriter, data interface{})
- func SetCloudName(cloudName string)
- func SetVipNetworkList(vipNetworks []akov1beta1.AviInfraSettingVipNetwork)
- func SetupSignalHandler() (stopCh <-chan struct{})
- func String(s *string) string
- func Stringify(serialize interface{}) string
- type AviCache
- type AviCloudPropertyCache
- type AviHTTPCache
- type AviHostPathPortPoolPG
- type AviHttpPolicySetMeta
- type AviLogger
- func (aviLogger *AviLogger) Debug(args ...interface{})
- func (aviLogger *AviLogger) Debugf(template string, args ...interface{})
- func (aviLogger AviLogger) Enabled(level int) bool
- func (aviLogger AviLogger) Error(err error, msg string, args ...interface{})
- func (aviLogger *AviLogger) Errorf(template string, args ...interface{})
- func (aviLogger *AviLogger) Fatal(args ...interface{})
- func (aviLogger *AviLogger) Fatalf(template string, args ...interface{})
- func (aviLogger AviLogger) Info(level int, msg string, args ...interface{})
- func (aviLogger *AviLogger) Infof(template string, args ...interface{})
- func (AviLogger) Init(info logr.RuntimeInfo)
- func (aviLogger *AviLogger) SetLevel(l string)
- func (aviLogger AviLogger) V(level int) logr.LogSink
- func (aviLogger *AviLogger) Warn(args ...interface{})
- func (aviLogger *AviLogger) Warnf(template string, args ...interface{})
- func (aviLogger AviLogger) WithName(name string) logr.LogSink
- func (aviLogger AviLogger) WithValues(keysAndValues ...interface{}) logr.LogSink
- type AviMultiCache
- func (c *AviMultiCache) AviMultiCacheAdd(k interface{}, val interface{})
- func (c *AviMultiCache) AviMultiCacheDeleteKey(k interface{})
- func (c *AviMultiCache) AviMultiCacheDeleteVal(k interface{}, dval interface{})
- func (c *AviMultiCache) AviMultiCacheGetKey(k interface{}) (map[interface{}]bool, bool)
- func (c *AviMultiCache) AviMultiCacheLookup(k interface{}, lval interface{}) bool
- type AviObjectMarkers
- type AviPGCache
- type AviPkiProfileCache
- type AviPoolCache
- type AviPoolMetaServer
- type AviPortProtocol
- type AviPortStrProtocol
- type AviRestClientPool
- type AviRestObjMacro
- type AviSSLCache
- type AviVsCache
- type CtrlPropCache
- type EvType
- type EventRecorder
- type FullSyncThread
- type Informers
- type K8NamespaceList
- type K8ValidNamespaces
- type K8sAviPoolGroupMeta
- type K8sAviPoolMeta
- type K8sAviVsMeta
- type KubeClientIntf
- type LeaderElector
- type NamespaceFilter
- type NamespaceName
- type RestMethod
- type RestOp
- type ServiceMetadataObj
- type SkipSyncError
- type Version
- type WebSyncError
- type WorkQueueWrapper
- type WorkerQueue
Constants ¶
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" )
const ( DebugLevel = zapcore.DebugLevel InfoLevel = zapcore.InfoLevel WarnLevel = zapcore.WarnLevel ErrorLevel = zapcore.ErrorLevel )
const ( CreateEv EvType = "CREATE" UpdateEv EvType = "UPDATE" DeleteEv EvType = "DELETE" NumWorkersIngestion uint32 = 2 NumWorkersGraph uint32 = 2 )
const ( AVI_DEFAULT_TCP_HM string = "System-TCP" AVI_DEFAULT_UDP_HM string = "System-UDP" AVI_DEFAULT_SCTP_HM string = "System-SCTP" )
const ( PatchAddOp string = "add" PatchReplaceOp string = "replace" PatchDeleteOp string = "delete" )
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" )
const (
OSHIFT_K8S_CLOUD_CONNECTOR string = "amc-k8s-cloud-connector"
)
Variables ¶
var AddToScheme = localSchemeBuilder.AddToScheme
var CloudName string
var Codecs = serializer.NewCodecFactory(EventScheme)
var CtrlVersion string
var EventScheme = runtime.NewScheme()
var InformerDefaultResync = 12 * time.Hour
var LogLevelMap = map[string]zapcore.Level{ "DEBUG": DebugLevel, "INFO": InfoLevel, "WARN": WarnLevel, "ERROR": ErrorLevel, }
var ParameterCodec = runtime.NewParameterCodec(EventScheme)
var VipNetworkList []akov1beta1.AviInfraSettingVipNetwork
Functions ¶
func AddNamespaceToFilter ¶
func AddNamespaceToFilter(namespace string)
func AviModelToUrl ¶
func AviUrlToObjType ¶
func ContainsDuplicate ¶
func ContainsDuplicate(arr interface{}) bool
func CrudHashKey ¶
func DeleteNamespaceFromFilter ¶
func DeleteNamespaceFromFilter(namespace 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 GetAuthTokenWithRetry ¶
func GetAuthtokenFromCache ¶
func GetCloudRef ¶
func GetNSFilter ¶
func GetNSFilter(obj *K8ValidNamespaces) (string, string)
Get namespace label filter key and value
func GetTokenFromRestObj ¶
func GetVipNetworkList ¶
func GetVipNetworkList() []akov1beta1.AviInfraSettingVipNetwork
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 IsVCFCluster ¶
func IsVCFCluster() bool
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.
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 (*AviCache) AviCacheGetKeyByUuid ¶
type AviCloudPropertyCache ¶
type AviHTTPCache ¶
type AviHostPathPortPoolPG ¶
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) WithValues ¶
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 AviPGCache ¶
type AviPGCache struct { Name string Tenant string Uuid string ServiceMetadata ServiceMetadataObj CloudConfigCksum string }
type AviPkiProfileCache ¶
type AviPoolCache ¶
type AviPoolMetaServer ¶
type AviPortProtocol ¶
type AviPortStrProtocol ¶
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 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 EventRecorder ¶
type EventRecorder struct { Recorder record.EventRecorder Enabled bool Fake bool }
func NewEventRecorder ¶
func NewEventRecorder(id string, kubeClient kubernetes.Interface, fake bool) *EventRecorder
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 ¶
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 ¶
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 WebSyncError ¶
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{})