cli

package
v0.0.0-...-edf464d Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FlagKubeConfig       = "kubeconfig"
	FlagContext          = "context"
	FlagImpersonate      = "as"
	FlagImpersonateUID   = "as-uid"
	FlagImpersonateGroup = "as-group"
	FlagNamespace        = "namespace"
	FlagIstioNamespace   = "istioNamespace"
)

Variables

View Source
var MakeKubeFactory = func(k kube.CLIClient) util.Factory {
	kf := k.UtilFactory()
	return Factory{
		PartialFactory: kf,
		full:           util.NewFactory(kf),
	}
}

MakeKubeFactory turns a partial kubetl factory from CLIClient into a full util.Factory This is done under istioctl/ to avoid excessive binary bloat in other packages; this pulls in around 10mb of dependencies.

Functions

This section is empty.

Types

type Context

type Context interface {
	// CLIClient returns a client for the default revision
	CLIClient() (kube.CLIClient, error)
	// CLIClientWithRevision returns a client for the given revision
	CLIClientWithRevision(rev string) (kube.CLIClient, error)
	// InferPodInfoFromTypedResource returns the pod name and namespace for the given typed resource
	InferPodInfoFromTypedResource(name, namespace string) (pod string, ns string, err error)
	// InferPodsFromTypedResource returns the pod names and namespace for the given typed resource
	InferPodsFromTypedResource(name, namespace string) ([]string, string, error)
	// Namespace returns the namespace specified by the user
	Namespace() string
	// IstioNamespace returns the Istio namespace specified by the user
	IstioNamespace() string
	// NamespaceOrDefault returns the namespace specified by the user, or the default namespace if none was specified
	NamespaceOrDefault(namespace string) string
	// CLIClientsForContexts returns clients for all the given contexts in a kubeconfig.
	CLIClientsForContexts(contexts []string) ([]kube.CLIClient, error)
}

func NewCLIContext

func NewCLIContext(rootFlags *RootFlags) Context

func NewFakeContext

func NewFakeContext(opts *NewFakeContextOption) Context

type Factory

type Factory struct {
	kube.PartialFactory
	// contains filtered or unexported fields
}

func (Factory) ClientForMapping

func (f Factory) ClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error)

func (Factory) NewBuilder

func (f Factory) NewBuilder() *resource.Builder

func (Factory) OpenAPISchema

func (f Factory) OpenAPISchema() (openapi.Resources, error)

func (Factory) OpenAPIV3Client

func (f Factory) OpenAPIV3Client() (openapiclient.Client, error)

func (Factory) UnstructuredClientForMapping

func (f Factory) UnstructuredClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error)

func (Factory) Validator

func (f Factory) Validator(validationDirective string) (validation.Schema, error)

type MockClient

type MockClient struct {
	// Results is a map of podName to the results of the expected test on the pod
	Results map[string][]byte
	kube.CLIClient
}

func (MockClient) AllDiscoveryDo

func (c MockClient) AllDiscoveryDo(_ context.Context, _, _ string) (map[string][]byte, error)

func (MockClient) CreatePerRPCCredentials

func (c MockClient) CreatePerRPCCredentials(_ context.Context, _, _ string, _ []string, _ int64,
) (credentials.PerRPCCredentials, error)

func (MockClient) EnvoyDo

func (c MockClient) EnvoyDo(ctx context.Context, podName, podNamespace, method, path string) ([]byte, error)

func (MockClient) EnvoyDoWithPort

func (c MockClient) EnvoyDoWithPort(ctx context.Context, podName, podNamespace, method, path string, port int) ([]byte, error)

func (MockClient) NewPortForwarder

func (c MockClient) NewPortForwarder(_, _, _ string, _, _ int) (kube.PortForwarder, error)

type MockPortForwarder

type MockPortForwarder struct{}

func (MockPortForwarder) Address

func (m MockPortForwarder) Address() string

func (MockPortForwarder) Close

func (m MockPortForwarder) Close()

func (MockPortForwarder) ErrChan

func (m MockPortForwarder) ErrChan() <-chan error

func (MockPortForwarder) Start

func (m MockPortForwarder) Start() error

func (MockPortForwarder) WaitForStop

func (m MockPortForwarder) WaitForStop()

type NewFakeContextOption

type NewFakeContextOption struct {
	Namespace      string
	IstioNamespace string
	Results        map[string][]byte
	// Objects are the objects to be applied to the fake client
	Objects []runtime.Object
	// Version is the version of the fake client
	Version string
}

type RootFlags

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

func AddRootFlags

func AddRootFlags(flags *pflag.FlagSet) *RootFlags

func (*RootFlags) DefaultNamespace

func (r *RootFlags) DefaultNamespace() string

DefaultNamespace returns the default namespace to use.

func (*RootFlags) IstioNamespace

func (r *RootFlags) IstioNamespace() string

IstioNamespace returns the istioNamespace flag value.

func (*RootFlags) Namespace

func (r *RootFlags) Namespace() string

Namespace returns the namespace flag value.

Jump to

Keyboard shortcuts

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