services

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Copyright 2018 Craig Johnston <cjimti@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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 --all-namespaces",
	Run: runCmd,
}

Functions

This section is empty.

Types

type NamespaceOpts

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{}
}

NamespaceOpts

func (*NamespaceOpts) AddServiceHandler

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

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

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

func (*NamespaceOpts) ParsePortMap

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

ParsePortMap parse string port to PortMap

func (*NamespaceOpts) UpdateServiceHandler

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