Documentation ¶
Overview ¶
Package k8s abstracts all Kubernetes specific behaviour
Package k8s abstracts all Kubernetes specific behaviour ¶
Package k8s contains all k8s related logic. +groupName=pkg
Package k8s abstracts all Kubernetes specific behaviour
Index ¶
- Constants
- Variables
- func AnnotationsEqual(relevantAnnotations []string, anno1, anno2 map[string]string) bool
- func Configure(apiServerURL, kubeconfigPath string, qps float32, burst int)
- func ConvertCEPToCoreCEP(cep *cilium_v2.CiliumEndpoint) *cilium_v2alpha1.CoreCiliumEndpoint
- func ConvertCoreCiliumEndpointToTypesCiliumEndpoint(ccep *cilium_v2alpha1.CoreCiliumEndpoint, ns string) *types.CiliumEndpoint
- func ConvertToCCNP(obj interface{}) interface{}
- func ConvertToCNP(obj interface{}) interface{}
- func ConvertToCiliumClusterwideEnvoyConfig(obj interface{}) interface{}
- func ConvertToCiliumEgressGatewayPolicy(obj interface{}) interface{}
- func ConvertToCiliumEgressNATPolicy(obj interface{}) interface{}
- func ConvertToCiliumEndpoint(obj interface{}) interface{}
- func ConvertToCiliumEnvoyConfig(obj interface{}) interface{}
- func ConvertToCiliumExternalWorkload(obj interface{}) interface{}
- func ConvertToCiliumLocalRedirectPolicy(obj interface{}) interface{}
- func ConvertToCiliumNode(obj interface{}) interface{}
- func ConvertToK8sService(obj interface{}) interface{}
- func ConvertToK8sV1LoadBalancerIngress(slimLBIngs []slim_corev1.LoadBalancerIngress) []v1.LoadBalancerIngress
- func ConvertToK8sV1ServiceAffinityConfig(saCfg *slim_corev1.SessionAffinityConfig) *v1.SessionAffinityConfig
- func ConvertToK8sV1ServicePorts(slimPorts []slim_corev1.ServicePort) []v1.ServicePort
- func ConvertToNode(obj interface{}) interface{}
- func CreateConfig() (*rest.Config, error)
- func CreateConfigFromAgentResponse(resp *models.DaemonConfiguration) (*rest.Config, error)
- func CreateCustomDialer(b ServiceIPGetter, log *logrus.Entry) func(ctx context.Context, addr string) (conn net.Conn, e error)
- func EqualV1Services(k8sSVC1, k8sSVC2 *slim_corev1.Service, nodeAddressing dpTypes.NodeAddressing) bool
- func GetAPIServerURL() string
- func GetBurst() int
- func GetKubeconfigPath() string
- func GetPodMetadata(k8sNs *slim_corev1.Namespace, pod *slim_corev1.Pod) (containerPorts []slim_corev1.ContainerPort, lbls map[string]string, ...)
- func GetPolicyLabelsv1(np *slim_networkingv1.NetworkPolicy) labels.LabelArray
- func GetQPS() float32
- func HasEndpointSlice(hasEndpointSlices chan struct{}, controller cache.Controller) bool
- func Init(conf k8sconfig.Configuration) error
- func IsEnabled() bool
- func IsLocalCiliumNode(n *ciliumv2.CiliumNode) bool
- func K8sErrorHandler(e error)
- func NewClusterService(id ServiceID, k8sService *Service, k8sEndpoints *Endpoints) serviceStore.ClusterService
- func ObjToCCEC(obj interface{}) *cilium_v2.CiliumClusterwideEnvoyConfig
- func ObjToCEC(obj interface{}) *cilium_v2.CiliumEnvoyConfig
- func ObjToCEGP(obj interface{}) *cilium_v2.CiliumEgressGatewayPolicy
- func ObjToCENP(obj interface{}) *cilium_v2alpha1.CiliumEgressNATPolicy
- func ObjToCLRP(obj interface{}) *cilium_v2.CiliumLocalRedirectPolicy
- func ObjToCiliumEndpoint(obj interface{}) *types.CiliumEndpoint
- func ObjToCiliumEndpointSlice(obj interface{}) *cilium_v2alpha1.CiliumEndpointSlice
- func ObjToCiliumNode(obj interface{}) *cilium_v2.CiliumNode
- func ObjToSlimCNP(obj interface{}) *types.SlimCNP
- func ObjToV1Beta1EndpointSlice(obj interface{}) *slim_discover_v1beta1.EndpointSlice
- func ObjToV1EndpointSlice(obj interface{}) *slim_discover_v1.EndpointSlice
- func ObjToV1Endpoints(obj interface{}) *slim_corev1.Endpoints
- func ObjToV1Ingress(obj interface{}) *slim_networkingv1.Ingress
- func ObjToV1Namespace(obj interface{}) *slim_corev1.Namespace
- func ObjToV1NetworkPolicy(obj interface{}) *slim_networkingv1.NetworkPolicy
- func ObjToV1Node(obj interface{}) *v1.Node
- func ObjToV1PartialObjectMetadata(obj interface{}) *slim_metav1.PartialObjectMetadata
- func ObjToV1Secret(obj interface{}) *slim_corev1.Secret
- func ObjToV1Services(obj interface{}) *slim_corev1.Service
- func ObjTov1Pod(obj interface{}) *slim_corev1.Pod
- func ParseEndpointSliceV1(ep *slim_discovery_v1.EndpointSlice) (EndpointSliceID, *Endpoints)
- func ParseEndpointSliceV1Beta1(ep *slim_discovery_v1beta1.EndpointSlice) (EndpointSliceID, *Endpoints)
- func ParseEndpoints(ep *slim_corev1.Endpoints) (ServiceID, *Endpoints)
- func ParseNetworkPolicy(np *slim_networkingv1.NetworkPolicy) (api.Rules, error)
- func ParseNode(k8sNode *slim_corev1.Node, source source.Source) *nodeTypes.Node
- func ParseNodeAddressType(k8sAddress slim_corev1.NodeAddressType) (addressing.AddressType, error)
- func ParseService(svc *slim_corev1.Service, nodeAddressing types.NodeAddressing) (ServiceID, *Service)
- func PreprocessRules(r api.Rules, cache *ServiceCache, ipcache *ipcache.IPCache) error
- func SupportsEndpointSlice() bool
- func SupportsEndpointSliceV1() bool
- func WaitForNodeInformation(ctx context.Context, nodeGetter nodeGetter) error
- type Backend
- type CCNPStatusEventHandler
- type CNPNSWithMeta
- type CNPStatusEventHandler
- func (c *CNPStatusEventHandler) OnDelete(_ store.NamedKey)
- func (c *CNPStatusEventHandler) OnUpdate(key store.Key)
- func (c *CNPStatusEventHandler) StartStatusHandler(cnp *types.SlimCNP)
- func (c *CNPStatusEventHandler) StopStatusHandler(cnp *types.SlimCNP)
- func (c *CNPStatusEventHandler) UpdateCNPStore(cnpStore *store.SharedStore)
- type CNPStatusUpdateContext
- type CacheAction
- type EndpointSliceID
- type EndpointSlices
- type Endpoints
- type FrontendList
- type JSONPatch
- type K8sAPIExtensionsClient
- type K8sCiliumClient
- type K8sClient
- func (k8sCli K8sClient) AnnotateNode(nodeName string, encryptKey uint8, v4CIDR, v6CIDR *cidr.CIDR, ...) error
- func (k8sCli K8sClient) GetK8sNode(ctx context.Context, nodeName string) (*core_v1.Node, error)
- func (k8sCli K8sClient) GetSecrets(ctx context.Context, ns, name string) (map[string][]byte, error)
- type K8sMetaObject
- type NodePortToFrontend
- type NodeStatusUpdate
- type NodeStatusUpdater
- type RuleTranslator
- type Service
- func (in *Service) DeepCopy() *Service
- func (in *Service) DeepCopyInto(out *Service)
- func (s *Service) DeepEqual(other *Service) bool
- func (s *Service) EqualsClusterService(svc *serviceStore.ClusterService) bool
- func (s Service) IsExternal() bool
- func (s *Service) String() string
- func (s *Service) UniquePorts() map[uint16]bool
- type ServiceCache
- func (s *ServiceCache) DebugStatus() string
- func (s *ServiceCache) DeleteEndpointSlices(epSlice endpointSlice, swg *lock.StoppableWaitGroup) ServiceID
- func (s *ServiceCache) DeleteEndpoints(k8sEndpoints *slim_corev1.Endpoints, swg *lock.StoppableWaitGroup) ServiceID
- func (s *ServiceCache) DeleteService(k8sSvc *slim_corev1.Service, swg *lock.StoppableWaitGroup)
- func (s *ServiceCache) EnsureService(svcID ServiceID, swg *lock.StoppableWaitGroup) bool
- func (s *ServiceCache) GetEndpointsOfService(svcID ServiceID) *Endpoints
- func (s *ServiceCache) GetNodeAddressing() types.NodeAddressing
- func (s *ServiceCache) GetServiceAddrsWithType(svcID ServiceID, svcType loadbalancer.SVCType) (map[loadbalancer.FEPortName][]*loadbalancer.L3n4Addr, int)
- func (s *ServiceCache) GetServiceFrontendIP(svcID ServiceID, svcType loadbalancer.SVCType) net.IP
- func (s *ServiceCache) GetServiceIP(svcID ServiceID) *loadbalancer.L3n4Addr
- func (s *ServiceCache) MergeClusterServiceDelete(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
- func (s *ServiceCache) MergeClusterServiceUpdate(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
- func (s *ServiceCache) MergeExternalServiceDelete(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
- func (s *ServiceCache) MergeExternalServiceUpdate(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
- func (s *ServiceCache) OnAddNode(node *core_v1.Node, swg *lock.StoppableWaitGroup) error
- func (s *ServiceCache) OnDeleteNode(node *core_v1.Node, swg *lock.StoppableWaitGroup) error
- func (s *ServiceCache) OnUpdateNode(oldNode, newNode *core_v1.Node, swg *lock.StoppableWaitGroup) error
- func (s *ServiceCache) UniqueServiceFrontends() FrontendList
- func (s *ServiceCache) UpdateEndpointSlicesV1(epSlice *slim_discovery_v1.EndpointSlice, swg *lock.StoppableWaitGroup) (ServiceID, *Endpoints)
- func (s *ServiceCache) UpdateEndpointSlicesV1Beta1(epSlice *slim_discovery_v1beta1.EndpointSlice, swg *lock.StoppableWaitGroup) (ServiceID, *Endpoints)
- func (s *ServiceCache) UpdateEndpoints(k8sEndpoints *slim_corev1.Endpoints, swg *lock.StoppableWaitGroup) (ServiceID, *Endpoints)
- func (s *ServiceCache) UpdateService(k8sSvc *slim_corev1.Service, swg *lock.StoppableWaitGroup) ServiceID
- type ServiceEvent
- type ServiceID
- type ServiceIPGetter
Constants ¶
const ( // AnnotationIstioSidecarStatus is the annotation added by Istio into a pod // when it is injected with a sidecar proxy. // Since Istio 0.5.0, the value of this annotation is a serialized JSON object // with the following structure ("imagePullSecrets" was added in Istio 0.8.0): // // { // "version": "0213afe1274259d2f23feb4820ad2f8eb8609b84a5538e5f51f711545b6bde88", // "initContainers": ["sleep", "istio-init"], // "containers": ["istio-proxy"], // "volumes": ["cilium-unix-sock-dir", "istio-envoy", "istio-certs"], // "imagePullSecrets": null // } AnnotationIstioSidecarStatus = "sidecar.istio.io/status" // DefaultSidecarIstioProxyImageRegexp is the default regexp compiled into // SidecarIstioProxyImageRegexp. DefaultSidecarIstioProxyImageRegexp = "cilium/istio_proxy" )
const LabelTopologyZone = "topology.kubernetes.io/zone"
Used to implement the topology aware hints.
const ( // maximum number of operations a single json patch may contain. // See https://github.com/kubernetes/kubernetes/pull/74000 MaxJSONPatchOperations = 10000 )
Variables ¶
var CCNPStatusesPath = path.Join(kvstore.BaseKeyPrefix, "state", "ccnpstatuses", "v2")
CCNPStatusesPath is the KVStore key prefix for CCNP status
var CNPStatusesPath = path.Join(kvstore.BaseKeyPrefix, "state", "cnpstatuses", "v2")
CNPStatusesPath is the prefix in the kvstore which will contain all keys representing CNPStatus state for all nodes in the cluster.
var ( // SidecarIstioProxyImageRegexp is the regular expression matching // compatible Istio sidecar istio-proxy container image names. // This is set by the "sidecar-istio-proxy-image" configuration flag. SidecarIstioProxyImageRegexp = regexp.MustCompile(DefaultSidecarIstioProxyImageRegexp) )
Functions ¶
func AnnotationsEqual ¶
AnnotationsEqual returns whether the annotation with any key in relevantAnnotations is equal in anno1 and anno2.
func ConvertCEPToCoreCEP ¶
func ConvertCEPToCoreCEP(cep *cilium_v2.CiliumEndpoint) *cilium_v2alpha1.CoreCiliumEndpoint
ConvertCEPToCoreCEP converts a CiliumEndpoint to a CoreCiliumEndpoint containing only a minimal set of entities used to
func ConvertCoreCiliumEndpointToTypesCiliumEndpoint ¶
func ConvertCoreCiliumEndpointToTypesCiliumEndpoint(ccep *cilium_v2alpha1.CoreCiliumEndpoint, ns string) *types.CiliumEndpoint
ConvertCoreCiliumEndpointToTypesCiliumEndpoint converts CoreCiliumEndpoint object to types.CiliumEndpoint.
func ConvertToCCNP ¶
func ConvertToCCNP(obj interface{}) interface{}
ConvertToCCNP converts a *cilium_v2.CiliumClusterwideNetworkPolicy into a *types.SlimCNP without the Status field of the given CNP, or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *types.SlimCNP, also without the Status field of the given CNP, in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumClusterwideNetworkPolicy nor cache.DeletedFinalStateUnknown, the original obj is returned. WARNING calling this function will set *all* fields of the given CNP as empty.
func ConvertToCNP ¶
func ConvertToCNP(obj interface{}) interface{}
ConvertToCNP converts a *cilium_v2.CiliumNetworkPolicy into a *types.SlimCNP without the Status field of the given CNP, or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *types.SlimCNP, also without the Status field of the given CNP, in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumNetworkPolicy nor cache.DeletedFinalStateUnknown, the original obj is returned. WARNING calling this function will set *all* fields of the given CNP as empty.
func ConvertToCiliumClusterwideEnvoyConfig ¶
func ConvertToCiliumClusterwideEnvoyConfig(obj interface{}) interface{}
ConvertToCiliumClusterwideEnvoyConfig converts a *cilium_v2.CiliumClusterwideEnvoyConfig into a *cilium_v2.CiliumClusterwideEnvoyConfig or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *cilium_v2.CiliumClusterwideEnvoyConfig in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumClusterwideEnvoyConfig nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToCiliumEgressGatewayPolicy ¶
func ConvertToCiliumEgressGatewayPolicy(obj interface{}) interface{}
ConvertToCiliumEgressGatewayPolicy converts a *cilium_v2.CiliumEgressGatewayPolicy into a *cilium_v2.CiliumEgressGatewayPolicy or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *cilium_v2.CiliumEgressGatewayPolicy in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumEgressGatewayPolicy nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToCiliumEgressNATPolicy ¶
func ConvertToCiliumEgressNATPolicy(obj interface{}) interface{}
ConvertToCiliumEgressNATPolicy converts a *cilium_v2.CiliumEgressNATPolicy into a *cilium_v2.CiliumEgressNATPolicy or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *cilium_v2.CiliumEgressNATPolicy in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumEgressNATPolicy nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToCiliumEndpoint ¶
func ConvertToCiliumEndpoint(obj interface{}) interface{}
ConvertToCiliumEndpoint converts a *cilium_v2.CiliumEndpoint into a *types.CiliumEndpoint or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *types.CiliumEndpoint in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumEndpoint nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToCiliumEnvoyConfig ¶
func ConvertToCiliumEnvoyConfig(obj interface{}) interface{}
ConvertToCiliumEnvoyConfig converts a *cilium_v2.CiliumEnvoyConfig into a *cilium_v2.CiliumEnvoyConfig or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *cilium_v2.CiliumEnvoyConfig in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumEnvoyConfig nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToCiliumExternalWorkload ¶
func ConvertToCiliumExternalWorkload(obj interface{}) interface{}
ConvertToCiliumExternalWorkload converts a *cilium_v2.CiliumExternalWorkload into a *cilium_v2.CiliumExternalWorkload or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *cilium_v2.CiliumExternalWorkload in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumExternalWorkload nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToCiliumLocalRedirectPolicy ¶
func ConvertToCiliumLocalRedirectPolicy(obj interface{}) interface{}
ConvertToCiliumLocalRedirectPolicy converts a *cilium_v2.CiliumLocalRedirectPolicy into a *cilium_v2.CiliumLocalRedirectPolicy or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *cilium_v2.CiliumLocalRedirectPolicy in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumLocalRedirectPolicy nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToCiliumNode ¶
func ConvertToCiliumNode(obj interface{}) interface{}
ConvertToCiliumNode converts a *cilium_v2.CiliumNode into a *cilium_v2.CiliumNode or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *cilium_v2.CiliumNode in its Obj. If the given obj can't be cast into either *cilium_v2.CiliumNode nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToK8sService ¶
func ConvertToK8sService(obj interface{}) interface{}
ConvertToK8sService converts a *v1.Service into a *slim_corev1.Service or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *slim_corev1.Service in its Obj. If the given obj can't be cast into either *slim_corev1.Service nor cache.DeletedFinalStateUnknown, the original obj is returned.
func ConvertToK8sV1LoadBalancerIngress ¶
func ConvertToK8sV1LoadBalancerIngress(slimLBIngs []slim_corev1.LoadBalancerIngress) []v1.LoadBalancerIngress
func ConvertToK8sV1ServiceAffinityConfig ¶
func ConvertToK8sV1ServiceAffinityConfig(saCfg *slim_corev1.SessionAffinityConfig) *v1.SessionAffinityConfig
func ConvertToK8sV1ServicePorts ¶
func ConvertToK8sV1ServicePorts(slimPorts []slim_corev1.ServicePort) []v1.ServicePort
func ConvertToNode ¶
func ConvertToNode(obj interface{}) interface{}
ConvertToNode converts a *v1.Node into a *types.Node or a cache.DeletedFinalStateUnknown into a cache.DeletedFinalStateUnknown with a *types.Node in its Obj. If the given obj can't be cast into either *v1.Node nor cache.DeletedFinalStateUnknown, the original obj is returned. WARNING calling this function will set *all* fields of the given Node as empty.
func CreateConfig ¶
CreateConfig creates a client configuration based on the configured API server and Kubeconfig path
func CreateConfigFromAgentResponse ¶
func CreateConfigFromAgentResponse(resp *models.DaemonConfiguration) (*rest.Config, error)
CreateConfigFromAgentResponse creates a client configuration from a models.DaemonConfigurationResponse
func CreateCustomDialer ¶
func CreateCustomDialer(b ServiceIPGetter, log *logrus.Entry) func(ctx context.Context, addr string) (conn net.Conn, e error)
CreateCustomDialer returns a custom dialer that picks the service IP, from the given ServiceIPGetter, if the address the used to dial is a k8s service.
func EqualV1Services ¶
func EqualV1Services(k8sSVC1, k8sSVC2 *slim_corev1.Service, nodeAddressing dpTypes.NodeAddressing) bool
func GetAPIServerURL ¶
func GetAPIServerURL() string
GetAPIServerURL returns the configured API server URL address
func GetKubeconfigPath ¶
func GetKubeconfigPath() string
GetKubeconfigPath returns the configured path to the kubeconfig configuration file
func GetPodMetadata ¶
func GetPodMetadata(k8sNs *slim_corev1.Namespace, pod *slim_corev1.Pod) (containerPorts []slim_corev1.ContainerPort, lbls map[string]string, retAnno map[string]string, retErr error)
GetPodMetadata returns the labels and annotations of the pod with the given namespace / name.
func GetPolicyLabelsv1 ¶
func GetPolicyLabelsv1(np *slim_networkingv1.NetworkPolicy) labels.LabelArray
GetPolicyLabelsv1 extracts the name of np. It uses the name from the Cilium annotation if present. If the policy's annotations do not contain the Cilium annotation, the policy's name field is used instead.
func HasEndpointSlice ¶
func HasEndpointSlice(hasEndpointSlices chan struct{}, controller cache.Controller) bool
HasEndpointSlice returns true if the hasEndpointSlices is closed before the controller has been synchronized with k8s.
func Init ¶
func Init(conf k8sconfig.Configuration) error
Init initializes the Kubernetes package. It is required to call Configure() beforehand.
func IsEnabled ¶
func IsEnabled() bool
IsEnabled checks if Cilium is being used in tandem with Kubernetes.
func IsLocalCiliumNode ¶
func IsLocalCiliumNode(n *ciliumv2.CiliumNode) bool
IsLocalCiliumNode returns true if the given CiliumNode object refers to the CiliumNode object representing the local node.
func K8sErrorHandler ¶
func K8sErrorHandler(e error)
K8sErrorHandler handles the error messages in a non verbose way by omitting repeated instances of the same error message for a timeout defined with k8sErrLogTimeout.
func NewClusterService ¶
func NewClusterService(id ServiceID, k8sService *Service, k8sEndpoints *Endpoints) serviceStore.ClusterService
NewClusterService returns the serviceStore.ClusterService representing a Kubernetes Service
func ObjToCCEC ¶
func ObjToCCEC(obj interface{}) *cilium_v2.CiliumClusterwideEnvoyConfig
ObjToCCEC attempts to cast object to a CCEC object and returns the object if the cast succeeds. Otherwise, nil is returned.
func ObjToCEC ¶
func ObjToCEC(obj interface{}) *cilium_v2.CiliumEnvoyConfig
ObjToCEC attempts to cast object to a CEC object and returns the object if the cast succeeds. Otherwise, nil is returned.
func ObjToCEGP ¶
func ObjToCEGP(obj interface{}) *cilium_v2.CiliumEgressGatewayPolicy
ObjToCEGP attempts to cast object to a CEGP object and returns the CEGP object if the cast succeeds. Otherwise, nil is returned.
func ObjToCENP ¶
func ObjToCENP(obj interface{}) *cilium_v2alpha1.CiliumEgressNATPolicy
ObjToCENP attempts to cast object to a CENP object and returns the CENP object if the cast succeeds. Otherwise, nil is returned.
func ObjToCLRP ¶
func ObjToCLRP(obj interface{}) *cilium_v2.CiliumLocalRedirectPolicy
ObjToCLRP attempts to cast object to a CLRP object and returns the CLRP object if the cast succeeds. Otherwise, nil is returned.
func ObjToCiliumEndpoint ¶
func ObjToCiliumEndpoint(obj interface{}) *types.CiliumEndpoint
ObjToCiliumEndpoint attempts to cast object to a CiliumEndpoint object and returns the CiliumEndpoint object if the cast succeeds. Otherwise, nil is returned.
func ObjToCiliumEndpointSlice ¶
func ObjToCiliumEndpointSlice(obj interface{}) *cilium_v2alpha1.CiliumEndpointSlice
ObjToCiliumEndpointSlice attempts to cast object to a CiliumEndpointSlice object and returns a deep copy if the castin succeeds. Otherwise, nil is returned.
func ObjToCiliumNode ¶
func ObjToCiliumNode(obj interface{}) *cilium_v2.CiliumNode
ObjToCiliumNode attempts to cast object to a CiliumNode object and returns the CiliumNode objext if the cast succeeds. Otherwise, nil is returned.
func ObjToSlimCNP ¶
func ObjToV1Beta1EndpointSlice ¶
func ObjToV1Beta1EndpointSlice(obj interface{}) *slim_discover_v1beta1.EndpointSlice
func ObjToV1EndpointSlice ¶
func ObjToV1EndpointSlice(obj interface{}) *slim_discover_v1.EndpointSlice
func ObjToV1Endpoints ¶
func ObjToV1Endpoints(obj interface{}) *slim_corev1.Endpoints
func ObjToV1Ingress ¶
func ObjToV1Ingress(obj interface{}) *slim_networkingv1.Ingress
func ObjToV1Namespace ¶
func ObjToV1Namespace(obj interface{}) *slim_corev1.Namespace
func ObjToV1NetworkPolicy ¶
func ObjToV1NetworkPolicy(obj interface{}) *slim_networkingv1.NetworkPolicy
func ObjToV1Node ¶
func ObjToV1PartialObjectMetadata ¶
func ObjToV1PartialObjectMetadata(obj interface{}) *slim_metav1.PartialObjectMetadata
func ObjToV1Secret ¶
func ObjToV1Secret(obj interface{}) *slim_corev1.Secret
func ObjToV1Services ¶
func ObjToV1Services(obj interface{}) *slim_corev1.Service
func ObjTov1Pod ¶
func ObjTov1Pod(obj interface{}) *slim_corev1.Pod
func ParseEndpointSliceV1 ¶
func ParseEndpointSliceV1(ep *slim_discovery_v1.EndpointSlice) (EndpointSliceID, *Endpoints)
ParseEndpointSliceV1 parses a Kubernetes EndpointSlice resource. It reads ready and terminating state of endpoints in the EndpointSlice to return an EndpointSlice ID and a filtered list of Endpoints for service load-balancing.
func ParseEndpointSliceV1Beta1 ¶
func ParseEndpointSliceV1Beta1(ep *slim_discovery_v1beta1.EndpointSlice) (EndpointSliceID, *Endpoints)
ParseEndpointSliceV1Beta1 parses a Kubernetes EndpointsSlice v1beta1 resource It reads ready and terminating state of endpoints in the EndpointSlice to return an EndpointSlice ID and a filtered list of Endpoints for service load-balancing.
func ParseEndpoints ¶
func ParseEndpoints(ep *slim_corev1.Endpoints) (ServiceID, *Endpoints)
ParseEndpoints parses a Kubernetes Endpoints resource
func ParseNetworkPolicy ¶
func ParseNetworkPolicy(np *slim_networkingv1.NetworkPolicy) (api.Rules, error)
ParseNetworkPolicy parses a k8s NetworkPolicy. Returns a list of Cilium policy rules that can be added, along with an error if there was an error sanitizing the rules.
func ParseNodeAddressType ¶
func ParseNodeAddressType(k8sAddress slim_corev1.NodeAddressType) (addressing.AddressType, error)
ParseNodeAddressType converts a Kubernetes NodeAddressType to a Cilium NodeAddressType. If the Kubernetes NodeAddressType does not have a corresponding Cilium AddressType, returns an error.
func ParseService ¶
func ParseService(svc *slim_corev1.Service, nodeAddressing types.NodeAddressing) (ServiceID, *Service)
ParseService parses a Kubernetes service and returns a Service.
func PreprocessRules ¶
PreprocessRules translates rules that apply to headless services
func SupportsEndpointSlice ¶
func SupportsEndpointSlice() bool
SupportsEndpointSlice returns true if cilium-operator or cilium-agent should watch and process endpoint slices.
func SupportsEndpointSliceV1 ¶
func SupportsEndpointSliceV1() bool
SupportsEndpointSliceV1 returns true if cilium-operator or cilium-agent should watch and process endpoint slices V1.
func WaitForNodeInformation ¶
WaitForNodeInformation retrieves the node information via the CiliumNode or Kubernetes Node resource. This function will block until the information is received. nodeGetter is a function used to retrieved the node from either the kube-apiserver or a local cache, depending on the caller.
Types ¶
type Backend ¶
type Backend struct { Ports serviceStore.PortConfiguration NodeName string Terminating bool HintsForZones []string }
Backend contains all ports, terminating state, and the node name of a given backend
+k8s:deepcopy-gen=true +deepequal-gen=true
func (*Backend) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend.
func (*Backend) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CCNPStatusEventHandler ¶
type CCNPStatusEventHandler struct {
*CNPStatusEventHandler
}
CCNPStatusEventHandler handles status updates events for all the CCNPs in the cluster. Upon creation of Clusterwide policies, it will start a controller for that CNP which handles sending of updates for that CCNP to the kubernetes API server. Upon receiving eventes from the key-value store it will send the update for the CCNP corresponding to the status update to the controller for that CCNP.
func NewCCNPStatusEventHandler ¶
func NewCCNPStatusEventHandler(k8sStore cache.Store, updateInterval time.Duration) *CCNPStatusEventHandler
NewCCNPStatusEventHandler returns a new CCNPStatusEventHandler. which is more or less a wrapper around the CNPStatusEventHandler itself.
type CNPNSWithMeta ¶
type CNPNSWithMeta struct { UID k8sTypes.UID Namespace string Name string Node string cilium_v2.CiliumNetworkPolicyNodeStatus }
CNPNSWithMeta is a wrapper around a CiliumNetworkPolicyNodeStatus with metadata that uniquely identifies the CNP which is being updated, and the node to which the status update corresponds. Implements pkg/kvstore/store/Key.
func (*CNPNSWithMeta) GetKeyName ¶
func (c *CNPNSWithMeta) GetKeyName() string
GetKeyName returns the uniquely identifying information of this CNPNSWithMeta as a string for use as a key in a map.
func (CNPNSWithMeta) GetName ¶
func (c CNPNSWithMeta) GetName() string
func (CNPNSWithMeta) GetNamespace ¶
func (c CNPNSWithMeta) GetNamespace() string
func (CNPNSWithMeta) GetUID ¶
func (c CNPNSWithMeta) GetUID() k8sTypes.UID
func (*CNPNSWithMeta) Marshal ¶
func (c *CNPNSWithMeta) Marshal() ([]byte, error)
Marshal marshals the CNPNSWithMeta into JSON form.
func (*CNPNSWithMeta) Unmarshal ¶
func (c *CNPNSWithMeta) Unmarshal(data []byte) error
Unmarshal unmarshals the CNPNSWithMeta from JSON form.
type CNPStatusEventHandler ¶
type CNPStatusEventHandler struct {
// contains filtered or unexported fields
}
CNPStatusEventHandler handles status updates events for all CNPs in the cluster. Upon creation of CNPs, it will start a controller for that CNP which handles sending of updates for that CNP to the Kubernetes API server. Upon receiving events from the key-value store, it will send the update for the CNP corresponding to the status update to the controller for that CNP.
func NewCNPStatusEventHandler ¶
func NewCNPStatusEventHandler(k8sStore cache.Store, updateInterval time.Duration) *CNPStatusEventHandler
NewCNPStatusEventHandler returns a new CNPStatusEventHandler.
func (*CNPStatusEventHandler) OnDelete ¶
func (c *CNPStatusEventHandler) OnDelete(_ store.NamedKey)
OnDelete is called when a delete event is called on the CNP status key. It is a NoOp
func (*CNPStatusEventHandler) OnUpdate ¶
func (c *CNPStatusEventHandler) OnUpdate(key store.Key)
OnUpdate is called when a CNPStatus object is modified in the KVStore.
func (*CNPStatusEventHandler) StartStatusHandler ¶
func (c *CNPStatusEventHandler) StartStatusHandler(cnp *types.SlimCNP)
StartStatusHandler starts the goroutine which sends status updates for the given CNP to the Kubernetes APIserver. If a status handler has already been started, it is a no-op.
func (*CNPStatusEventHandler) StopStatusHandler ¶
func (c *CNPStatusEventHandler) StopStatusHandler(cnp *types.SlimCNP)
StopStatusHandler signals that we need to stop managing the sending of status updates to the Kubernetes APIServer for the given CNP. It also cleans up all status updates from the key-value store for this CNP.
func (*CNPStatusEventHandler) UpdateCNPStore ¶
func (c *CNPStatusEventHandler) UpdateCNPStore(cnpStore *store.SharedStore)
UpdateCNPStore updates the CNP store for the status event handler This must be called before before Starting the status handler using StartStatusHandler method.
type CNPStatusUpdateContext ¶
type CNPStatusUpdateContext struct { // CiliumNPClient is the CiliumNetworkPolicy client CiliumNPClient clientset.Interface // NodeName is the name of the node, it is used to separate status // field entries per node NodeName string // NodeManager implements the backoff.NodeManager interface and is used // to provide cluster-size dependent backoff NodeManager backoff.NodeManager // UpdateDuration must be populated using spanstart.Start() to provide // the timestamp of when the status update operation was started. It is // used to provide the latency in the Prometheus metrics. UpdateDuration *spanstat.SpanStat // WaitForEndpointsAtPolicyRev must point to a function that will wait // for all local endpoints to reach the particular policy revision WaitForEndpointsAtPolicyRev func(ctx context.Context, rev uint64) error }
CNPStatusUpdateContext is the context required to update the status of a CNP. It is filled out by the owner of the Kubernetes client before UpdateStatus() is called.
func (*CNPStatusUpdateContext) UpdateStatus ¶
func (c *CNPStatusUpdateContext) UpdateStatus(ctx context.Context, cnp *types.SlimCNP, rev uint64, policyImportErr error) error
UpdateStatus updates the status section of a CiliumNetworkPolicy. It will retry as long as required to update the status unless a non-temporary error occurs in which case it expects a surrounding controller to restart or give up.
type CacheAction ¶
type CacheAction int
CacheAction is the type of action that was performed on the cache
const ( // UpdateService reflects that the service was updated or added UpdateService CacheAction = iota // DeleteService reflects that the service was deleted DeleteService )
func (CacheAction) String ¶
func (c CacheAction) String() string
String returns the cache action as a string
type EndpointSliceID ¶
EndpointSliceID identifies a Kubernetes EndpointSlice as well as the legacy v1.Endpoints.
func ParseEndpointSliceID ¶
func ParseEndpointSliceID(es endpointSlice) EndpointSliceID
ParseEndpointSliceID parses a Kubernetes endpoints slice and returns a EndpointSliceID
type EndpointSlices ¶
type EndpointSlices struct {
// contains filtered or unexported fields
}
EndpointSlices is the collection of all endpoint slices of a service. The map key is the name of the endpoint slice or the name of the legacy v1.Endpoint. The endpoints stored here are not namespaced since this structure is only used as a value of another map that is already namespaced. (see ServiceCache.endpoints).
+deepequal-gen=true
func (*EndpointSlices) DeepEqual ¶
func (in *EndpointSlices) DeepEqual(other *EndpointSlices) bool
DeepEqual is an autogenerated deepequal function, deeply comparing the receiver with other. in must be non-nil.
func (*EndpointSlices) Delete ¶
func (es *EndpointSlices) Delete(esName string) bool
Delete deletes the endpoint slice in the internal map. Returns true if there are not any more endpoints available in the map.
func (*EndpointSlices) GetEndpoints ¶
func (es *EndpointSlices) GetEndpoints() *Endpoints
GetEndpoints returns a read only a single *Endpoints structure with all Endpoints' backends joined.
func (*EndpointSlices) Upsert ¶
func (es *EndpointSlices) Upsert(esName string, e *Endpoints)
Upsert maps the 'esname' to 'e'. - 'esName': Name of the Endpoint Slice - 'e': Endpoints to store in the map
type Endpoints ¶
type Endpoints struct { // Backends is a map containing all backend IPs and ports. The key to // the map is the backend IP in string form. The value defines the list // of ports for that backend IP, plus an additional optional node name. Backends map[string]*Backend }
Endpoints is an abstraction for the Kubernetes endpoints object. Endpoints consists of a set of backend IPs in combination with a set of ports and protocols. The name of the backend ports must match the names of the frontend ports of the corresponding service.
+k8s:deepcopy-gen=true +deepequal-gen=true +deepequal-gen:private-method=true
func (*Endpoints) CIDRPrefixes ¶
CIDRPrefixes returns the endpoint's backends as a slice of IPNets.
func (*Endpoints) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoints.
func (*Endpoints) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FrontendList ¶
type FrontendList map[string]struct{}
FrontendList is the list of all k8s service frontends
func (FrontendList) LooseMatch ¶
func (l FrontendList) LooseMatch(frontend loadbalancer.L3n4Addr) (exists bool)
LooseMatch returns true if the provided frontend is found in the FrontendList. If the frontend has a protocol value set, it only matches a k8s service with a matching protocol. If no protocol is set, any k8s service matching frontend IP and port is considered a match, regardless of protocol.
type JSONPatch ¶
type JSONPatch struct { OP string `json:"op,omitempty"` Path string `json:"path,omitempty"` Value interface{} `json:"value"` }
JSONPatch structure based on the RFC 6902
type K8sAPIExtensionsClient ¶
type K8sAPIExtensionsClient struct {
apiextclientset.Interface
}
K8sAPIExtensionsClient is a wrapper around clientset.Interface.
func APIExtClient ¶
func APIExtClient() *K8sAPIExtensionsClient
APIExtClient returns the default API Extension client.
func WatcherAPIExtClient ¶
func WatcherAPIExtClient() *K8sAPIExtensionsClient
WatcherAPIExtClient returns the client dedicated to API Extensions watchers.
type K8sCiliumClient ¶
K8sCiliumClient is a wrapper around clientset.Interface.
func CiliumClient ¶
func CiliumClient() *K8sCiliumClient
CiliumClient returns the default Cilium Kubernetes client.
type K8sClient ¶
type K8sClient struct { // kubernetes.Interface is the object through which interactions with // Kubernetes are performed. kubernetes.Interface }
K8sClient is a wrapper around kubernetes.Interface.
func WatcherClient ¶
func WatcherClient() *K8sClient
WatcherClient returns the client dedicated to K8s watchers.
func (K8sClient) AnnotateNode ¶
func (k8sCli K8sClient) AnnotateNode(nodeName string, encryptKey uint8, v4CIDR, v6CIDR *cidr.CIDR, v4HealthIP, v6HealthIP, v4CiliumHostIP, v6CiliumHostIP net.IP) error
AnnotateNode writes v4 and v6 CIDRs and health IPs in the given k8s node name. In case of failure while updating the node, this function while spawn a go routine to retry the node update indefinitely.
func (K8sClient) GetK8sNode ¶
GetK8sNode returns the node with the given nodeName.
type K8sMetaObject ¶
type NodePortToFrontend ¶
type NodePortToFrontend map[string]*loadbalancer.L3n4AddrID
+deepequal-gen=true
func (*NodePortToFrontend) DeepEqual ¶
func (in *NodePortToFrontend) DeepEqual(other *NodePortToFrontend) bool
DeepEqual is an autogenerated deepequal function, deeply comparing the receiver with other. in must be non-nil.
type NodeStatusUpdate ¶
type NodeStatusUpdate struct { *cilium_v2.CiliumNetworkPolicyNodeStatus // contains filtered or unexported fields }
NodeStatusUpdate pairs a CiliumNetworkPolicyNodeStatus to a specific node.
type NodeStatusUpdater ¶
type NodeStatusUpdater struct {
// contains filtered or unexported fields
}
NodeStatusUpdater handles the lifecycle around sending CNP NodeStatus updates.
type RuleTranslator ¶
type RuleTranslator struct { Service ServiceID Endpoint Endpoints ServiceLabels map[string]string Revert bool AllocatePrefixes bool // contains filtered or unexported fields }
RuleTranslator implements pkg/policy.Translator interface Translate populates/depopulates given rule with ToCIDR rules Based on provided service/endpoint
func NewK8sTranslator ¶
func NewK8sTranslator( ipcache *ipcache.IPCache, serviceInfo ServiceID, endpoint Endpoints, revert bool, labels map[string]string, allocatePrefixes bool) RuleTranslator
NewK8sTranslator returns RuleTranslator
func (RuleTranslator) Translate ¶
func (k RuleTranslator) Translate(r *api.Rule, result *policy.TranslationResult) error
Translate calls TranslateEgress on all r.Egress rules
func (RuleTranslator) TranslateEgress ¶
func (k RuleTranslator) TranslateEgress(r *api.EgressRule, result *policy.TranslationResult) error
TranslateEgress populates/depopulates egress rules with ToCIDR entries based on toService entries
type Service ¶
type Service struct { // Until deepequal-gen adds support for net.IP we need to compare this field // manually. // Whenever creating a new service we should make sure that the FrontendIPs are // sorted, so we always generate the same string representation. // +deepequal-gen=false FrontendIPs []net.IP IsHeadless bool // IncludeExternal is true when external endpoints from other clusters // should be included IncludeExternal bool Shared bool // TrafficPolicy controls how backends are selected. If set to "Local", only // node-local backends are chosen TrafficPolicy loadbalancer.SVCTrafficPolicy // HealthCheckNodePort defines on which port the node runs a HTTP health // check server which may be used by external loadbalancers to determine // if a node has local backends. This will only have effect if both // LoadBalancerIPs is not empty and TrafficPolicy is SVCTrafficPolicyLocal. HealthCheckNodePort uint16 Ports map[loadbalancer.FEPortName]*loadbalancer.L4Addr // NodePorts stores mapping for port name => NodePort frontend addr string => // NodePort fronted addr. The string addr => addr indirection is to avoid // storing duplicates. NodePorts map[loadbalancer.FEPortName]NodePortToFrontend // K8sExternalIPs stores mapping of the endpoint in a string format to the // externalIP in net.IP format. // // Until deepequal-gen adds support for net.IP we need to compare this field // manually. // +deepequal-gen=false K8sExternalIPs map[string]net.IP // LoadBalancerIPs stores LB IPs assigned to the service (string(IP) => IP). // // Until deepequal-gen adds support for net.IP we need to compare this field // manually. // +deepequal-gen=false LoadBalancerIPs map[string]net.IP LoadBalancerSourceRanges map[string]*cidr.CIDR Labels map[string]string Selector map[string]string // SessionAffinity denotes whether service has the clientIP session affinity SessionAffinity bool // SessionAffinityTimeoutSeconds denotes session affinity timeout SessionAffinityTimeoutSec uint32 // Type is the internal service type // +deepequal-gen=false Type loadbalancer.SVCType // TopologyAware denotes whether service endpoints might have topology aware // hints TopologyAware bool }
Service is an abstraction for a k8s service that is composed by the frontend IP addresses (FEIPs) and the map of the frontend ports (Ports).
+k8s:deepcopy-gen=true +deepequal-gen=true +deepequal-gen:private-method=true
func NewService ¶
func NewService(ips []net.IP, externalIPs, loadBalancerIPs, loadBalancerSourceRanges []string, headless bool, trafficPolicy loadbalancer.SVCTrafficPolicy, healthCheckNodePort uint16, labels, selector map[string]string, namespace string, svcType loadbalancer.SVCType) *Service
NewService returns a new Service with the Ports map initialized.
func ParseClusterService ¶
func ParseClusterService(svc *serviceStore.ClusterService) *Service
ParseClusterService parses a ClusterService and returns a Service. ClusterService is a subset of what a Service can express, especially, ClusterService does not have: - other service types than ClusterIP - an explicit traffic policy, SVCTrafficPolicyCluster is assumed - health check node ports - NodePorts - external IPs - LoadBalancerIPs - LoadBalancerSourceRanges - SessionAffinity
ParseClusterService() is paired with EqualsClusterService() that has the above wired in.
func (*Service) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.
func (*Service) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Service) EqualsClusterService ¶
func (s *Service) EqualsClusterService(svc *serviceStore.ClusterService) bool
EqualsClusterService returns true the given ClusterService would parse into Service if ParseClusterService() would be called. This is necessary to avoid memory allocations that would be performed by ParseClusterService() when the service already exists.
func (Service) IsExternal ¶
IsExternal returns true if the service is expected to serve out-of-cluster endpoints:
func (*Service) UniquePorts ¶
UniquePorts returns a map of all unique ports configured in the service
type ServiceCache ¶
type ServiceCache struct { Events chan ServiceEvent // contains filtered or unexported fields }
ServiceCache is a list of services correlated with the matching endpoints. The Events member will receive events as services.
func NewServiceCache ¶
func NewServiceCache(nodeAddressing types.NodeAddressing) ServiceCache
NewServiceCache returns a new ServiceCache
func (*ServiceCache) DebugStatus ¶
func (s *ServiceCache) DebugStatus() string
DebugStatus implements debug.StatusObject to provide debug status collection ability
func (*ServiceCache) DeleteEndpointSlices ¶
func (s *ServiceCache) DeleteEndpointSlices(epSlice endpointSlice, swg *lock.StoppableWaitGroup) ServiceID
func (*ServiceCache) DeleteEndpoints ¶
func (s *ServiceCache) DeleteEndpoints(k8sEndpoints *slim_corev1.Endpoints, swg *lock.StoppableWaitGroup) ServiceID
DeleteEndpoints parses a Kubernetes endpoints and removes it from the ServiceCache
func (*ServiceCache) DeleteService ¶
func (s *ServiceCache) DeleteService(k8sSvc *slim_corev1.Service, swg *lock.StoppableWaitGroup)
DeleteService parses a Kubernetes service and removes it from the ServiceCache
func (*ServiceCache) EnsureService ¶
func (s *ServiceCache) EnsureService(svcID ServiceID, swg *lock.StoppableWaitGroup) bool
func (*ServiceCache) GetEndpointsOfService ¶
func (s *ServiceCache) GetEndpointsOfService(svcID ServiceID) *Endpoints
GetEndpointsOfService returns all the endpoints that correlate with a service given a ServiceID.
func (*ServiceCache) GetNodeAddressing ¶
func (s *ServiceCache) GetNodeAddressing() types.NodeAddressing
GetNodeAddressing returns the registered node addresses to this service cache.
func (*ServiceCache) GetServiceAddrsWithType ¶
func (s *ServiceCache) GetServiceAddrsWithType(svcID ServiceID, svcType loadbalancer.SVCType) (map[loadbalancer.FEPortName][]*loadbalancer.L3n4Addr, int)
GetServiceAddrsWithType returns a map of all the ports and slice of L3n4Addr that are backing the given Service ID with given type. It also returns the number of frontend IPs associated with the service. Note: The returned IPs are with External scope.
func (*ServiceCache) GetServiceFrontendIP ¶
func (s *ServiceCache) GetServiceFrontendIP(svcID ServiceID, svcType loadbalancer.SVCType) net.IP
GetServiceFrontendIP returns the frontend IP (aka clusterIP) for the given service with type.
func (*ServiceCache) GetServiceIP ¶
func (s *ServiceCache) GetServiceIP(svcID ServiceID) *loadbalancer.L3n4Addr
GetServiceIP returns a random L3n4Addr that is backing the given Service ID. The returned IP is with external scope since its string representation might be used for net Dialer.
func (*ServiceCache) MergeClusterServiceDelete ¶
func (s *ServiceCache) MergeClusterServiceDelete(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
MergeClusterServiceDelete merges the deletion of a cluster service in a remote cluster into the local service cache, deleting the local service.
func (*ServiceCache) MergeClusterServiceUpdate ¶
func (s *ServiceCache) MergeClusterServiceUpdate(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
MergeClusterServiceUpdate merges a cluster service of a local cluster into the local service cache. The service endpoints are stored as external endpoints and are correlated on demand with local services via correlateEndpoints(). Local service is created and/or updated if needed.
func (*ServiceCache) MergeExternalServiceDelete ¶
func (s *ServiceCache) MergeExternalServiceDelete(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
MergeExternalServiceDelete merges the deletion of a cluster service in a remote cluster into the local service cache. The service endpoints are stored as external endpoints and are correlated on demand with local services via correlateEndpoints().
func (*ServiceCache) MergeExternalServiceUpdate ¶
func (s *ServiceCache) MergeExternalServiceUpdate(service *serviceStore.ClusterService, swg *lock.StoppableWaitGroup)
MergeExternalServiceUpdate merges a cluster service of a remote cluster into the local service cache. The service endpoints are stored as external endpoints and are correlated on demand with local services via correlateEndpoints().
func (*ServiceCache) OnAddNode ¶
func (s *ServiceCache) OnAddNode(node *core_v1.Node, swg *lock.StoppableWaitGroup) error
func (*ServiceCache) OnDeleteNode ¶
func (s *ServiceCache) OnDeleteNode(node *core_v1.Node, swg *lock.StoppableWaitGroup) error
func (*ServiceCache) OnUpdateNode ¶
func (s *ServiceCache) OnUpdateNode(oldNode, newNode *core_v1.Node, swg *lock.StoppableWaitGroup) error
func (*ServiceCache) UniqueServiceFrontends ¶
func (s *ServiceCache) UniqueServiceFrontends() FrontendList
UniqueServiceFrontends returns all externally scoped services known to the service cache as a map, indexed by the string representation of a loadbalancer.L3n4Addr. This helper is only used in unit tests.
func (*ServiceCache) UpdateEndpointSlicesV1 ¶
func (s *ServiceCache) UpdateEndpointSlicesV1(epSlice *slim_discovery_v1.EndpointSlice, swg *lock.StoppableWaitGroup) (ServiceID, *Endpoints)
func (*ServiceCache) UpdateEndpointSlicesV1Beta1 ¶
func (s *ServiceCache) UpdateEndpointSlicesV1Beta1(epSlice *slim_discovery_v1beta1.EndpointSlice, swg *lock.StoppableWaitGroup) (ServiceID, *Endpoints)
func (*ServiceCache) UpdateEndpoints ¶
func (s *ServiceCache) UpdateEndpoints(k8sEndpoints *slim_corev1.Endpoints, swg *lock.StoppableWaitGroup) (ServiceID, *Endpoints)
UpdateEndpoints parses a Kubernetes endpoints and adds or updates it in the ServiceCache. Returns the ServiceID unless the Kubernetes endpoints could not be parsed and a bool to indicate whether the endpoints was changed in the cache or not.
func (*ServiceCache) UpdateService ¶
func (s *ServiceCache) UpdateService(k8sSvc *slim_corev1.Service, swg *lock.StoppableWaitGroup) ServiceID
UpdateService parses a Kubernetes service and adds or updates it in the ServiceCache. Returns the ServiceID unless the Kubernetes service could not be parsed and a bool to indicate whether the service was changed in the cache or not.
type ServiceEvent ¶
type ServiceEvent struct { // Action is the action that was performed in the cache Action CacheAction // ID is the identified of the service ID ServiceID // Service is the service structure Service *Service // OldService is the service structure OldService *Service // Endpoints is the endpoints structured correlated with the service Endpoints *Endpoints // SWG provides a mechanism to detect if a service was synchronized with // the datapath. SWG *lock.StoppableWaitGroup }
ServiceEvent is emitted via the Events channel of ServiceCache and describes the change that occurred in the cache
type ServiceID ¶
type ServiceID struct { Name string `json:"serviceName,omitempty"` Namespace string `json:"namespace,omitempty"` }
ServiceID identifies the Kubernetes service
func ParseEndpointsID ¶
func ParseEndpointsID(svc *slim_corev1.Endpoints) ServiceID
ParseEndpointsID parses a Kubernetes endpoints and returns the ServiceID
func ParseServiceID ¶
func ParseServiceID(svc *slim_corev1.Service) ServiceID
ParseServiceID parses a Kubernetes service and returns the ServiceID
func ParseServiceIDFrom ¶
ParseServiceIDFrom returns a ServiceID derived from the given kubernetes service FQDN.
type ServiceIPGetter ¶
type ServiceIPGetter interface {
GetServiceIP(svcID ServiceID) *loadbalancer.L3n4Addr
}
Source Files ¶
- annotate.go
- ccnpstatus.go
- cilium_node.go
- client.go
- cnp.go
- cnpstatus.go
- config.go
- doc.go
- endpoints.go
- error_helpers.go
- factory_functions.go
- init.go
- json_patch.go
- labels.go
- logfields.go
- network_policy.go
- node.go
- rule_translate.go
- service.go
- service_cache.go
- zz_generated.deepcopy.go
- zz_generated.deepequal.go
Directories ¶
Path | Synopsis |
---|---|
apis
|
|
cilium.io/v2
Package v2 is the v2 version of the API.
|
Package v2 is the v2 version of the API. |
cilium.io/v2alpha1
Package v2alpha1 is the v2alpha1 version of the API.
|
Package v2alpha1 is the v2alpha1 version of the API. |
client
|
|
clientset/versioned
This package has the automatically generated clientset.
|
This package has the automatically generated clientset. |
clientset/versioned/fake
This package has the automatically generated fake clientset.
|
This package has the automatically generated fake clientset. |
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
|
This package contains the scheme of the automatically generated clientset. |
clientset/versioned/typed/cilium.io/v2
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
clientset/versioned/typed/cilium.io/v2/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
clientset/versioned/typed/cilium.io/v2alpha1
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
clientset/versioned/typed/cilium.io/v2alpha1/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
slim
|
|
k8s/api/core/v1
Package v1 contains slimmer versions of k8s core types.
|
Package v1 contains slimmer versions of k8s core types. |
k8s/api/discovery/v1
Package v1 contains slimmer versions of k8s discovery types.
|
Package v1 contains slimmer versions of k8s discovery types. |
k8s/api/discovery/v1beta1
Package v1beta1 contains slimmer versions of k8s discovery types.
|
Package v1beta1 contains slimmer versions of k8s discovery types. |
k8s/api/networking/v1
Package v1 contains slimmer versions of k8s networking types.
|
Package v1 contains slimmer versions of k8s networking types. |
k8s/apiextensions-client/clientset/versioned
This package has the automatically generated clientset.
|
This package has the automatically generated clientset. |
k8s/apiextensions-client/clientset/versioned/fake
This package has the automatically generated fake clientset.
|
This package has the automatically generated fake clientset. |
k8s/apiextensions-client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
|
This package contains the scheme of the automatically generated clientset. |
k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
k8s/apiextensions-client/clientset/versioned/typed/apiextensions/v1/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
k8s/apis/apiextensions/v1
Package v1 is the v1 version of the API.
|
Package v1 is the v1 version of the API. |
k8s/apis/labels
Package labels implements a simple label system, parsing and matching selectors with sets of labels.
|
Package labels implements a simple label system, parsing and matching selectors with sets of labels. |
k8s/apis/meta/v1
Package types contains slimmer versions of k8s types.
|
Package types contains slimmer versions of k8s types. |
k8s/apis/meta/v1beta1
package v1beta1 is alpha objects from meta that will be introduced.
|
package v1beta1 is alpha objects from meta that will be introduced. |
k8s/apis/util/intstr
Package types contains slimmer versions of k8s types.
|
Package types contains slimmer versions of k8s types. |
k8s/client/clientset/versioned
This package has the automatically generated clientset.
|
This package has the automatically generated clientset. |
k8s/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
|
This package has the automatically generated fake clientset. |
k8s/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
|
This package contains the scheme of the automatically generated clientset. |
k8s/client/clientset/versioned/typed/core/v1
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
k8s/client/clientset/versioned/typed/core/v1/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
k8s/client/clientset/versioned/typed/discovery/v1
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
k8s/client/clientset/versioned/typed/discovery/v1/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
k8s/client/clientset/versioned/typed/discovery/v1beta1
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
k8s/client/clientset/versioned/typed/discovery/v1beta1/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
k8s/client/clientset/versioned/typed/networking/v1
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
k8s/client/clientset/versioned/typed/networking/v1/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
Package synced provides tools for tracking if k8s resources have been initially sychronized with the k8s apiserver.
|
Package synced provides tools for tracking if k8s resources have been initially sychronized with the k8s apiserver. |
Package types contains slimmer versions of k8s types.
|
Package types contains slimmer versions of k8s types. |
Package version keeps track of the Kubernetes version the client is connected to
|
Package version keeps track of the Kubernetes version the client is connected to |
subscriber
Package subscriber implements a mechanism to represent K8s watcher subscribers and allows K8s events to objects / resources to notify their respective subscribers.
|
Package subscriber implements a mechanism to represent K8s watcher subscribers and allows K8s events to objects / resources to notify their respective subscribers. |