Help us shape the future of Go! Take the 2026 Go Developer Survey

controllers

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0, BSD-3-Clause, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const CMD_UPDATE = "update"
View Source
const IPCHAIN = "POSTROUTING"
View Source
const IPIP_CONFIGURE = "configure"
View Source
const IPIP_NONE = "none"
View Source
const IPIP_SHARED = "shared"
View Source
const IPTAB = "nat"

Variables

View Source
var ENDPOINTS = resources.NewGroupKind("", "Endpoints")
View Source
var SECRET = resources.NewGroupKind("", "Secret")
View Source
var SERVICE = resources.NewGroupKind("", "Service")

Functions

func BaseController

func BaseController(name string, config config.OptionSource) controller.Configuration

func GetEndpoints

func GetEndpoints(logger *utils.Notifier, obj resources.Object) []net.IP

func GetServicePort

func GetServicePort(cntr controller.Interface, name string, kind string, proto corev1.Protocol) (int, error)
func IsLocalLink(klink *api.KubeLink) bool

func ObjectName

func ObjectName(name kubelink.LinkName) resources.ObjectName

func SecretCacheReconciler

func SecretCacheReconciler(config controller.Configuration) controller.Configuration

func String

func String(r netlink.Route) string

Types

type Common

type Common struct {
	reconcile.DefaultReconciler
	// contains filtered or unexported fields
}

func NewCommon

func NewCommon(controller controller.Interface) Common

func (*Common) Controller

func (this *Common) Controller() controller.Interface
func (this *Common) TriggerLink(name kubelink.LinkName)

func (*Common) TriggerUpdate

func (this *Common) TriggerUpdate()

type Config

type Config struct {
	NodeCIDR *net.IPNet
	IPIP     string
	// contains filtered or unexported fields
}

func (*Config) AddOptionsToSet

func (this *Config) AddOptionsToSet(set config.OptionSet)

func (*Config) OptionalCIDR

func (this *Config) OptionalCIDR(s, name string) (net.IP, *net.IPNet, error)

func (*Config) Prepare

func (this *Config) Prepare() error

func (*Config) RequireCIDR

func (this *Config) RequireCIDR(s, name string) (net.IP, *net.IPNet, error)

type EmbeddingFunction

type EmbeddingFunction func() ([]kubelink.RuleDef, utils.StringSet)

type LinkInfo

type LinkInfo struct {
	Gateway net.IP
	State   string
	Message string
}

type LinkTool

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

func NewLinkTool

func NewLinkTool() (*LinkTool, error)

func (*LinkTool) AppendRule

func (this *LinkTool) AppendRule(t string, c string, r iptables.Rule) error

func (*LinkTool) AssureChains

func (this *LinkTool) AssureChains(logger utils.NotificationLogger, header string, chains iptables.Requests, cleanup ...string) error

func (*LinkTool) AssureRule

func (this *LinkTool) AssureRule(logger utils.NotificationLogger, t string, c string, r iptables.Rule, before string) error

func (*LinkTool) ChainRequest

func (this *LinkTool) ChainRequest(logger utils.NotificationLogger, req *iptables.ChainRequest) error

func (*LinkTool) ClearChain

func (this *LinkTool) ClearChain(logger utils.NotificationLogger, t string, c string) error

func (*LinkTool) DeleteChain

func (this *LinkTool) DeleteChain(logger utils.NotificationLogger, t string, c string) error

func (*LinkTool) DeleteRule

func (this *LinkTool) DeleteRule(t string, c string, r iptables.Rule) error

func (*LinkTool) ExistsRule

func (this *LinkTool) ExistsRule(t string, c string, r iptables.Rule) (bool, error)

func (*LinkTool) HandleFirewall

func (this *LinkTool) HandleFirewall(logger logger.LogContext, chains iptables.Requests) error

func (*LinkTool) HandleNat

func (this *LinkTool) HandleNat(logger logger.LogContext, chains iptables.Requests) error

func (*LinkTool) ListChains

func (this *LinkTool) ListChains(t string) ([]string, error)

func (*LinkTool) ManageChains

func (this *LinkTool) ManageChains(logger logger.LogContext, area string, embed EmbeddingFunction, chains iptables.Requests) error

func (*LinkTool) NatRulesAppend

func (this *LinkTool) NatRulesAppend(rule ...string) error

func (*LinkTool) NatRulesDelete

func (this *LinkTool) NatRulesDelete(rule ...string) error

func (*LinkTool) NatRulesExists

func (this *LinkTool) NatRulesExists(rule ...string) (bool, error)
func (this *LinkTool) PrepareLink(logger logger.LogContext, link netlink.Link, clusterAddresses tcp.CIDRList, chains iptables.Requests) (func(), error)

func (*LinkTool) SetLinkAddress

func (this *LinkTool) SetLinkAddress(link netlink.Link, addr *net.IPNet) error

func (*LinkTool) SetNATRule

func (this *LinkTool) SetNATRule(link netlink.Link, clusterAddress *net.IPNet) (func(), error)

func (*LinkTool) UpdateLinkAddresses

func (this *LinkTool) UpdateLinkAddresses(logger logger.LogContext, link netlink.Link, addrs tcp.CIDRList) error

type LocalGatewayInfo

type LocalGatewayInfo struct {
	Gateway   net.IP
	PublicKey string
}

type NotificationHandler

type NotificationHandler interface {
	NotifyChange(name resources.ObjectName, object resources.Object)
}

type Reconciler

type Reconciler struct {
	Common
	// contains filtered or unexported fields
}

func CreateBaseReconciler

func CreateBaseReconciler(controller controller.Interface, impl ReconcilerImplementation, defaultport int) (*Reconciler, error)

func (*Reconciler) Command

func (this *Reconciler) Command(logger logger.LogContext, cmd string) reconcile.Status

func (*Reconciler) Config

func (this *Reconciler) Config() config.OptionSource

func (*Reconciler) Delete

func (this *Reconciler) Delete(logger logger.LogContext, obj resources.Object) reconcile.Status

func (*Reconciler) Deleted

func (*Reconciler) LinkTool

func (this *Reconciler) LinkTool() *LinkTool
func (this *Reconciler) Links() kubelink.Links

func (*Reconciler) NodeInterface

func (this *Reconciler) NodeInterface() *kubelink.NodeInterface

func (*Reconciler) Reconcile

func (this *Reconciler) Reconcile(logger logger.LogContext, obj resources.Object) reconcile.Status
func (this *Reconciler) ReconcileAndGetLink(logger logger.LogContext, obj resources.Object) (*kubelink.Link, reconcile.Status)
func (this *Reconciler) ReconcileLink(logger logger.LogContext, obj resources.Object) reconcile.Status

func (*Reconciler) Setup

func (this *Reconciler) Setup()

func (*Reconciler) SetupIPIP

func (this *Reconciler) SetupIPIP() error

func (*Reconciler) Start

func (this *Reconciler) Start()

func (*Reconciler) WaitIPIP

func (this *Reconciler) WaitIPIP()

func (*Reconciler) WaitNetworkReady

func (this *Reconciler) WaitNetworkReady()

type ReconcilerImplementation

type ReconcilerImplementation interface {
	IsManagedRoute(*netlink.Route, kubelink.Routes) bool
	RequiredRoutes() kubelink.Routes
	RequiredIPTablesChains() iptables.Requests
	BaseConfig(config.OptionSource) *Config

	Gateway(obj *api.KubeLink) (*LocalGatewayInfo, error)
	GetLinkInfo(link *api.KubeLink) *LinkInfo

	HandleReconcile(logger logger.LogContext, obj resources.Object, entry *kubelink.Link) (error, error)
	HandleDelete(logger logger.LogContext, name kubelink.LinkName, obj resources.Object) (bool, error)
}

type SecretCache

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

func GetSharedSecrets

func GetSharedSecrets(controller controller.Interface) *SecretCache

func NewSecretCache

func NewSecretCache(r resources.ResourcesSource) *SecretCache

func (*SecretCache) AddNotificationHandler

func (this *SecretCache) AddNotificationHandler(h NotificationHandler, names ...resources.ObjectName) error

func (*SecretCache) AllocSecret

func (this *SecretCache) AllocSecret(name resources.ObjectName, link resources.ObjectName)

func (*SecretCache) GetSecretUsers

func (this *SecretCache) GetSecretUsers(name resources.ObjectName) resources.ObjectNameSet

func (*SecretCache) Notify

func (this *SecretCache) Notify(name resources.ObjectName, obj resources.Object)

func (*SecretCache) ReleaseSecret

func (this *SecretCache) ReleaseSecret(name resources.ObjectName, link resources.ObjectName)
func (this *SecretCache) ReleaseSecretForLink(link resources.ObjectName)

func (*SecretCache) RemoveNotificationHandler

func (this *SecretCache) RemoveNotificationHandler(h NotificationHandler, names ...resources.ObjectName) error

func (*SecretCache) UpdateSecret

func (this *SecretCache) UpdateSecret(name resources.ObjectName, link resources.ObjectName)

type StatusUpdater

type StatusUpdater func(obj *api.KubeLink, err error) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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