Documentation ¶
Index ¶
- Constants
- func AnnotationHasDeploymentLabel(label string) bool
- func AnnotationHasServiceLabel(svc string, label string) bool
- func DeploymentLabelToPodAnnotation(label string) string
- func GetLabelValueBool(value string) bool
- func GetLabelValueFloat64(value string) float64
- func GetLabelValueInt64(value string) int64
- func GetLabelValueUInt32(value string) uint32
- func GetLabelValueUInt64(value string) uint64
- func GetProtocol(value string) int
- func GetRESTClientMap(clientSet kubernetes.Interface) map[string]cache.Getter
- func IngressAttrLabel(port uint32, attr string) string
- func PodEnvoyByService(svc string) string
- func PodPortProtcolByService(svc string, port uint32) string
- func PodTargetPortProtcolByService(svc string, port uint32) string
- func ServiceLabelToPodAnnotation(svc string, label string) string
- func ServicePortProtocol(port uint32) string
- type DeploymentEventHandler
- type DeploymentInfo
- func (deployment *DeploymentInfo) EnvoyEnabled() bool
- func (deployment *DeploymentInfo) GetSelector() map[string]string
- func (deployment *DeploymentInfo) Name() string
- func (deployment *DeploymentInfo) Namespace() string
- func (deployment *DeploymentInfo) String() string
- func (deployment *DeploymentInfo) Type() ResourceType
- type IngressClusterInfo
- type IngressEventHandler
- type IngressHostInfo
- type IngressInfo
- func (ingress *IngressInfo) GetSelector() map[string]string
- func (ingress *IngressInfo) GetServiceAnnotations(hostInfo *IngressHostInfo, clusterInfo *IngressClusterInfo) map[string]string
- func (ingress *IngressInfo) Name() string
- func (ingress *IngressInfo) Namespace() string
- func (ingress *IngressInfo) String() string
- func (ingress *IngressInfo) Type() ResourceType
- type K8sResourceManager
- func (manager *K8sResourceManager) AddServiceLabel(serviceInfo *ServiceInfo, key string, value string) error
- func (manager *K8sResourceManager) DeploymentAdded(deployment *DeploymentInfo)
- func (manager *K8sResourceManager) DeploymentDeleted(deployment *DeploymentInfo)
- func (manager *K8sResourceManager) DeploymentUpdated(oldDeployment, newDeployment *DeploymentInfo)
- func (manager *K8sResourceManager) DeploymentValid(deployment *DeploymentInfo) bool
- func (manager *K8sResourceManager) GetListerWatcher(resourceType string) *fcache.FakeControllerSource
- func (manager *K8sResourceManager) GetMatchedResources(resource ResourceInfoPointer, matchType ResourceType) []ResourceInfoPointer
- func (manager *K8sResourceManager) IsLocked() bool
- func (manager *K8sResourceManager) Lock()
- func (manager *K8sResourceManager) MergeServiceAnnotation(name string, ns string, values map[string]string) error
- func (manager *K8sResourceManager) NewCond() *sync.Cond
- func (manager *K8sResourceManager) PodAdded(info *PodInfo)
- func (manager *K8sResourceManager) PodDeleted(info *PodInfo)
- func (manager *K8sResourceManager) PodExists(name string, ns string) (bool, error)
- func (manager *K8sResourceManager) PodUpdated(oldPod, newPod *PodInfo)
- func (manager *K8sResourceManager) PodValid(info *PodInfo) bool
- func (manager *K8sResourceManager) PostSecret(name string, namespace string, certificate []byte, privateKey []byte) error
- func (manager *K8sResourceManager) RemovePodAnnotation(podInfo *PodInfo, annotationkeys []string) error
- func (manager *K8sResourceManager) RemoveServiceAnnotation(name string, ns string, values map[string]string) error
- func (manager *K8sResourceManager) ServiceAdded(info *ServiceInfo)
- func (manager *K8sResourceManager) ServiceDeleted(info *ServiceInfo)
- func (manager *K8sResourceManager) ServiceUpdated(oldService, newService *ServiceInfo)
- func (manager *K8sResourceManager) ServiceValid(info *ServiceInfo) bool
- func (manager *K8sResourceManager) Unlock()
- func (manager *K8sResourceManager) UpdatePodAnnotation(podInfo *PodInfo, annotation map[string]string) error
- func (manager *K8sResourceManager) WatchDaemonSets(stopper chan struct{}, handlers ...DeploymentEventHandler)
- func (manager *K8sResourceManager) WatchDeployments(stopper chan struct{}, handlers ...DeploymentEventHandler)
- func (manager *K8sResourceManager) WatchIngresss(stopper chan struct{}, handlers ...IngressEventHandler)
- func (manager *K8sResourceManager) WatchPods(stopper chan struct{}, handlers ...PodEventHandler)
- func (manager *K8sResourceManager) WatchSecrets(stopper chan struct{}, handlers ...SecretEventHandler)
- func (manager *K8sResourceManager) WatchServices(stopper chan struct{}, handlers ...ServiceEventHandler)
- func (manager *K8sResourceManager) WatchStatefulSets(stopper chan struct{}, handlers ...DeploymentEventHandler)
- type PodEventHandler
- type PodInfo
- func (pod *PodInfo) EnvoyDockerId() string
- func (pod *PodInfo) EnvoyEnabled() bool
- func (pod *PodInfo) GetPortSet() map[uint32]map[string]bool
- func (pod *PodInfo) GetSelector() map[string]string
- func (pod *PodInfo) GetTargetPortConfig() map[uint32]*PodPortInfo
- func (pod *PodInfo) IsSkip() bool
- func (pod *PodInfo) Name() string
- func (pod *PodInfo) Namespace() string
- func (pod *PodInfo) NodeId() string
- func (pod *PodInfo) String() string
- func (pod *PodInfo) Type() ResourceType
- func (pod *PodInfo) Valid() bool
- type PodPortInfo
- type ResourceInfoPointer
- type ResourceType
- type ResourcesOnLabel
- type SecretEventHandler
- type SecretInfo
- type ServiceEventHandler
- type ServiceInfo
- func (service *ServiceInfo) GetSelector() map[string]string
- func (service *ServiceInfo) IsIngressHttpPort(port uint32) bool
- func (service *ServiceInfo) Name() string
- func (service *ServiceInfo) Namespace() string
- func (svc *ServiceInfo) Protocol(port uint32) int
- func (service *ServiceInfo) String() string
- func (service *ServiceInfo) Type() ResourceType
- type ServicePortInfo
Constants ¶
View Source
const ( SERVICE_TYPE ResourceType = 1 DEPLOYMENT_TYPE ResourceType = 2 POD_TYPE ResourceType = 3 INGRESS_TYPE ResourceType = 4 ENVOY_ENABLED = "traffic.envoy.enabled" ENVOY_PROXY_ANNOTATION = "traffic.envoy.proxy" DEFAULT_WEIGHT = 100 POD_SERVICE_PREFIX = "traffic.svc." POD_DEPLOYMENT_PREFIX = "traffic.rs." ENVOY_ENABLED_BY_DEPLOYMENT = POD_DEPLOYMENT_PREFIX + "envoy.enabled" PROTO_HTTP = 2 PROTO_TCP = 1 PROTO_DIRECT = 0 )
View Source
const (
SECRET_TLS_HOST = "traffic.tls.host"
)
Variables ¶
This section is empty.
Functions ¶
func GetLabelValueBool ¶
func GetLabelValueFloat64 ¶
func GetLabelValueInt64 ¶
func GetLabelValueUInt32 ¶
func GetLabelValueUInt64 ¶
func GetProtocol ¶
func GetRESTClientMap ¶
func GetRESTClientMap(clientSet kubernetes.Interface) map[string]cache.Getter
func IngressAttrLabel ¶
func PodEnvoyByService ¶
func PodPortProtcolByService ¶
func ServicePortProtocol ¶
Types ¶
type DeploymentEventHandler ¶
type DeploymentEventHandler interface { DeploymentValid(deployment *DeploymentInfo) bool DeploymentAdded(deployment *DeploymentInfo) DeploymentDeleted(deployment *DeploymentInfo) DeploymentUpdated(oldDeployment, newDeployment *DeploymentInfo) }
type DeploymentInfo ¶
type DeploymentInfo struct { Labels map[string]string Ports []uint32 HostNetwork bool // contains filtered or unexported fields }
func NewDeploymentInfo ¶
func NewDeploymentInfo(obj interface{}) *DeploymentInfo
func (*DeploymentInfo) EnvoyEnabled ¶
func (deployment *DeploymentInfo) EnvoyEnabled() bool
func (*DeploymentInfo) GetSelector ¶
func (deployment *DeploymentInfo) GetSelector() map[string]string
func (*DeploymentInfo) Name ¶
func (deployment *DeploymentInfo) Name() string
func (*DeploymentInfo) Namespace ¶
func (deployment *DeploymentInfo) Namespace() string
func (*DeploymentInfo) String ¶
func (deployment *DeploymentInfo) String() string
func (*DeploymentInfo) Type ¶
func (deployment *DeploymentInfo) Type() ResourceType
type IngressClusterInfo ¶
type IngressEventHandler ¶
type IngressEventHandler interface { IngressValid(ingressInfo *IngressInfo) bool IngressAdded(ingressInfo *IngressInfo) IngressDeleted(ingressInfo *IngressInfo) IngressUpdated(oldIngress, newIngress *IngressInfo) }
type IngressHostInfo ¶
type IngressHostInfo struct { Host string PathMap map[string]*IngressClusterInfo Secret string }
type IngressInfo ¶
type IngressInfo struct { ResourceVersion string HostPathToClusterMap map[string]*IngressHostInfo // contains filtered or unexported fields }
func NewIngressInfo ¶
func NewIngressInfo(ingress *v1beta1.Ingress) *IngressInfo
func (*IngressInfo) GetSelector ¶
func (ingress *IngressInfo) GetSelector() map[string]string
func (*IngressInfo) GetServiceAnnotations ¶
func (ingress *IngressInfo) GetServiceAnnotations(hostInfo *IngressHostInfo, clusterInfo *IngressClusterInfo) map[string]string
func (*IngressInfo) Name ¶
func (ingress *IngressInfo) Name() string
func (*IngressInfo) Namespace ¶
func (ingress *IngressInfo) Namespace() string
func (*IngressInfo) String ¶
func (ingress *IngressInfo) String() string
func (*IngressInfo) Type ¶
func (ingress *IngressInfo) Type() ResourceType
type K8sResourceManager ¶
type K8sResourceManager struct { ClientSet kubernetes.Interface // contains filtered or unexported fields }
func NewFakeK8sResourceManager ¶
func NewFakeK8sResourceManager() *K8sResourceManager
func NewK8sResourceManager ¶
func NewK8sResourceManager() (*K8sResourceManager, error)
func (*K8sResourceManager) AddServiceLabel ¶
func (manager *K8sResourceManager) AddServiceLabel(serviceInfo *ServiceInfo, key string, value string) error
func (*K8sResourceManager) DeploymentAdded ¶
func (manager *K8sResourceManager) DeploymentAdded(deployment *DeploymentInfo)
func (*K8sResourceManager) DeploymentDeleted ¶
func (manager *K8sResourceManager) DeploymentDeleted(deployment *DeploymentInfo)
func (*K8sResourceManager) DeploymentUpdated ¶
func (manager *K8sResourceManager) DeploymentUpdated(oldDeployment, newDeployment *DeploymentInfo)
func (*K8sResourceManager) DeploymentValid ¶
func (manager *K8sResourceManager) DeploymentValid(deployment *DeploymentInfo) bool
func (*K8sResourceManager) GetListerWatcher ¶
func (manager *K8sResourceManager) GetListerWatcher(resourceType string) *fcache.FakeControllerSource
func (*K8sResourceManager) GetMatchedResources ¶
func (manager *K8sResourceManager) GetMatchedResources(resource ResourceInfoPointer, matchType ResourceType) []ResourceInfoPointer
func (*K8sResourceManager) IsLocked ¶
func (manager *K8sResourceManager) IsLocked() bool
func (*K8sResourceManager) Lock ¶
func (manager *K8sResourceManager) Lock()
func (*K8sResourceManager) MergeServiceAnnotation ¶
func (*K8sResourceManager) NewCond ¶
func (manager *K8sResourceManager) NewCond() *sync.Cond
func (*K8sResourceManager) PodAdded ¶
func (manager *K8sResourceManager) PodAdded(info *PodInfo)
func (*K8sResourceManager) PodDeleted ¶
func (manager *K8sResourceManager) PodDeleted(info *PodInfo)
func (*K8sResourceManager) PodExists ¶
func (manager *K8sResourceManager) PodExists(name string, ns string) (bool, error)
func (*K8sResourceManager) PodUpdated ¶
func (manager *K8sResourceManager) PodUpdated(oldPod, newPod *PodInfo)
func (*K8sResourceManager) PodValid ¶
func (manager *K8sResourceManager) PodValid(info *PodInfo) bool
func (*K8sResourceManager) PostSecret ¶
func (*K8sResourceManager) RemovePodAnnotation ¶
func (manager *K8sResourceManager) RemovePodAnnotation(podInfo *PodInfo, annotationkeys []string) error
func (*K8sResourceManager) RemoveServiceAnnotation ¶
func (*K8sResourceManager) ServiceAdded ¶
func (manager *K8sResourceManager) ServiceAdded(info *ServiceInfo)
func (*K8sResourceManager) ServiceDeleted ¶
func (manager *K8sResourceManager) ServiceDeleted(info *ServiceInfo)
func (*K8sResourceManager) ServiceUpdated ¶
func (manager *K8sResourceManager) ServiceUpdated(oldService, newService *ServiceInfo)
func (*K8sResourceManager) ServiceValid ¶
func (manager *K8sResourceManager) ServiceValid(info *ServiceInfo) bool
func (*K8sResourceManager) Unlock ¶
func (manager *K8sResourceManager) Unlock()
func (*K8sResourceManager) UpdatePodAnnotation ¶
func (manager *K8sResourceManager) UpdatePodAnnotation(podInfo *PodInfo, annotation map[string]string) error
func (*K8sResourceManager) WatchDaemonSets ¶
func (manager *K8sResourceManager) WatchDaemonSets(stopper chan struct{}, handlers ...DeploymentEventHandler)
func (*K8sResourceManager) WatchDeployments ¶
func (manager *K8sResourceManager) WatchDeployments(stopper chan struct{}, handlers ...DeploymentEventHandler)
func (*K8sResourceManager) WatchIngresss ¶
func (manager *K8sResourceManager) WatchIngresss(stopper chan struct{}, handlers ...IngressEventHandler)
func (*K8sResourceManager) WatchPods ¶
func (manager *K8sResourceManager) WatchPods(stopper chan struct{}, handlers ...PodEventHandler)
func (*K8sResourceManager) WatchSecrets ¶
func (manager *K8sResourceManager) WatchSecrets(stopper chan struct{}, handlers ...SecretEventHandler)
func (*K8sResourceManager) WatchServices ¶
func (manager *K8sResourceManager) WatchServices(stopper chan struct{}, handlers ...ServiceEventHandler)
func (*K8sResourceManager) WatchStatefulSets ¶
func (manager *K8sResourceManager) WatchStatefulSets(stopper chan struct{}, handlers ...DeploymentEventHandler)
type PodEventHandler ¶
type PodInfo ¶
type PodInfo struct { ResourceVersion string PodIP string HostIP string HostNetwork bool Labels map[string]string Annotations map[string]string Containers []string // contains filtered or unexported fields }
func NewPodInfo ¶
func (*PodInfo) EnvoyDockerId ¶
func (*PodInfo) EnvoyEnabled ¶
func (*PodInfo) GetSelector ¶
func (*PodInfo) GetTargetPortConfig ¶
func (pod *PodInfo) GetTargetPortConfig() map[uint32]*PodPortInfo
*
- Used for k8s headless service.
- LDS should create a listener for each podip:targetPort of the service
- CDS should create a static cluster for each podip:targetPort of the service
- example:
- traffic.svc.service1.attr=value
- traffic.svc.service1.target.port.5678=http
- should return map 5678 => PodPortInfo{PROTO_HTTP, traffic.attr=value }
func (*PodInfo) Type ¶
func (pod *PodInfo) Type() ResourceType
type PodPortInfo ¶
type ResourceInfoPointer ¶
type ResourceType ¶
type ResourceType int
func (ResourceType) String ¶
func (e ResourceType) String() string
type ResourcesOnLabel ¶
type ResourcesOnLabel map[ResourceType][]ResourceInfoPointer
type SecretEventHandler ¶
type SecretEventHandler interface { SecretValid(info *SecretInfo) bool SecretAdded(svc *SecretInfo) SecretDeleted(svc *SecretInfo) SecretUpdated(oldSecret, newSecret *SecretInfo) }
type SecretInfo ¶
type SecretInfo struct { Name string Namespace string Labels map[string]string Data map[string][]byte ResourceVersion string }
func NewSecretInfo ¶
func NewSecretInfo(secret *v1.Secret) *SecretInfo
type ServiceEventHandler ¶
type ServiceEventHandler interface { ServiceValid(info *ServiceInfo) bool ServiceAdded(svc *ServiceInfo) ServiceDeleted(svc *ServiceInfo) ServiceUpdated(oldService, newService *ServiceInfo) }
type ServiceInfo ¶
type ServiceInfo struct { ResourceVersion string ClusterIP string Labels map[string]string Annotations map[string]string Ports []*ServicePortInfo // contains filtered or unexported fields }
func NewServiceInfo ¶
func NewServiceInfo(service *v1.Service) *ServiceInfo
func (*ServiceInfo) GetSelector ¶
func (service *ServiceInfo) GetSelector() map[string]string
func (*ServiceInfo) IsIngressHttpPort ¶
func (service *ServiceInfo) IsIngressHttpPort(port uint32) bool
func (*ServiceInfo) Name ¶
func (service *ServiceInfo) Name() string
func (*ServiceInfo) Namespace ¶
func (service *ServiceInfo) Namespace() string
func (*ServiceInfo) Protocol ¶
func (svc *ServiceInfo) Protocol(port uint32) int
func (*ServiceInfo) String ¶
func (service *ServiceInfo) String() string
func (*ServiceInfo) Type ¶
func (service *ServiceInfo) Type() ResourceType
type ServicePortInfo ¶
Click to show internal directories.
Click to hide internal directories.