resources

package
v1.3.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MutationCheckpointInterval = 60 * time.Second

MutationCheckpointInterval is the interval for logging mutation checkpoint messages.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	Logger            *zap.Logger
	K8sClient         k8sclient.Client
	Stats             *stream.Stats
	FlowCollectorType pb.FlowCollector
	ClusterName       string // Optional: cluster name for self-managed clusters
}

Factory creates resources stream clients.

func (*Factory) Name

func (f *Factory) Name() string

Name returns the stream name for logging.

func (*Factory) NewStreamClient

func (f *Factory) NewStreamClient(ctx context.Context, grpcConn grpc.ClientConnInterface) (stream.StreamClient, error)

NewStreamClient creates a new resources stream client.

type KubernetesResourcesStream

type KubernetesResourcesStream interface {
	Send(req *pb.SendKubernetesResourcesRequest) error
	Recv() (*pb.SendKubernetesResourcesResponse, error)
}

KubernetesResourcesStream abstracts the SendKubernetesResources gRPC stream.

type ResourceInfo added in v1.3.14

type ResourceInfo struct {
	Group   string
	Version string
}

ResourceInfo holds the API group and preferred version for a resource.

type ResourceStreamSender

type ResourceStreamSender interface {
	SendObjectData(logger *zap.Logger, metadata *pb.KubernetesObjectData) error
	CreateMutationObject(metadata *pb.KubernetesObjectData, eventType watch.EventType) *pb.KubernetesResourceMutation
}

ResourceStreamSender abstracts the operations for sending resources to CloudSecure. Implemented by resourcesClient.

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher encapsulates components for listing and managing Kubernetes resources.

func NewWatcher

func NewWatcher(config WatcherConfig) *Watcher

NewWatcher creates a new Watcher for a specific resource type.

func (*Watcher) DynamicListResources

func (r *Watcher) DynamicListResources(ctx context.Context, logger *zap.Logger) (string, error)

DynamicListResources lists a specified resource dynamically and sends down the current gRPC stream.

func (*Watcher) ExtractObjectMetas

func (r *Watcher) ExtractObjectMetas(resources *unstructured.UnstructuredList) ([]metav1.ObjectMeta, error)

func (*Watcher) FetchResources

func (r *Watcher) FetchResources(ctx context.Context, namespace string) (*unstructured.UnstructuredList, error)

func (*Watcher) ListResources

func (r *Watcher) ListResources(ctx context.Context, namespace string) ([]metav1.ObjectMeta, string, string, string, string, error)

func (*Watcher) WatchK8sResources

func (r *Watcher) WatchK8sResources(ctx context.Context, cancel context.CancelFunc, resourceVersion string, mutationChan chan *pb.KubernetesResourceMutation)

WatchK8sResources initiates a watch stream for the specified Kubernetes resource.

type WatcherConfig

type WatcherConfig struct {
	ResourceName    string // plural-lowercase (e.g., "pods")
	ApiGroup        string
	ApiVersion      string
	Clientset       kubernetes.Interface
	BaseLogger      *zap.Logger
	DynamicClient   dynamic.Interface
	ResourcesClient ResourceStreamSender
	Limiter         *rate.Limiter
}

WatcherConfig holds the configuration for creating a new Watcher.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL