Documentation
¶
Index ¶
Constants ¶
const DefaultStatusFlushInterval = 30 * time.Second
DefaultStatusFlushInterval is the flush cadence used by the daemon.
Variables ¶
This section is empty.
Functions ¶
func NewPodWatcher ¶
func NewPodWatcher(client kubernetes.Interface, nodeName string, eventHandlers []events.PodEventHandler, nsHandlers []events.NamespaceEventHandler) *podWatcher
Types ¶
type RuntimePolicyMgr ¶
type RuntimePolicyMgr struct {
// contains filtered or unexported fields
}
func NewRuntimePolicyMgr ¶
func NewRuntimePolicyMgr(cfg *rest.Config, eventHandlers []events.RuntimePolicyEventHandler, client v1alpha1client.Interface, rpCompiler compiler.Compiler, resolver ServiceChangeNotifier, status runtimeevent.PolicyStatusRecorder) (*RuntimePolicyMgr, error)
func (*RuntimePolicyMgr) HasSynced ¶
func (m *RuntimePolicyMgr) HasSynced() bool
expose HasSynced so we can wait till sync is complete from main before starting the pod sync
type ServiceChangeNotifier ¶
type ServiceChangeNotifier interface {
AddChangeHandler(h func(namespace, name string))
}
ServiceChangeNotifier reports that the addresses behind a Service may have changed. It is satisfied by *services.Resolver.
type StatusWriter ¶
type StatusWriter struct {
// contains filtered or unexported fields
}
StatusWriter turns the RuntimePolicy event stream into this node's shard of each policy's status. Every daemon in the DaemonSet writes the same cluster-scoped object, so a node only ever replaces its own entry in status.nodes.
func NewStatusWriter ¶
func NewStatusWriter(client v1alpha1client.Interface, nodeName string, interval time.Duration, log logr.Logger, nodeGone func(name string) bool, onConditionChanged func(policyUID, policyName string, cond metav1.Condition)) *StatusWriter
NewStatusWriter builds a StatusWriter for this node. A non-positive interval falls back to DefaultStatusFlushInterval. A nil onConditionChanged disables the change callback.
func (*StatusWriter) Flush ¶
func (s *StatusWriter) Flush(ctx context.Context) error
Flush writes every dirty policy's shard. It is exported so the daemon (and tests) can force a write without waiting for the interval.
func (*StatusWriter) RecordCondition ¶
func (s *StatusWriter) RecordCondition(policyUID, policyName string, cond metav1.Condition)
RecordCondition stores a condition to be merged into the policy's status on the next flush. Re-recording an identical condition is a no-op so a manager that reports the same condition on every event does not cause API churn.
func (*StatusWriter) Run ¶
func (s *StatusWriter) Run(ctx context.Context) error
Run flushes dirty policy statuses every interval, and once more when ctx is cancelled so the last observation is not lost on shutdown.
func (*StatusWriter) RuntimePolicyEvent ¶
func (s *StatusWriter) RuntimePolicyEvent(res *compiler.EvaluationResult, eventType string) error
RuntimePolicyEvent caches the policy's identity and mode.