Documentation ¶
Index ¶
- Constants
- func AnonymousClientConfig(config *restclient.Config) restclient.Config
- func BindClientConfigSecurityFlags(config *restclient.Config, flags *pflag.FlagSet)
- func DefaultClientConfig(flags *pflag.FlagSet) kclientcmd.ClientConfig
- func DefaultGenerators(cmdName string) map[string]kubectl.Generator
- func EnvVars(host string, caData []byte, insecure bool, bearerTokenFile string) []api.EnvVar
- func FindAllCanonicalResources(d discovery.DiscoveryInterface, m meta.RESTMapper) ([]schema.GroupResource, error)
- func GetPrettyErrorFor(err error) error
- func GetPrettyErrorForServer(err error, serverName string) error
- func GetPrettyMessageFor(err error) string
- func GetPrettyMessageForServer(err error, serverName string) string
- func IsCertificateAuthorityUnknown(err error) bool
- func IsCertificateHostnameError(err error) bool
- func IsCertificateInvalid(err error) bool
- func IsConfigurationInvalid(err error) bool
- func IsConfigurationMissing(err error) bool
- func IsForbidden(err error) bool
- func IsNoServerFound(err error) bool
- func IsTLSOversizedRecord(err error) bool
- func NewObjectMappingFactory(clientAccessFactory ClientAccessFactory) kcmdutil.ObjectMappingFactory
- func ResourceMapper(f kcmdutil.Factory) *resource.Mapper
- type ClientAccessFactory
- type Config
- type Factory
- func (f *Factory) ApproximatePodTemplateForObject(object runtime.Object) (*api.PodTemplateSpec, error)
- func (f *Factory) ExtractFileContents(obj runtime.Object) (map[string][]byte, bool, error)
- func (f *Factory) PodForResource(resource string, timeout time.Duration) (string, error)
- func (f *Factory) PrintResourceInfos(cmd *cobra.Command, infos []*resource.Info, out io.Writer) error
- func (f *Factory) UpdateObjectEnvironment(obj runtime.Object, fn func(*[]api.EnvVar) error) (bool, error)
- type FlagBinder
- type ShortcutExpander
- func (e ShortcutExpander) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error)
- func (e ShortcutExpander) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
- func (e ShortcutExpander) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)
- func (e ShortcutExpander) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error)
- func (e ShortcutExpander) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error)
- func (e ShortcutExpander) ResourceSingularizer(resource string) (string, error)
- func (e ShortcutExpander) ResourcesFor(resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error)
Constants ¶
const ConfigSyntax = " --master=<addr>"
Variables ¶
This section is empty.
Functions ¶
func AnonymousClientConfig ¶ added in v1.0.7
func AnonymousClientConfig(config *restclient.Config) restclient.Config
AnonymousClientConfig returns a copy of the given config with all user credentials (cert/key, bearer token, and username/password) removed
func BindClientConfigSecurityFlags ¶
func BindClientConfigSecurityFlags(config *restclient.Config, flags *pflag.FlagSet)
BindClientConfigSecurityFlags adds flags for the supplied client config
func DefaultClientConfig ¶
func DefaultClientConfig(flags *pflag.FlagSet) kclientcmd.ClientConfig
func DefaultGenerators ¶ added in v1.1.3
func FindAllCanonicalResources ¶ added in v1.3.0
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 ¶ added in v1.3.0
GetPrettyErrorFor prettifys the message of the provided error
func GetPrettyErrorForServer ¶ added in v1.3.0
GetPrettyErrorForServer prettifys the message of the provided error
func GetPrettyMessageFor ¶
GetPrettyMessageFor prettifys the message of the provided error
func GetPrettyMessageForServer ¶ added in v1.3.0
GetPrettyMessageForServer prettifys the message of the provided error
func IsCertificateAuthorityUnknown ¶
IsCertificateAuthorityUnknown checks whether the provided error is a 'certificate authority unknown' error or not
func IsCertificateHostnameError ¶ added in v1.3.1
IsCertificateHostnameError checks whether the set of authorized names doesn't match the requested name
func IsCertificateInvalid ¶ added in v1.3.1
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 ¶
IsConfigurationInvalid checks whether the provided error is a 'invalid configuration' error or not
func IsConfigurationMissing ¶ added in v1.3.0
func IsForbidden ¶
IsForbidden checks whether the provided error is a 'forbidden' error or not
func IsNoServerFound ¶
IsNoServerFound checks whether the provided error is a 'no server found' error or not
func IsTLSOversizedRecord ¶ added in v1.3.0
IsTLSOversizedRecord checks whether the provided error is a url.Error with "tls: oversized record received", which usually means TLS not supported.
func NewObjectMappingFactory ¶ added in v1.5.0
func NewObjectMappingFactory(clientAccessFactory ClientAccessFactory) kcmdutil.ObjectMappingFactory
Types ¶
type ClientAccessFactory ¶ added in v1.5.0
type ClientAccessFactory interface { kcmdutil.ClientAccessFactory Clients() (*client.Client, kclientset.Interface, error) OpenShiftClientConfig() kclientcmd.ClientConfig ImageResolutionOptions() FlagBinder }
func NewClientAccessFactory ¶ added in v1.5.0
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) BindToFile ¶ added in v1.1.4
BindToFile is used when this config will not be bound to flags, but should load the config file from disk if available.
func (*Config) Clients ¶
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 ¶
type Factory struct { ClientAccessFactory kcmdutil.ObjectMappingFactory kcmdutil.BuilderFactory }
Factory provides common options for OpenShift commands
func New ¶
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 ¶ added in v1.1.4
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 ¶ added in v1.3.0
ExtractFileContents returns a map of keys to contents, false if the object cannot support such an operation, or an error.
func (*Factory) PodForResource ¶ added in v1.3.0
func (*Factory) PrintResourceInfos ¶ added in v1.4.0
func (f *Factory) PrintResourceInfos(cmd *cobra.Command, 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
type FlagBinder ¶ added in v1.4.0
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 ShortcutExpander ¶
type ShortcutExpander struct {
RESTMapper meta.RESTMapper
}
ShortcutExpander is a RESTMapper that can be used for OpenShift resources. It expands the resource first, then invokes the wrapped
func NewShortcutExpander ¶ added in v1.1.4
func NewShortcutExpander(discoveryClient discovery.DiscoveryInterface, delegate meta.RESTMapper) ShortcutExpander
func (ShortcutExpander) KindFor ¶ added in v1.1.2
func (e ShortcutExpander) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error)
func (ShortcutExpander) KindsFor ¶ added in v1.1.3
func (e ShortcutExpander) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
func (ShortcutExpander) RESTMapping ¶ added in v1.1.3
func (e ShortcutExpander) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)
func (ShortcutExpander) RESTMappings ¶ added in v1.3.0
func (e ShortcutExpander) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error)
func (ShortcutExpander) ResourceFor ¶ added in v1.1.3
func (e ShortcutExpander) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error)
func (ShortcutExpander) ResourceSingularizer ¶ added in v1.1.3
func (e ShortcutExpander) ResourceSingularizer(resource string) (string, error)
func (ShortcutExpander) ResourcesFor ¶ added in v1.1.3
func (e ShortcutExpander) ResourcesFor(resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error)