Documentation ¶
Overview ¶
Package k8s abstracts all Kubernetes specific behaviour
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ResourcesCell provides a set of handles to Kubernetes resources used throughout the // agent. Each of the resources share a client-go informer and backing store so we only // have one watch API call for each resource kind and that we maintain only one copy of each object. // // See pkg/k8s/resource/resource.go for documentation on the Resource[T] type. ResourcesCell = cell.Module( "k8s-resources", "Agent Kubernetes resources", cell.Config(k8s.DefaultConfig), LocalNodeCell, cell.Provide( k8s.ServiceResource, k8s.EndpointsResource, k8s.NamespaceResource, k8s.NetworkPolicyResource, k8s.CiliumNetworkPolicyResource, k8s.CiliumClusterwideNetworkPolicyResource, k8s.CiliumCIDRGroupResource, k8s.CiliumNodeResource, k8s.CiliumSlimEndpointResource, k8s.CiliumEndpointSliceResource, ), ) LocalNodeCell = cell.Module( "k8s-local-node-resources", "Agent Kubernetes local node resources", cell.Provide( func(lc hive.Lifecycle, cs client.Clientset) (LocalNodeResource, error) { return k8s.NodeResource( lc, cs, func(opts *metav1.ListOptions) { opts.FieldSelector = fields.ParseSelectorOrDie("metadata.name=" + nodeTypes.GetName()).String() }, ) }, func(lc hive.Lifecycle, cs client.Clientset) (LocalCiliumNodeResource, error) { return k8s.CiliumNodeResource( lc, cs, func(opts *metav1.ListOptions) { opts.FieldSelector = fields.ParseSelectorOrDie("metadata.name=" + nodeTypes.GetName()).String() }, ) }, func(lc hive.Lifecycle, cs client.Clientset) (LocalPodResource, error) { return k8s.PodResource( lc, cs, func(opts *metav1.ListOptions) { opts.FieldSelector = fields.ParseSelectorOrDie("spec.nodeName=" + nodeTypes.GetName()).String() }, ) }, ), ) )
Functions ¶
func WaitForNodeInformation ¶ added in v1.15.0
func WaitForNodeInformation(ctx context.Context, log logrus.FieldLogger, localNode LocalNodeResource, localCiliumNode LocalCiliumNodeResource) error
WaitForNodeInformation retrieves the node information via the CiliumNode or Kubernetes Node resource. This function will block until the information is received.
Types ¶
type LocalCiliumNodeResource ¶
type LocalCiliumNodeResource resource.Resource[*cilium_api_v2.CiliumNode]
LocalCiliumNodeResource is a resource.Resource[*cilium_api_v2.CiliumNode] but one which will only stream updates for the CiliumNode object associated with the node we are currently running on.
type LocalNodeResource ¶
type LocalNodeResource resource.Resource[*slim_corev1.Node]
LocalNodeResource is a resource.Resource[*slim_corev1.Node] but one which will only stream updates for the node object associated with the node we are currently running on.
type LocalNodeResources ¶ added in v1.15.0
type LocalNodeResources struct { cell.In LocalNode LocalNodeResource LocalCiliumNode LocalCiliumNodeResource }
LocalNodeResources is a convenience struct to group CiliumNode and Node resources as cell constructor parameters.
type LocalPodResource ¶
type LocalPodResource resource.Resource[*slim_corev1.Pod]
LocalPodResource is a resource.Resource[*slim_corev1.Pod] but one which will only stream updates for pod objects scheduled on the node we are currently running on.
type Resources ¶
type Resources struct { cell.In Services resource.Resource[*slim_corev1.Service] Endpoints resource.Resource[*k8s.Endpoints] LocalNode LocalNodeResource LocalCiliumNode LocalCiliumNodeResource LocalPods LocalPodResource Namespaces resource.Resource[*slim_corev1.Namespace] NetworkPolicies resource.Resource[*slim_networkingv1.NetworkPolicy] CiliumNetworkPolicies resource.Resource[*cilium_api_v2.CiliumNetworkPolicy] CiliumClusterwideNetworkPolicies resource.Resource[*cilium_api_v2.CiliumClusterwideNetworkPolicy] CiliumCIDRGroups resource.Resource[*cilium_api_v2alpha1.CiliumCIDRGroup] CiliumSlimEndpoint resource.Resource[*types.CiliumEndpoint] CiliumEndpointSlice resource.Resource[*cilium_api_v2alpha1.CiliumEndpointSlice] }
Resources is a convenience struct to group all the agent k8s resources as cell constructor parameters.