services

package
v1.22.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 29 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "services",
	Aliases: []string{"svcs", "svc"},
	Short:   "Forward services",
	Long:    `Forward multiple Kubernetes services from one or more namespaces. Filter services with selector.`,
	Example: "  kubefwd svc -n the-project\n" +
		"  kubefwd svc -n the-project -l app=wx,component=api\n" +
		"  kubefwd svc -n default -l \"app in (ws, api)\"\n" +
		"  kubefwd svc -n default -n the-project\n" +
		"  kubefwd svc -n default -d internal.example.com\n" +
		"  kubefwd svc -n the-project -x prod-cluster\n" +
		"  kubefwd svc -n the-project -m 80:8080 -m 443:1443\n" +
		"  kubefwd svc -n the-project -z path/to/conf.yml\n" +
		"  kubefwd svc -n the-project -r svc.ns:127.3.3.1\n" +
		"  kubefwd svc --all-namespaces",
	Run: runCmd,
}

Functions

This section is empty.

Types

type NamespaceOpts added in v1.17.3

type NamespaceOpts struct {
	NamespaceIPLock *sync.Mutex
	ListOptions     metav1.ListOptions
	HostFile        *fwdport.HostFileWithLock

	ClientSet    kubernetes.Clientset
	ClientConfig restclient.Config
	RESTClient   restclient.RESTClient

	// Context is a unique key (string) in kubectl config representing
	// a user/cluster combination. Kubefwd uses context as the
	// cluster name when forwarding to more than one cluster.
	Context string

	// Namespace is the current Kubernetes Namespace to locate services
	// and the pods that back them for port-forwarding
	Namespace string

	// ClusterN is the ordinal index of the cluster (from configuration)
	// cluster 0 is considered local while > 0 is remote
	ClusterN int

	// NamespaceN is the ordinal index of the namespace from the
	// perspective of the user. Namespace 0 is considered local
	// while > 0 is an external namespace
	NamespaceN int

	// Domain is specified by the user and used in place of .local
	Domain string
	// meaning any source port maps to target port.
	PortMapping []string

	ManualStopChannel chan struct{}
}

func (*NamespaceOpts) AddServiceHandler added in v1.17.3

func (opts *NamespaceOpts) AddServiceHandler(obj interface{})

AddServiceHandler is the event handler for when a new service comes in from k8s (the initial list of services will also be coming in using this event for each).

func (*NamespaceOpts) DeleteServiceHandler added in v1.17.3

func (opts *NamespaceOpts) DeleteServiceHandler(obj interface{})

DeleteServiceHandler is the event handler for when a service gets deleted in k8s.

func (*NamespaceOpts) ParsePortMap added in v1.18.1

func (opts *NamespaceOpts) ParsePortMap(mappings []string) *[]fwdservice.PortMap

ParsePortMap parse string port to PortMap

func (*NamespaceOpts) UpdateServiceHandler added in v1.17.3

func (opts *NamespaceOpts) UpdateServiceHandler(_ interface{}, new interface{})

UpdateServiceHandler is the event handler to deal with service changes from k8s. It currently does not do anything.

Jump to

Keyboard shortcuts

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