Documentation ¶
Index ¶
- Constants
- Variables
- func CheckGrpcServerStatus(target string, log *log.Entry, grpcDial GrpcDialType) (bool, error)
- func CleanIntfConfCache(dataDir, refid, podIface string) error
- func ConvertCiphers(ciphers []string) ([]uint16, error)
- func CreateCipherMap()
- func DefaultCipherSuites() []string
- func GetCDQList(pf string, devicePath string) ([]*types.InterfaceInfo, error)
- func GetClientCredentials() (credentials.TransportCredentials, error)
- func GetDataDirPath(t string) string
- func GetIPFromIPAM(ec *EnvConfigurer, ipamExecAdd IpamExecAddFunc) (*net.IPNet, error)
- func GetIntfPciAddress(ifName string, prefix string) (string, error)
- func GetK8sClient(config *rest.Config) (kubernetes.Interface, error)
- func GetK8sConfig() (*rest.Config, error)
- func GetNodeIP(client kubernetes.Interface, nodeName string) (string, error)
- func GetNodeIPFromEnv() (ipAddr string, err error)
- func GetNodeName() (string, error)
- func GetNodeNetInterface(k8sclient kubernetes.Interface, nodeName string, ...) (string, error)
- func GetNodePodsCIDR(k8sclient kubernetes.Interface, nodeName string) (string, error)
- func GetSubnets(client kubernetes.Interface) error
- func GetTapInterfaces(prefix string) ([]*types.InterfaceInfo, error)
- func GetVFList(pf string, prefix string) ([]*types.InterfaceInfo, error)
- func GrpcDial(target string, connType ConnType, s Service) (*grpc.ClientConn, error)
- func GrpcDialInsecure(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func GrpcDialWithCred(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func IsIn(str string, s []string) bool
- func LogInit(logDir string, logLevel string) error
- func MakeTimestampMilli() uint64
- func NewCalicoWatcher(timeout time.Duration, configPath string, ...) (*calicoWatcher, error)
- func NewGrpcServer(params ServerParams) (*grpc.Server, error)
- func NewGrpcWatcher(timeout, sleepDuration time.Duration, target string, dialFunc GrpcDialType, ...) *grpcWatcher
- func ReadInterfaceConf(dataDir, refid, podIface string) (*types.InterfaceInfo, error)
- func RegisterSignalHandlers() <-chan struct{}
- func ReleaseIPFromIPAM(ec *EnvConfigurer, ipamExecDel IpamExecDelFunc) error
- func RemoveStr(str string, s []string) []string
- func SaveInterfaceConf(dataDir, refid, podIface string, conf *types.InterfaceInfo) error
- func StrDiff(str1, str2 []string) []string
- func ValidCiphers(ciphers []string) bool
- func ValidLogLevel(logLevel string) bool
- func VerifiedFilePath(fileName string, allowedDir string) (string, error)
- func WaitFor(w watcher) error
- type CDQManager
- type Conn
- type ConnType
- type DefaultInterfaceAddressGetter
- type EnvConfigurer
- type GrpcDialType
- type IdStack
- type InterfaceAddressGetter
- type IpamExecAddFunc
- type IpamExecDelFunc
- type OsVariableConfigurer
- type ServerParams
- type Service
Constants ¶
const (
// SysClassNet is a directory for network interface data
SysClassNet = "/sys/class/net"
)
Variables ¶
var CipherMap map[string]uint16
Functions ¶
func CheckGrpcServerStatus ¶
CheckGrpcServerStatus will check gRPC server status using gRPC health check
func CleanIntfConfCache ¶
func ConvertCiphers ¶
func CreateCipherMap ¶
func CreateCipherMap()
func DefaultCipherSuites ¶
func DefaultCipherSuites() []string
func GetCDQList ¶
func GetCDQList(pf string, devicePath string) ([]*types.InterfaceInfo, error)
func GetClientCredentials ¶
func GetClientCredentials() (credentials.TransportCredentials, error)
GetClientCredentials returns gRPC client credential based on user provided configuration. if "--insecure=true" it will provide insecure.NewCredentials if "--insecure=false" && "--mtls=true" it will provide mTLS credentials otherwise only server side validation with CA added in client CA pool
func GetDataDirPath ¶
GetDataDirPath will return path to cache directory of given type
func GetIPFromIPAM ¶
func GetIPFromIPAM(ec *EnvConfigurer, ipamExecAdd IpamExecAddFunc) (*net.IPNet, error)
GetIPFromIPAM will request IP address from host-local IPAM, it will be used as Infra host interface
func GetIntfPciAddress ¶
GetIntfPciAddress takes in an interface name as string and returns it's PCI address when prefix will be not empty it will be prepended before default "/sys/class/net" directory name
func GetK8sClient ¶
func GetK8sClient(config *rest.Config) (kubernetes.Interface, error)
func GetK8sConfig ¶
func GetNodeIPFromEnv ¶
func GetNodeName ¶
func GetNodeNetInterface ¶
func GetNodeNetInterface(k8sclient kubernetes.Interface, nodeName string, ifGetter InterfaceAddressGetter, logEntry *log.Entry) (string, error)
func GetNodePodsCIDR ¶
func GetNodePodsCIDR(k8sclient kubernetes.Interface, nodeName string) (string, error)
func GetSubnets ¶
func GetSubnets(client kubernetes.Interface) error
GetSubnets gets service and pod subnet
func GetTapInterfaces ¶
func GetTapInterfaces(prefix string) ([]*types.InterfaceInfo, error)
GetTapInterfaces returns a list of host Tap interance info matching a naming prefix using "prefix"
func GetVFList ¶
func GetVFList(pf string, prefix string) ([]*types.InterfaceInfo, error)
GetVFList returns SRIOV-VF for given pf network interface name when prefix will be not empty it will be prepended before default "/sys/class/net" directory name
func GrpcDialInsecure ¶
func GrpcDialInsecure(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
func GrpcDialWithCred ¶
func GrpcDialWithCred(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
func MakeTimestampMilli ¶
func MakeTimestampMilli() uint64
func NewCalicoWatcher ¶
func NewCalicoWatcher(timeout time.Duration, configPath string, newFsWatcher func() (*fsnotify.Watcher, error)) (*calicoWatcher, error)
NewCalicoWatcher returns new watcher for Calico's config file
func NewGrpcServer ¶
func NewGrpcServer(params ServerParams) (*grpc.Server, error)
func NewGrpcWatcher ¶
func NewGrpcWatcher(timeout, sleepDuration time.Duration, target string, dialFunc GrpcDialType, checkHealth checkGrpcServerStatusType) *grpcWatcher
NewGrpcWatcher returns new gRPC watcher
func ReadInterfaceConf ¶
func ReadInterfaceConf(dataDir, refid, podIface string) (*types.InterfaceInfo, error)
func RegisterSignalHandlers ¶
func RegisterSignalHandlers() <-chan struct{}
RegisterSignalHandlers registers a signal handler for capturedSignals and starts a goroutine that will block until a signal is received. The first signal received will cause the stopCh channel to be closed, giving the opportunity to the program to exist gracefully. If a second signal is received before then, we will force exit with code 1.
func ReleaseIPFromIPAM ¶
func ReleaseIPFromIPAM(ec *EnvConfigurer, ipamExecDel IpamExecDelFunc) error
ReleaseIPFromIPAM will release IP address assigned for Infra host interface
func SaveInterfaceConf ¶
func SaveInterfaceConf(dataDir, refid, podIface string, conf *types.InterfaceInfo) error
func ValidCiphers ¶
func ValidLogLevel ¶
func VerifiedFilePath ¶
VerifiedFilePath validates a file for potential file path traversal attacks. It returns the real filepath after cleaning and evaluiating any symlinks in the path. It returns error if the "fileName" is not within the "allowedDir", point to a non-privileged location or "fileName" points to a file outside of allowed dir.
Types ¶
type CDQManager ¶
type CDQManager interface { CreateIntf() (*types.InterfaceInfo, error) RemoveIntf(*types.InterfaceInfo) error }
func NewCDQManager ¶
func NewCDQManager(masterIntf string, log *log.Entry) (CDQManager, error)
NewCDQManager returns a singleton instance of CDQManager for a master inteface
type DefaultInterfaceAddressGetter ¶
type DefaultInterfaceAddressGetter struct{}
type EnvConfigurer ¶
type EnvConfigurer struct {
// contains filtered or unexported fields
}
func NewEnvConfigurer ¶
func NewEnvConfigurer(varCfg variableConfigurer, calicoConfig string) *EnvConfigurer
NewEnvConfigurer will return new environment configurer
type GrpcDialType ¶
type GrpcDialType func(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
type IdStack ¶
type IdStack struct {
// contains filtered or unexported fields
}
func NewIdStack ¶
func NewIdStack() *IdStack
func (*IdStack) InitIdStack ¶
func (st *IdStack) InitIdStack()
func (*IdStack) IsStackEmpty ¶
func (*IdStack) IsStackFull ¶
type InterfaceAddressGetter ¶
type IpamExecAddFunc ¶
IpamExecAddFunc can be used to point to IPAM add function
type IpamExecDelFunc ¶
IpamExecDelFunc can be used to point to IPAM delete function
type OsVariableConfigurer ¶
type OsVariableConfigurer struct{}
func NewOsVariableConfigurer ¶
func NewOsVariableConfigurer() *OsVariableConfigurer
NewOsVariableConfigurer will return new variable configurer based on os package