handler

package
v2.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 90 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupUselessInfo

func CleanupUselessInfo(pod *v1.Pod)

func Complete added in v2.2.2

func Complete(ctx context.Context, route *core.Route) error

func CreateAfterDeletePod

func CreateAfterDeletePod(factory cmdutil.Factory, p *v1.Pod, helper *pkgresource.Helper) error

func InjectVPNAndEnvoySidecar

func InjectVPNAndEnvoySidecar(ctx1 context.Context, factory cmdutil.Factory, clientset v12.ConfigMapInterface, namespace, workload string, c util.PodRouteConfig, headers map[string]string, portMaps []string) (err error)

InjectVPNAndEnvoySidecar patch a sidecar, using iptables to do port-forward let this pod decide should go to 233.254.254.100 or request to 127.0.0.1

func InjectVPNSidecar

func InjectVPNSidecar(ctx1 context.Context, factory cmdutil.Factory, namespace, workload string, c util.PodRouteConfig) error

func Parse

func Parse(r core.Route) ([]core.Server, error)

func RemoveUselessInfo

func RemoveUselessInfo(u *unstructured.Unstructured)

func Run

func Run(ctx context.Context, servers []core.Server) error

func UnPatchContainer

func UnPatchContainer(factory cmdutil.Factory, mapInterface v12.ConfigMapInterface, namespace, workload string, localTunIPv4 string) error

Types

type CloneOptions

type CloneOptions struct {
	Namespace      string
	Headers        map[string]string
	Workloads      []string
	ExtraRouteInfo ExtraRouteInfo
	Engine         config.Engine

	TargetKubeconfig       string
	TargetNamespace        string
	TargetContainer        string
	TargetImage            string
	TargetRegistry         string
	IsChangeTargetRegistry bool
	// contains filtered or unexported fields
}

func (*CloneOptions) Cleanup

func (d *CloneOptions) Cleanup(workloads ...string) error

func (*CloneOptions) DoClone

func (d *CloneOptions) DoClone(ctx context.Context) error

DoClone

* 1) download mount path use empty-dir but skip empty-dir in init-containers * 2) get env from containers * 3) create serviceAccount as needed * 4) modify podTempSpec inject kubevpn container

func (*CloneOptions) InitClient

func (d *CloneOptions) InitClient(f cmdutil.Factory) (err error)

type ConnectOptions

type ConnectOptions struct {
	Namespace            string
	Headers              map[string]string
	PortMap              []string
	Workloads            []string
	ExtraRouteInfo       ExtraRouteInfo
	Engine               config.Engine
	Foreground           bool
	OriginKubeconfigPath string
	Lock                 *sync.Mutex
	// contains filtered or unexported fields
}

func (*ConnectOptions) AddRolloutFunc

func (c *ConnectOptions) AddRolloutFunc(f func() error)

func (*ConnectOptions) Cleanup

func (c *ConnectOptions) Cleanup()

func (*ConnectOptions) CleanupLocalContainer

func (c *ConnectOptions) CleanupLocalContainer(ctx context.Context) error

func (*ConnectOptions) Context

func (c *ConnectOptions) Context() context.Context

func (*ConnectOptions) CreateRemoteInboundPod

func (c *ConnectOptions) CreateRemoteInboundPod(ctx context.Context) (err error)

func (*ConnectOptions) DoConnect

func (c *ConnectOptions) DoConnect(ctx context.Context, isLite bool) (err error)

func (*ConnectOptions) Equal

func (c *ConnectOptions) Equal(a *ConnectOptions) bool

func (*ConnectOptions) GetClientset

func (c *ConnectOptions) GetClientset() *kubernetes.Clientset

func (*ConnectOptions) GetFactory

func (c *ConnectOptions) GetFactory() cmdutil.Factory

func (*ConnectOptions) GetLocalTunIPv4

func (c *ConnectOptions) GetLocalTunIPv4() string

func (*ConnectOptions) GetRunningPodList

func (c *ConnectOptions) GetRunningPodList(ctx context.Context) ([]v1.Pod, error)

func (*ConnectOptions) GetTunDeviceName

func (c *ConnectOptions) GetTunDeviceName() (string, error)

func (*ConnectOptions) InitClient

func (c *ConnectOptions) InitClient(f cmdutil.Factory) (err error)

func (*ConnectOptions) InitDHCP

func (c *ConnectOptions) InitDHCP(ctx context.Context) error

func (*ConnectOptions) LeaveProxyResources

func (c *ConnectOptions) LeaveProxyResources(ctx context.Context) (err error)

func (*ConnectOptions) PreCheckResource

func (c *ConnectOptions) PreCheckResource() error

PreCheckResource transform user parameter to normal, example: pod: productpage-7667dfcddb-cbsn5 replicast: productpage-7667dfcddb deployment: productpage transform: pod/productpage-7667dfcddb-cbsn5 --> deployment/productpage service/productpage --> deployment/productpage replicaset/productpage-7667dfcddb --> deployment/productpage

pods without controller pod/productpage-without-controller --> pod/productpage-without-controller service/productpage-without-pod --> controller/controllerName

func (*ConnectOptions) RentInnerIP

func (c *ConnectOptions) RentInnerIP(ctx context.Context) (context.Context, error)

func (*ConnectOptions) Reset

func (c *ConnectOptions) Reset(ctx context.Context) error

Reset 1) quit daemon 2) get all proxy-resources from configmap 3) cleanup all containers 4) cleanup hosts

type Connects added in v2.2.3

type Connects []*ConnectOptions

func (Connects) Append added in v2.2.3

func (s Connects) Append(options *ConnectOptions) Connects

func (Connects) Len added in v2.2.3

func (s Connects) Len() int

func (Connects) Less added in v2.2.3

func (s Connects) Less(i, j int) bool

Less ... * assume: clusterA and clusterB in same VPC network, but only clusterA api-server have public ip, we need access clusterB via clusterA network. steps:

  • connect to clusterA with options --extra-cidr or --extra-domain (which container clusterB api-server address)
  • connect to clusterB

when we disconnect from all: first, we need to disconnect clusterB second, disconnect clusterA

func (Connects) Sort added in v2.2.3

func (s Connects) Sort() Connects

Sort ... base order: first connect last disconnect sort by dependency

func (Connects) Swap added in v2.2.3

func (s Connects) Swap(i, j int)

type DHCPManager

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

func NewDHCPManager

func NewDHCPManager(client corev1.ConfigMapInterface, namespace string) *DHCPManager

func (*DHCPManager) ForEach

func (d *DHCPManager) ForEach(fn func(net.IP)) error

func (*DHCPManager) Get

func (d *DHCPManager) Get(ctx2 context.Context, key string) (string, error)

func (*DHCPManager) ReleaseIP

func (d *DHCPManager) ReleaseIP(ctx context.Context, ips ...net.IP) error

func (*DHCPManager) RentIPBaseNICAddress

func (d *DHCPManager) RentIPBaseNICAddress(ctx context.Context) (*net.IPNet, *net.IPNet, error)

func (*DHCPManager) RentIPRandom

func (d *DHCPManager) RentIPRandom(ctx context.Context) (*net.IPNet, *net.IPNet, error)

func (*DHCPManager) Set

func (d *DHCPManager) Set(key, value string) error

type ExtraRouteInfo added in v2.2.3

type ExtraRouteInfo struct {
	ExtraCIDR   []string
	ExtraDomain []string
	ExtraNodeIP bool
}

func ParseExtraRouteFromRPC added in v2.2.3

func ParseExtraRouteFromRPC(route *rpc.ExtraRoute) *ExtraRouteInfo

func (ExtraRouteInfo) ToRPC added in v2.2.3

func (e ExtraRouteInfo) ToRPC() *rpc.ExtraRoute

type P

type P struct {
	Op    string      `json:"op,omitempty"`
	Path  string      `json:"path,omitempty"`
	Value interface{} `json:"value,omitempty"`
}

Jump to

Keyboard shortcuts

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