event

package
v0.0.0-...-f843765 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeHandler

type AttributeHandler interface {
	ConvertLabels(targetPodLabels map[string]string) map[string][]string
	GetLocalEnvVars(obj metav1.Object) (map[string]string, error)
	GetLabelsFromEnvVars(envVars map[string]string) (map[string][]string, error)
	MergeLabels(targetLabels ...map[string][]string) (map[string][]string, error)
}

type Handler

type Handler struct {
	Client               kubernetes.Interface
	DyanmicClient        dynamic.Interface
	NetworkPolicyHandler NetworkPolicyHandler
	ObjectHandler        ObjectHandler
	AttributeHandler     AttributeHandler
}

func (*Handler) HandleAdd

func (h *Handler) HandleAdd(obj interface{}) error

HandleAdd handles the case when a K8s object of interest is added to the cluster, and creates a NetworkPolicy for it

func (*Handler) HandleDelete

func (h *Handler) HandleDelete(obj interface{}) error

HandleDelete handles the case when an object of interest is deleted from the cluster. If the object had a NetworkPolicy belonging to it, the policy gets deleted

func (*Handler) HandleUpdate

func (h *Handler) HandleUpdate(oldObj, newObj interface{}) error

HandleUpdate handles the case when a K8s object of interest is updated in the cluster, provided the object's environment variables or labels have changed

type NetworkPolicyHandler

type NetworkPolicyHandler interface {
	NewPolicy(name string, namespace string, podSelectorLabels map[string]string, targetPodLabels map[string][]string) (*networkingv1.NetworkPolicy, error)
	GetPolicyByPodLabels(namespace string, podLabels map[string]string) (*networkingv1.NetworkPolicy, error)
	AppendLabelsToPeers(targetPodLabels map[string][]string) (ingressPeers []networkingv1.NetworkPolicyPeer, egressPeers []networkingv1.NetworkPolicyPeer, err error)
}

type ObjectHandler

type ObjectHandler interface {
	AddLabel() error
	Mutate(action object.Action) error
}

Directories

Path Synopsis
Package eventmock is a generated GoMock package.
Package eventmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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