iptables

package
v0.0.0-...-606a1df Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesFromRules

func BytesFromRules(rules map[string]*RuleSet) []byte

BytesFromRules turns a map of RuleSet pointers into a slic eof bytes

func GetSaveLines

func GetSaveLines(table util.Table, save []byte) (map[string]*RuleSet, error)

GetSaveLines parses the iptables-save as a string and puts it into a map[string]*kubeRules Modifications were made from the Kube codebase to support iptables save/restore

func NewMetrics

func NewMetrics(lbKind, configKey string) *metrics

NewMetrics creates a new metrics struct tha tholds metrics for iptables

func ReadLine

func ReadLine(readIndex int, byteArray []byte) (string, int)

ReadLine reads a bunch of networking rules from a byte array

Types

type IPTables

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

IPTables defines what a manager of IPTables should look like

func NewIPTables

func NewIPTables(ctx context.Context, lbKind, configKey, podCidrMasq, chain string, masq bool, logger log.FieldLogger) (*IPTables, error)

NewIPTables creates a new IPTables struct for managing IPTables

func (*IPTables) BaseChain

func (i *IPTables) BaseChain() string

func (*IPTables) Flush

func (i *IPTables) Flush() error

func (*IPTables) GenerateRules

func (i *IPTables) GenerateRules(config *types.ClusterConfig) (map[string]*RuleSet, error)

GenerateRules generates a ruleset for only kube-ipvs. a different function ought to merge these XXX chain rule. This os only used by realserver package stuff seemingly.

func (*IPTables) GenerateRulesForNodeClassic

func (i *IPTables) GenerateRulesForNodeClassic(w *watcher.Watcher, nodeName string, config *types.ClusterConfig, useWeightedService bool) (map[string]*RuleSet, error)

GenerateRulesForNodeClassic attempts to restore the original functionality of rule generation prior to versioned Ravel releases

func (*IPTables) Merge

func (i *IPTables) Merge(subset map[string]*RuleSet, wholeset map[string]*RuleSet) (map[string]*RuleSet, int, error)

func (*IPTables) Restore

func (i *IPTables) Restore(rules map[string]*RuleSet) error

func (*IPTables) Save

func (i *IPTables) Save() (map[string]*RuleSet, error)

type RuleSet

type RuleSet struct {
	ChainRule string   //    :KUBE-SVC-ZEHG7HT725H2KQF7 - [0:0]
	Rules     []string // -A PREROUTING -m comment --comment "kubernetes service portals" -j KUBE-SERVICES
}

RuleSet contains a bunch of rule chains for ipvsadm (iptables)

Jump to

Keyboard shortcuts

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