server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PolicyNetworkAnnotation is annotation for multiNetworkPolicy,
	// to specify which networks(i.e. net-attach-def) are the targets
	// of the policy
	PolicyNetworkAnnotation = "k8s.v1.cni.cncf.io/policy-for"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// kubeconfig is the path to a KubeConfig file.
	Kubeconfig string
	// KConfig points to a k8s API config, takes precedence over Kubeconfig
	KConfig *rest.Config
	// contains filtered or unexported fields
}

Options stores option for the command

func NewOptions

func NewOptions() *Options

NewOptions initializes Options

func (*Options) AddFlags

func (o *Options) AddFlags(fs *pflag.FlagSet)

AddFlags adds command line flags into command

type Server

type Server struct {

	// clients to access k8s API
	Client              clientset.Interface
	NetworkPolicyClient multiclient.Interface
	NetDefClient        netdefclient.Interface

	// other fields
	Hostname         string
	Broadcaster      record.EventBroadcaster
	Recorder         record.EventRecorder
	Options          *Options
	ConfigSyncPeriod time.Duration
	NodeRef          *v1.ObjectReference
	// contains filtered or unexported fields
}

Server structure defines data for server

func NewServer

func NewServer(o *Options) (*Server, error)

NewServer creates a new *Server instance

func (*Server) AllExceptPodsSynced

func (s *Server) AllExceptPodsSynced() bool

AllExceptPodsSynced return true if all informers except Pod have synced caches

func (*Server) AllSynced

func (s *Server) AllSynced() bool

AllSynced return true if all informers caches synced

func (*Server) OnNamespaceAdd

func (s *Server) OnNamespaceAdd(ns *v1.Namespace)

OnNamespaceAdd Event handler for Namespace

func (*Server) OnNamespaceDelete

func (s *Server) OnNamespaceDelete(ns *v1.Namespace)

OnNamespaceDelete Event handler for Namespace

func (*Server) OnNamespaceSynced

func (s *Server) OnNamespaceSynced()

OnNamespaceSynced Event handler for Namespace

func (*Server) OnNamespaceUpdate

func (s *Server) OnNamespaceUpdate(oldNamespace, ns *v1.Namespace)

OnNamespaceUpdate Event handler for Namespace

func (*Server) OnNetDefAdd

func (s *Server) OnNetDefAdd(net *netdefv1.NetworkAttachmentDefinition)

OnNetDefAdd Event handler for NetworkAttachmentDefinition

func (*Server) OnNetDefDelete

func (s *Server) OnNetDefDelete(net *netdefv1.NetworkAttachmentDefinition)

OnNetDefDelete Event handler for NetworkAttachmentDefinition

func (*Server) OnNetDefSynced

func (s *Server) OnNetDefSynced()

OnNetDefSynced Event handler for NetworkAttachmentDefinition

func (*Server) OnNetDefUpdate

func (s *Server) OnNetDefUpdate(oldNet, net *netdefv1.NetworkAttachmentDefinition)

OnNetDefUpdate Event handler for NetworkAttachmentDefinition

func (*Server) OnPodAdd

func (s *Server) OnPodAdd(pod *v1.Pod)

OnPodAdd Event handler for Pod

func (*Server) OnPodDelete

func (s *Server) OnPodDelete(pod *v1.Pod)

OnPodDelete Event handler for Pod

func (*Server) OnPodSynced

func (s *Server) OnPodSynced()

OnPodSynced Event handler for Pod

func (*Server) OnPodUpdate

func (s *Server) OnPodUpdate(oldPod, pod *v1.Pod)

OnPodUpdate Event handler for Pod

func (*Server) OnPolicyAdd

func (s *Server) OnPolicyAdd(policy *multiv1beta1.MultiNetworkPolicy)

OnPolicyAdd Event handler for Policy

func (*Server) OnPolicyDelete

func (s *Server) OnPolicyDelete(policy *multiv1beta1.MultiNetworkPolicy)

OnPolicyDelete Event handler for Policy

func (*Server) OnPolicySynced

func (s *Server) OnPolicySynced()

OnPolicySynced Event handler for Policy

func (*Server) OnPolicyUpdate

func (s *Server) OnPolicyUpdate(oldPolicy, policy *multiv1beta1.MultiNetworkPolicy)

OnPolicyUpdate Event handler for Policy

func (*Server) Run

func (s *Server) Run(ctx context.Context)

Run starts Server, runs until provided context is done

func (*Server) RunPodConfig

func (s *Server) RunPodConfig(ctx context.Context)

func (*Server) Sync

func (s *Server) Sync()

Sync requests to Run syncRunner

func (*Server) SyncLoop

func (s *Server) SyncLoop(ctx context.Context)

SyncLoop Waits on Server.Initialized then starts Server.syncRunner.Loop() until context is Done

Jump to

Keyboard shortcuts

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