clientcmd

package
v3.9.0-alpha.4+incompa... Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2018 License: Apache-2.0 Imports: 79 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsVersionedObject

func AsVersionedObject(infos []*resource.Info, forceList bool, version schema.GroupVersion, encoder runtime.Encoder) (runtime.Object, error)

AsVersionedObject converts a list of infos into a single object - either a List containing the objects as children, or if only a single Object is present, as that object. The provided version will be preferred as the conversion target, but the Object's mapping version will be used if that version is not present.

func AsVersionedObjects

func AsVersionedObjects(infos []*resource.Info, version schema.GroupVersion, encoder runtime.Encoder) ([]runtime.Object, error)

AsVersionedObjects converts a list of infos into versioned objects. The provided version will be preferred as the conversion target, but the Object's mapping version will be used if that version is not present.

func ConvertExteralPodSpecToInternal

func ConvertExteralPodSpecToInternal(inFn func(*corev1.PodSpec) error) func(*kapi.PodSpec) error

func ConvertInteralPodSpecToExternal

func ConvertInteralPodSpecToExternal(inFn func(*kapi.PodSpec) error) func(*corev1.PodSpec) error

func DefaultGenerators

func DefaultGenerators(cmdName string) map[string]kubectl.Generator

func DiscoverGroupVersionResources

func DiscoverGroupVersionResources(client discovery.ServerResourcesInterface, filterGVR ...schema.GroupVersionResource) ([]schema.GroupVersionResource, bool, error)

DiscoverGroupVersionResources performs a server resource discovery for each filterGVR, returning a slice of GVRs for the matching Resources, and a bool for "all" indicating that each item in filterGVR was found.

func FindAllCanonicalResources

func FindAllCanonicalResources(d discovery.DiscoveryInterface, m meta.RESTMapper) ([]schema.GroupResource, error)

FindAllCanonicalResources returns all resource names that map directly to their kind (Kind -> Resource -> Kind) and are not subresources. This is the closest mapping possible from the client side to resources that can be listed and updated. Note that this may return some virtual resources (like imagestreamtags) that can be otherwise represented. TODO: add a field to APIResources for "virtual" (or that points to the canonical resource). TODO: fallback to the scheme when discovery is not possible.

func GetPrettyErrorFor

func GetPrettyErrorFor(err error) error

GetPrettyErrorFor prettifys the message of the provided error

func GetPrettyErrorForServer

func GetPrettyErrorForServer(err error, serverName string) error

GetPrettyErrorForServer prettifys the message of the provided error

func GetPrettyMessageFor

func GetPrettyMessageFor(err error) string

GetPrettyMessageFor prettifys the message of the provided error

func GetPrettyMessageForServer

func GetPrettyMessageForServer(err error, serverName string) string

GetPrettyMessageForServer prettifys the message of the provided error

func IsCertificateAuthorityUnknown

func IsCertificateAuthorityUnknown(err error) bool

IsCertificateAuthorityUnknown checks whether the provided error is a 'certificate authority unknown' error or not

func IsCertificateHostnameError

func IsCertificateHostnameError(err error) bool

IsCertificateHostnameError checks whether the set of authorized names doesn't match the requested name

func IsCertificateInvalid

func IsCertificateInvalid(err error) bool

IsCertificateInvalid checks whether the certificate is invalid for reasons like expired, CA not authorized to sign, there are too many cert intermediates, or the cert usage is not valid for the wanted purpose.

func IsConfigurationInvalid

func IsConfigurationInvalid(err error) bool

IsConfigurationInvalid checks whether the provided error is a 'invalid configuration' error or not

func IsConfigurationMissing

func IsConfigurationMissing(err error) bool

func IsForbidden

func IsForbidden(err error) bool

IsForbidden checks whether the provided error is a 'forbidden' error or not

func IsNoServerFound

func IsNoServerFound(err error) bool

IsNoServerFound checks whether the provided error is a 'no server found' error or not

func IsTLSOversizedRecord

func IsTLSOversizedRecord(err error) bool

IsTLSOversizedRecord checks whether the provided error is a url.Error with "tls: oversized record received", which usually means TLS not supported.

func LegacyPolicyResourceGate

func LegacyPolicyResourceGate(client discovery.ServerResourcesInterface) error

LegacyPolicyResourceGate returns err if the server does not support the set of legacy policy objects (< 3.7)

func NewObjectMappingFactory

func NewObjectMappingFactory(clientAccessFactory ClientAccessFactory) kcmdutil.ObjectMappingFactory

func ResourceMapper

func ResourceMapper(f kcmdutil.Factory) *resource.Mapper

Types

type CLIClientBuilder

type CLIClientBuilder interface {
	OpenshiftInternalTemplateClient() (templateclientinternal.Interface, error)
	OpenshiftInternalImageClient() (imageclientinternal.Interface, error)
	OpenshiftInternalAppsClient() (appsclientinternal.Interface, error)
	OpenshiftInternalBuildClient() (buildclientinternal.Interface, error)
	OpenshiftInternalAuthorizationClient() (authorizationclientinternal.Interface, error)
	OpenshiftInternalNetworkClient() (networkclientinternal.Interface, error)
	OpenshiftInternalOAuthClient() (oauthclientinternal.Interface, error)
	OpenshiftInternalProjectClient() (projectclientinternal.Interface, error)
	OpenshiftInternalQuotaClient() (quotaclientinternal.Interface, error)
	OpenshiftInternalRouteClient() (routeclientinternal.Interface, error)
	OpenshiftInternalSecurityClient() (securityclientinternal.Interface, error)
	OpenshiftInternalUserClient() (userclientinternal.Interface, error)

	Config() (*rest.Config, error)
}

CLIClientBuilder provides clients for the CLI.

type ClientAccessFactory

type ClientAccessFactory interface {
	kcmdutil.ClientAccessFactory
	CLIClientBuilder

	OpenShiftClientConfig() kclientcmd.ClientConfig
	ImageResolutionOptions() FlagBinder
}

func NewClientAccessFactory

func NewClientAccessFactory(optionalClientConfig kclientcmd.ClientConfig) ClientAccessFactory

type Config

type Config struct {
	// MasterAddr is the address the master can be reached on (host, host:port, or URL).
	MasterAddr flagtypes.Addr
	// KubernetesAddr is the address of the Kubernetes server (host, host:port, or URL).
	// If omitted defaults to the master.
	KubernetesAddr flagtypes.Addr
	// CommonConfig is the shared base config for both the OpenShift config and Kubernetes config
	CommonConfig restclient.Config
	// Namespace is the namespace to act in
	Namespace string

	// If set, allow kubeconfig file loading
	FromFile bool
	// If true, no environment is loaded (for testing, primarily)
	SkipEnv bool
	// contains filtered or unexported fields
}

Config contains all the necessary bits for client configuration

func (*Config) Clients

func (cfg *Config) Clients() (kclientset.Interface, error)

Clients returns an OpenShift and a Kubernetes client from a given configuration

func (*Config) KubeConfig

func (cfg *Config) KubeConfig() *restclient.Config

KubeConfig returns the Kubernetes configuration

func (*Config) OpenShiftConfig

func (cfg *Config) OpenShiftConfig() *restclient.Config

OpenShiftConfig returns the OpenShift configuration

type Factory

Factory provides common options for OpenShift commands

func New

func New(flags *pflag.FlagSet) *Factory

New creates a default Factory for commands that should share identical server connection behavior. Most commands should use this method to get a factory.

func NewFactory

func NewFactory(optionalClientConfig kclientcmd.ClientConfig) *Factory

NewFactory creates an object that holds common methods across all OpenShift commands

func (*Factory) ApproximatePodTemplateForObject

func (f *Factory) ApproximatePodTemplateForObject(object runtime.Object) (*api.PodTemplateSpec, error)

ApproximatePodTemplateForObject returns a pod template object for the provided source. It may return both an error and a object. It attempt to return the best possible template available at the current time.

func (*Factory) ExtractFileContents

func (f *Factory) ExtractFileContents(obj runtime.Object) (map[string][]byte, bool, error)

ExtractFileContents returns a map of keys to contents, false if the object cannot support such an operation, or an error.

func (*Factory) PodForResource

func (f *Factory) PodForResource(resource string, timeout time.Duration) (string, error)

func (*Factory) PrintResourceInfos

func (f *Factory) PrintResourceInfos(cmd *cobra.Command, isLocal bool, infos []*resource.Info, out io.Writer) error

PrintResourceInfos receives a list of resource infos and prints versioned objects if a generic output format was specified otherwise, it iterates through info objects, printing each resource with a unique printer for its mapping

func (*Factory) UpdateObjectEnvironment

func (f *Factory) UpdateObjectEnvironment(obj runtime.Object, fn func(*[]api.EnvVar) error) (bool, error)

UpdateObjectEnvironment update the environment variables in object specification.

type FlagBinder

type FlagBinder interface {
	// Bound returns true if the flag is already bound to a command.
	Bound() bool
	// Bind allows to bind an extra flag to a command
	Bind(*pflag.FlagSet)
}

FlagBinder represents an interface that allows to bind extra flags into commands.

type OpenshiftCLIClientBuilder

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

OpenshiftCLIClientBuilder implements the CLIClientBuilder.

func (*OpenshiftCLIClientBuilder) Config

func (b *OpenshiftCLIClientBuilder) Config() (*rest.Config, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalAppsClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalAppsClient() (appsclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalAuthorizationClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalAuthorizationClient() (authorizationclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalBuildClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalBuildClient() (buildclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalImageClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalImageClient() (imageclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalNetworkClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalNetworkClient() (networkclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalOAuthClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalOAuthClient() (oauthclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalProjectClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalProjectClient() (projectclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalQuotaClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalQuotaClient() (quotaclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalRouteClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalRouteClient() (routeclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalSecurityClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalSecurityClient() (securityclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalTemplateClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalTemplateClient() (templateclientinternal.Interface, error)

func (*OpenshiftCLIClientBuilder) OpenshiftInternalUserClient

func (b *OpenshiftCLIClientBuilder) OpenshiftInternalUserClient() (userclientinternal.Interface, error)

Jump to

Keyboard shortcuts

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