kubernetes: github.com/ashcrow/kubernetes/pkg/client/unversioned Index | Files | Directories

package unversioned

import "github.com/ashcrow/kubernetes/pkg/client/unversioned"

Package client contains the implementation of the client side communication with the Kubernetes master. The Client class provides methods for reading, creating, updating, and deleting pods, replication controllers, daemons, services, and minions.

Most consumers should use the Config object to create a Client:

import (
  "k8s.io/kubernetes/pkg/client"
  "k8s.io/kubernetes/pkg/api"
  "k8s.io/kubernetes/pkg/fields"
  "k8s.io/kubernetes/pkg/labels"
)

[...]

config := &client.Config{
  Host:     "http://localhost:8080",
  Username: "test",
  Password: "password",
}
client, err := client.New(config)
if err != nil {
  // handle error
}
pods, err := client.Pods(api.NamespaceDefault).List(labels.Everything(), fields.Everything())
if err != nil {
  // handle error
}

More advanced consumers may wish to provide their own transport via a http.RoundTripper:

config := &client.Config{
  Host:      "https://localhost:8080",
  Transport: oauthclient.Transport(),
}
client, err := client.New(config)

The RESTClient type implements the Kubernetes API conventions (see `docs/api-conventions.md`) for a given API path and is intended for use by consumers implementing their own Kubernetes compatible APIs.

Index

Package Files

client.go componentstatuses.go conditions.go containerinfo.go daemon.go debugging.go doc.go endpoints.go events.go experimental.go fake.go flags.go helper.go horizontalpodautoscaler.go kubelet.go limit_ranges.go namespaces.go nodes.go persistentvolumeclaim.go persistentvolumes.go pod_templates.go pods.go replication_controllers.go request.go resource_quotas.go restclient.go scale.go secrets.go service_accounts.go services.go transport.go

Constants

const (
    JustURL         string = "url"
    URLTiming       string = "urltiming"
    CurlCommand     string = "curlcommand"
    RequestHeaders  string = "requestheaders"
    ResponseStatus  string = "responsestatus"
    ResponseHeaders string = "responseheaders"
)
const (
    // A constant that clients can use to refer in a field selector to the object name field.
    // Will be automatically emitted as the correct name for the API version.
    NodeUnschedulable = "spec.unschedulable"
    ObjectNameField   = "metadata.name"
    PodHost           = "spec.nodeName"
    PodStatus         = "status.phase"
    SecretType        = "type"

    EventReason                  = "reason"
    EventSource                  = "source"
    EventInvolvedKind            = "involvedObject.kind"
    EventInvolvedNamespace       = "involvedObject.namespace"
    EventInvolvedName            = "involvedObject.name"
    EventInvolvedUID             = "involvedObject.uid"
    EventInvolvedAPIVersion      = "involvedObject.apiVersion"
    EventInvolvedResourceVersion = "involvedObject.resourceVersion"
    EventInvolvedFieldPath       = "involvedObject.fieldPath"
)

func ControllerHasDesiredReplicas Uses

func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationController) wait.ConditionFunc

ControllerHasDesiredReplicas returns a condition that will be true iff the desired replica count for a controller's ReplicaSelector equals the Replicas count.

func DefaultKubernetesUserAgent Uses

func DefaultKubernetesUserAgent() string

DefaultKubernetesUserAgent returns the default user agent that clients can use.

func DefaultServerURL Uses

func DefaultServerURL(host, prefix, version string, defaultTLS bool) (*url.URL, error)

DefaultServerURL converts a host, host:port, or URL string to the default base server API path to use with a Client at a given API version following the standard conventions for a Kubernetes API.

func HTTPWrappersForConfig Uses

func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error)

HTTPWrappersForConfig wraps a round tripper with any relevant layered behavior from the config. Exposed to allow more clients that need HTTP-like behavior but then must hijack the underlying connection (like WebSocket or HTTP2 clients). Pure HTTP clients should use the higher level TransportFor or RESTClientFor methods.

func IsConfigTransportTLS Uses

func IsConfigTransportTLS(config Config) bool

IsConfigTransportTLS returns true iff the provided config will result in a protected connection to the server when it is passed to client.New() or client.RESTClientFor(). Use to determine when to send credentials over the wire.

Note: the Insecure flag is ignored when testing for this value, so MITM attacks are still possible.

func IsTimeout Uses

func IsTimeout(err error) bool

IsTimeout tests if this is a timeout error in the underlying transport. This is unbelievably ugly. See: http://stackoverflow.com/questions/23494950/specifically-check-for-timeout-error for details

func LoadTLSFiles Uses

func LoadTLSFiles(config *Config) error

LoadTLSFiles copies the data from the CertFile, KeyFile, and CAFile fields into the CertData, KeyData, and CAFile fields, or returns an error. If no error is returned, all three fields are either populated or were empty to start.

func MakeTransport Uses

func MakeTransport(config *KubeletConfig) (http.RoundTripper, error)

func MatchesServerVersion Uses

func MatchesServerVersion(client *Client, c *Config) error

MatchesServerVersion queries the server to compares the build version (git hash) of the client with the server's build version. It returns an error if it failed to contact the server or if the versions are not an exact match.

func NegotiateVersion Uses

func NegotiateVersion(client *Client, c *Config, version string, clientRegisteredVersions []string) (string, error)

NegotiateVersion queries the server's supported api versions to find a version that both client and server support. - If no version is provided, try registered client versions in order of

preference.

- If version is provided, but not default config (explicitly requested via

commandline flag), and is unsupported by the server, print a warning to
stderr and try client's registered versions in order of preference.

- If version is config default, and the server does not support it,

return an error.

func NewBasicAuthRoundTripper Uses

func NewBasicAuthRoundTripper(username, password string, rt http.RoundTripper) http.RoundTripper

NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a request unless it has already been set.

func NewBearerAuthRoundTripper Uses

func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper

NewBearerAuthRoundTripper adds the provided bearer token to a request unless the authorization header has already been set.

func NewClientCertTLSConfig Uses

func NewClientCertTLSConfig(certData, keyData, caData []byte) (*tls.Config, error)

func NewTLSConfig Uses

func NewTLSConfig(caData []byte) (*tls.Config, error)

func NewUnsafeTLSConfig Uses

func NewUnsafeTLSConfig() *tls.Config

func NewUserAgentRoundTripper Uses

func NewUserAgentRoundTripper(agent string, rt http.RoundTripper) http.RoundTripper

func SetKubernetesDefaults Uses

func SetKubernetesDefaults(config *Config) error

SetKubernetesDefaults sets default values on the provided client config for accessing the Kubernetes API or returns an error if any of the defaults are impossible or invalid.

func TLSConfigFor Uses

func TLSConfigFor(config *Config) (*tls.Config, error)

TLSConfigFor returns a tls.Config that will provide the transport level security defined by the provided Config. Will return nil if no transport level security is requested.

func TransportFor Uses

func TransportFor(config *Config) (http.RoundTripper, error)

TransportFor returns an http.RoundTripper that will provide the authentication or transport level security defined by the provided Config. Will return the default http.DefaultTransport if no special case behavior is needed.

type APIStatus Uses

type APIStatus interface {
    Status() api.Status
}

APIStatus is exposed by errors that can be converted to an api.Status object for finer grained details.

type Client Uses

type Client struct {
    *RESTClient
}

Client is the implementation of a Kubernetes client.

func New Uses

func New(c *Config) (*Client, error)

New creates a Kubernetes client for the given config. This client works with pods, replication controllers, daemons, and services. It allows operations such as list, get, update and delete on these objects. An error is returned if the provided configuration is not valid.

func NewInCluster Uses

func NewInCluster() (*Client, error)

NewInCluster is a shortcut for calling InClusterConfig() and then New().

func NewOrDie Uses

func NewOrDie(c *Config) *Client

NewOrDie creates a Kubernetes client and panics if the provided API version is not recognized.

func (*Client) ComponentStatuses Uses

func (c *Client) ComponentStatuses() ComponentStatusInterface

func (*Client) Endpoints Uses

func (c *Client) Endpoints(namespace string) EndpointsInterface

func (*Client) Events Uses

func (c *Client) Events(namespace string) EventInterface

func (*Client) LimitRanges Uses

func (c *Client) LimitRanges(namespace string) LimitRangeInterface

func (*Client) Namespaces Uses

func (c *Client) Namespaces() NamespaceInterface

func (*Client) Nodes Uses

func (c *Client) Nodes() NodeInterface

func (*Client) PersistentVolumeClaims Uses

func (c *Client) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface

func (*Client) PersistentVolumes Uses

func (c *Client) PersistentVolumes() PersistentVolumeInterface

func (*Client) PodTemplates Uses

func (c *Client) PodTemplates(namespace string) PodTemplateInterface

func (*Client) Pods Uses

func (c *Client) Pods(namespace string) PodInterface

func (*Client) ReplicationControllers Uses

func (c *Client) ReplicationControllers(namespace string) ReplicationControllerInterface

func (*Client) ResourceQuotas Uses

func (c *Client) ResourceQuotas(namespace string) ResourceQuotaInterface

func (*Client) Secrets Uses

func (c *Client) Secrets(namespace string) SecretsInterface

func (*Client) ServerAPIVersions Uses

func (c *Client) ServerAPIVersions() (*api.APIVersions, error)

ServerAPIVersions retrieves and parses the list of API versions the server supports.

func (*Client) ServerVersion Uses

func (c *Client) ServerVersion() (*version.Info, error)

ServerVersion retrieves and parses the server's version.

func (*Client) ServiceAccounts Uses

func (c *Client) ServiceAccounts(namespace string) ServiceAccountsInterface

func (*Client) Services Uses

func (c *Client) Services(namespace string) ServiceInterface

func (*Client) ValidateComponents Uses

func (c *Client) ValidateComponents() (*api.ComponentStatusList, error)

ValidateComponents retrieves and parses the master's self-monitored cluster state. TODO: This should hit the versioned endpoint when that is implemented.

type ComponentStatusInterface Uses

type ComponentStatusInterface interface {
    List(label labels.Selector, field fields.Selector) (*api.ComponentStatusList, error)
    Get(name string) (*api.ComponentStatus, error)
}

ComponentStatusInterface contains methods to retrieve ComponentStatus

type ComponentStatusesInterface Uses

type ComponentStatusesInterface interface {
    ComponentStatuses() ComponentStatusInterface
}

type ComponentValidatorInterface Uses

type ComponentValidatorInterface interface {
    ValidateComponents() (*api.ComponentStatusList, error)
}

type Config Uses

type Config struct {
    // Host must be a host string, a host:port pair, or a URL to the base of the API.
    Host string
    // Prefix is the sub path of the server. If not specified, the client will set
    // a default value.  Use "/" to indicate the server root should be used
    Prefix string
    // Version is the API version to talk to. Must be provided when initializing
    // a RESTClient directly. When initializing a Client, will be set with the default
    // code version.
    Version string
    // Codec specifies the encoding and decoding behavior for runtime.Objects passed
    // to a RESTClient or Client. Required when initializing a RESTClient, optional
    // when initializing a Client.
    Codec runtime.Codec

    // Server requires Basic authentication
    Username string
    Password string

    // Server requires Bearer authentication. This client will not attempt to use
    // refresh tokens for an OAuth2 flow.
    // TODO: demonstrate an OAuth2 compatible client.
    BearerToken string

    // TLSClientConfig contains settings to enable transport layer security
    TLSClientConfig

    // Server should be accessed without verifying the TLS
    // certificate. For testing only.
    Insecure bool

    // UserAgent is an optional field that specifies the caller of this request.
    UserAgent string

    // Transport may be used for custom HTTP behavior. This attribute may not
    // be specified with the TLS client certificate options. Use WrapTransport
    // for most client level operations.
    Transport http.RoundTripper
    // WrapTransport will be invoked for custom HTTP behavior after the underlying
    // transport is initialized (either the transport created from TLSClientConfig,
    // Transport, or http.DefaultTransport). The config may layer other RoundTrippers
    // on top of the returned RoundTripper.
    WrapTransport func(rt http.RoundTripper) http.RoundTripper

    // QPS indicates the maximum QPS to the master from this client.  If zero, QPS is unlimited.
    QPS float32

    // Maximum burst for throttle
    Burst int
}

Config holds the common attributes that can be passed to a Kubernetes client on initialization.

func InClusterConfig Uses

func InClusterConfig() (*Config, error)

InClusterConfig returns a config object which uses the service account kubernetes gives to pods. It's intended for clients that expect to be running inside a pod running on kuberenetes. It will return an error if called from a process not running in a kubernetes environment.

type ConnectionInfoGetter Uses

type ConnectionInfoGetter interface {
    GetConnectionInfo(host string) (scheme string, port uint, transport http.RoundTripper, err error)
}

type ContainerInfoGetter Uses

type ContainerInfoGetter interface {
    // GetContainerInfo returns information about a container.
    GetContainerInfo(host, podID, containerID string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)
    // GetRootInfo returns information about the root container on a machine.
    GetRootInfo(host string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)
    // GetMachineInfo returns the machine's information like number of cores, memory capacity.
    GetMachineInfo(host string) (*cadvisorApi.MachineInfo, error)
}

type DaemonInterface Uses

type DaemonInterface interface {
    List(selector labels.Selector) (*expapi.DaemonList, error)
    Get(name string) (*expapi.Daemon, error)
    Create(ctrl *expapi.Daemon) (*expapi.Daemon, error)
    Update(ctrl *expapi.Daemon) (*expapi.Daemon, error)
    Delete(name string) error
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

type DaemonsNamespacer Uses

type DaemonsNamespacer interface {
    Daemons(namespace string) DaemonInterface
}

DaemonsNamespacer has methods to work with Daemon resources in a namespace

type DebuggingRoundTripper Uses

type DebuggingRoundTripper struct {
    Levels util.StringSet
    // contains filtered or unexported fields
}

DebuggingRoundTripper will display information about the requests passing through it based on what is configured

func NewDebuggingRoundTripper Uses

func NewDebuggingRoundTripper(rt http.RoundTripper, levels ...string) *DebuggingRoundTripper

func (*DebuggingRoundTripper) RoundTrip Uses

func (rt *DebuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type EndpointsInterface Uses

type EndpointsInterface interface {
    Create(endpoints *api.Endpoints) (*api.Endpoints, error)
    List(selector labels.Selector) (*api.EndpointsList, error)
    Get(name string) (*api.Endpoints, error)
    Delete(name string) error
    Update(endpoints *api.Endpoints) (*api.Endpoints, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

EndpointsInterface has methods to work with Endpoints resources

type EndpointsNamespacer Uses

type EndpointsNamespacer interface {
    Endpoints(namespace string) EndpointsInterface
}

EndpointsNamespacer has methods to work with Endpoints resources in a namespace

type EventInterface Uses

type EventInterface interface {
    Create(event *api.Event) (*api.Event, error)
    Update(event *api.Event) (*api.Event, error)
    List(label labels.Selector, field fields.Selector) (*api.EventList, error)
    Get(name string) (*api.Event, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
    // Search finds events about the specified object
    Search(objOrRef runtime.Object) (*api.EventList, error)
    Delete(name string) error
    // Returns the appropriate field selector based on the API version being used to communicate with the server.
    // The returned field selector can be used with List and Watch to filter desired events.
    GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector
}

EventInterface has methods to work with Event resources

type EventNamespacer Uses

type EventNamespacer interface {
    Events(namespace string) EventInterface
}

EventNamespacer can return an EventInterface for the given namespace.

type ExperimentalClient Uses

type ExperimentalClient struct {
    *RESTClient
}

ExperimentalClient is used to interact with experimental Kubernetes features. Experimental features are not supported and may be changed or removed in incompatible ways at any time.

func NewExperimental Uses

func NewExperimental(c *Config) (*ExperimentalClient, error)

NewExperimental creates a new ExperimentalClient for the given config. This client provides access to experimental Kubernetes features. Experimental features are not supported and may be changed or removed in incompatible ways at any time.

func NewExperimentalOrDie Uses

func NewExperimentalOrDie(c *Config) *ExperimentalClient

NewExperimentalOrDie creates a new ExperimentalClient for the given config and panics if there is an error in the config. Experimental features are not supported and may be changed or removed in incompatible ways at any time.

func (*ExperimentalClient) Daemons Uses

func (c *ExperimentalClient) Daemons(namespace string) DaemonInterface

func (*ExperimentalClient) HorizontalPodAutoscalers Uses

func (c *ExperimentalClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface

func (*ExperimentalClient) Scales Uses

func (c *ExperimentalClient) Scales(namespace string) ScaleInterface

func (*ExperimentalClient) ServerAPIVersions Uses

func (c *ExperimentalClient) ServerAPIVersions() (*api.APIVersions, error)

ServerAPIVersions retrieves and parses the list of experimental API versions the server supports.

func (*ExperimentalClient) ServerVersion Uses

func (c *ExperimentalClient) ServerVersion() (*version.Info, error)

ServerVersion retrieves and parses the server's version.

type ExperimentalInterface Uses

type ExperimentalInterface interface {
    VersionInterface
    HorizontalPodAutoscalersNamespacer
    ScaleNamespacer
    DaemonsNamespacer
}

Interface holds the experimental methods for clients of Kubernetes to allow mock testing. Experimental features are not supported and may be changed or removed in incompatible ways at any time.

type FakeKubeletClient Uses

type FakeKubeletClient struct{}

FakeKubeletClient is a fake implementation of KubeletClient which returns an error when called. It is useful to pass to the master in a test configuration with no kubelets.

func (FakeKubeletClient) GetConnectionInfo Uses

func (c FakeKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error)

type FakeRESTClient Uses

type FakeRESTClient struct {
    Client HTTPClient
    Codec  runtime.Codec
    Req    *http.Request
    Resp   *http.Response
    Err    error
}

FakeRESTClient provides a fake RESTClient interface.

func (*FakeRESTClient) Delete Uses

func (c *FakeRESTClient) Delete() *Request

func (*FakeRESTClient) Do Uses

func (c *FakeRESTClient) Do(req *http.Request) (*http.Response, error)

func (*FakeRESTClient) Get Uses

func (c *FakeRESTClient) Get() *Request

func (*FakeRESTClient) Patch Uses

func (c *FakeRESTClient) Patch(_ api.PatchType) *Request

func (*FakeRESTClient) Post Uses

func (c *FakeRESTClient) Post() *Request

func (*FakeRESTClient) Put Uses

func (c *FakeRESTClient) Put() *Request

type FlagSet Uses

type FlagSet interface {
    StringVar(p *string, name, value, usage string)
    BoolVar(p *bool, name string, value bool, usage string)
    UintVar(p *uint, name string, value uint, usage string)
    DurationVar(p *time.Duration, name string, value time.Duration, usage string)
    IntVar(p *int, name string, value int, usage string)
}

FlagSet abstracts the flag interface for compatibility with both Golang "flag" and cobra pflags (Posix style).

type HTTPClient Uses

type HTTPClient interface {
    Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface for testing a request object.

type HTTPClientFunc Uses

type HTTPClientFunc func(*http.Request) (*http.Response, error)

func (HTTPClientFunc) Do Uses

func (f HTTPClientFunc) Do(req *http.Request) (*http.Response, error)

type HTTPContainerInfoGetter Uses

type HTTPContainerInfoGetter struct {
    Client *http.Client
    Port   int
}

func (*HTTPContainerInfoGetter) GetContainerInfo Uses

func (self *HTTPContainerInfoGetter) GetContainerInfo(host, podID, containerID string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)

func (*HTTPContainerInfoGetter) GetMachineInfo Uses

func (self *HTTPContainerInfoGetter) GetMachineInfo(host string) (*cadvisorApi.MachineInfo, error)

func (*HTTPContainerInfoGetter) GetRootInfo Uses

func (self *HTTPContainerInfoGetter) GetRootInfo(host string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)

type HTTPKubeletClient Uses

type HTTPKubeletClient struct {
    Client *http.Client
    Config *KubeletConfig
}

HTTPKubeletClient is the default implementation of KubeletHealthchecker, accesses the kubelet over HTTP.

func (*HTTPKubeletClient) GetConnectionInfo Uses

func (c *HTTPKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error)

type HorizontalPodAutoscalerInterface Uses

type HorizontalPodAutoscalerInterface interface {
    List(label labels.Selector, field fields.Selector) (*expapi.HorizontalPodAutoscalerList, error)
    Get(name string) (*expapi.HorizontalPodAutoscaler, error)
    Delete(name string, options *api.DeleteOptions) error
    Create(horizontalPodAutoscaler *expapi.HorizontalPodAutoscaler) (*expapi.HorizontalPodAutoscaler, error)
    Update(horizontalPodAutoscaler *expapi.HorizontalPodAutoscaler) (*expapi.HorizontalPodAutoscaler, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources.

type HorizontalPodAutoscalersNamespacer Uses

type HorizontalPodAutoscalersNamespacer interface {
    HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
}

HorizontalPodAutoscalersNamespacer has methods to work with HorizontalPodAutoscaler resources in a namespace

type Interface Uses

type Interface interface {
    PodsNamespacer
    PodTemplatesNamespacer
    ReplicationControllersNamespacer
    ServicesNamespacer
    EndpointsNamespacer
    VersionInterface
    NodesInterface
    EventNamespacer
    LimitRangesNamespacer
    ResourceQuotasNamespacer
    ServiceAccountsNamespacer
    SecretsNamespacer
    NamespacesInterface
    PersistentVolumesInterface
    PersistentVolumeClaimsNamespacer
    ComponentStatusesInterface
}

Interface holds the methods for clients of Kubernetes, an interface to allow mock testing.

type KubeletClient Uses

type KubeletClient interface {
    ConnectionInfoGetter
}

KubeletClient is an interface for all kubelet functionality

func NewKubeletClient Uses

func NewKubeletClient(config *KubeletConfig) (KubeletClient, error)

TODO: this structure is questionable, it should be using client.Config and overriding defaults.

type KubeletConfig Uses

type KubeletConfig struct {
    // ToDo: Add support for different kubelet instances exposing different ports
    Port        uint
    EnableHttps bool

    // TLSClientConfig contains settings to enable transport layer security
    TLSClientConfig

    // HTTPTimeout is used by the client to timeout http requests to Kubelet.
    HTTPTimeout time.Duration

    // Dial is a custom dialer used for the client
    Dial func(net, addr string) (net.Conn, error)
}

type LimitRangeInterface Uses

type LimitRangeInterface interface {
    List(selector labels.Selector) (*api.LimitRangeList, error)
    Get(name string) (*api.LimitRange, error)
    Delete(name string) error
    Create(limitRange *api.LimitRange) (*api.LimitRange, error)
    Update(limitRange *api.LimitRange) (*api.LimitRange, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

LimitRangeInterface has methods to work with LimitRange resources.

type LimitRangesNamespacer Uses

type LimitRangesNamespacer interface {
    LimitRanges(namespace string) LimitRangeInterface
}

LimitRangesNamespacer has methods to work with LimitRange resources in a namespace

type NamespaceInterface Uses

type NamespaceInterface interface {
    Create(item *api.Namespace) (*api.Namespace, error)
    Get(name string) (result *api.Namespace, err error)
    List(label labels.Selector, field fields.Selector) (*api.NamespaceList, error)
    Delete(name string) error
    Update(item *api.Namespace) (*api.Namespace, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
    Finalize(item *api.Namespace) (*api.Namespace, error)
    Status(item *api.Namespace) (*api.Namespace, error)
}

type NamespacesInterface Uses

type NamespacesInterface interface {
    Namespaces() NamespaceInterface
}

type NodeInterface Uses

type NodeInterface interface {
    Get(name string) (result *api.Node, err error)
    Create(node *api.Node) (*api.Node, error)
    List(label labels.Selector, field fields.Selector) (*api.NodeList, error)
    Delete(name string) error
    Update(*api.Node) (*api.Node, error)
    UpdateStatus(*api.Node) (*api.Node, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

type NodesInterface Uses

type NodesInterface interface {
    Nodes() NodeInterface
}

type PersistentVolumeClaimInterface Uses

type PersistentVolumeClaimInterface interface {
    List(label labels.Selector, field fields.Selector) (*api.PersistentVolumeClaimList, error)
    Get(name string) (*api.PersistentVolumeClaim, error)
    Create(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
    Update(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
    UpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
    Delete(name string) error
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

PersistentVolumeClaimInterface has methods to work with PersistentVolumeClaim resources.

type PersistentVolumeClaimsNamespacer Uses

type PersistentVolumeClaimsNamespacer interface {
    PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface
}

PersistentVolumeClaimsNamespacer has methods to work with PersistentVolumeClaim resources in a namespace

type PersistentVolumeInterface Uses

type PersistentVolumeInterface interface {
    List(label labels.Selector, field fields.Selector) (*api.PersistentVolumeList, error)
    Get(name string) (*api.PersistentVolume, error)
    Create(volume *api.PersistentVolume) (*api.PersistentVolume, error)
    Update(volume *api.PersistentVolume) (*api.PersistentVolume, error)
    UpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error)
    Delete(name string) error
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

PersistentVolumeInterface has methods to work with PersistentVolume resources.

type PersistentVolumesInterface Uses

type PersistentVolumesInterface interface {
    PersistentVolumes() PersistentVolumeInterface
}

type PodInterface Uses

type PodInterface interface {
    List(label labels.Selector, field fields.Selector) (*api.PodList, error)
    Get(name string) (*api.Pod, error)
    Delete(name string, options *api.DeleteOptions) error
    Create(pod *api.Pod) (*api.Pod, error)
    Update(pod *api.Pod) (*api.Pod, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
    Bind(binding *api.Binding) error
    UpdateStatus(pod *api.Pod) (*api.Pod, error)
}

PodInterface has methods to work with Pod resources.

type PodTemplateInterface Uses

type PodTemplateInterface interface {
    List(label labels.Selector, field fields.Selector) (*api.PodTemplateList, error)
    Get(name string) (*api.PodTemplate, error)
    Delete(name string, options *api.DeleteOptions) error
    Create(podTemplate *api.PodTemplate) (*api.PodTemplate, error)
    Update(podTemplate *api.PodTemplate) (*api.PodTemplate, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

PodTemplateInterface has methods to work with PodTemplate resources.

type PodTemplatesNamespacer Uses

type PodTemplatesNamespacer interface {
    PodTemplates(namespace string) PodTemplateInterface
}

PodTemplatesNamespacer has methods to work with PodTemplate resources in a namespace

type PodsNamespacer Uses

type PodsNamespacer interface {
    Pods(namespace string) PodInterface
}

PodsNamespacer has methods to work with Pod resources in a namespace

type RESTClient Uses

type RESTClient struct {

    // Codec is the encoding and decoding scheme that applies to a particular set of
    // REST resources.
    Codec runtime.Codec

    // Set specific behavior of the client.  If not set http.DefaultClient will be
    // used.
    Client HTTPClient

    Timeout time.Duration

    // TODO extract this into a wrapper interface via the RESTClient interface in kubectl.
    Throttle util.RateLimiter
    // contains filtered or unexported fields
}

RESTClient imposes common Kubernetes API conventions on a set of resource paths. The baseURL is expected to point to an HTTP or HTTPS path that is the parent of one or more resources. The server should return a decodable API resource object, or an api.Status object which contains information about the reason for any failure.

Most consumers should use client.New() to get a Kubernetes API client.

func NewRESTClient Uses

func NewRESTClient(baseURL *url.URL, apiVersion string, c runtime.Codec, maxQPS float32, maxBurst int) *RESTClient

NewRESTClient creates a new RESTClient. This client performs generic REST functions such as Get, Put, Post, and Delete on specified paths. Codec controls encoding and decoding of responses from the server.

func RESTClientFor Uses

func RESTClientFor(config *Config) (*RESTClient, error)

RESTClientFor returns a RESTClient that satisfies the requested attributes on a client Config object. Note that a RESTClient may require fields that are optional when initializing a Client. A RESTClient created by this method is generic - it expects to operate on an API that follows the Kubernetes conventions, but may not be the Kubernetes API.

func (*RESTClient) APIVersion Uses

func (c *RESTClient) APIVersion() string

APIVersion returns the APIVersion this RESTClient is expected to use.

func (*RESTClient) Delete Uses

func (c *RESTClient) Delete() *Request

Delete begins a DELETE request. Short for c.Verb("DELETE").

func (*RESTClient) Get Uses

func (c *RESTClient) Get() *Request

Get begins a GET request. Short for c.Verb("GET").

func (*RESTClient) Patch Uses

func (c *RESTClient) Patch(pt api.PatchType) *Request

Patch begins a PATCH request. Short for c.Verb("Patch").

func (*RESTClient) Post Uses

func (c *RESTClient) Post() *Request

Post begins a POST request. Short for c.Verb("POST").

func (*RESTClient) Put Uses

func (c *RESTClient) Put() *Request

Put begins a PUT request. Short for c.Verb("PUT").

func (*RESTClient) Verb Uses

func (c *RESTClient) Verb(verb string) *Request

Verb begins a request with a verb (GET, POST, PUT, DELETE).

Example usage of RESTClient's request building interface: c := NewRESTClient(url, codec) resp, err := c.Verb("GET").

Path("pods").
SelectorParam("labels", "area=staging").
Timeout(10*time.Second).
Do()

if err != nil { ... } list, ok := resp.(*api.PodList)

type ReplicationControllerInterface Uses

type ReplicationControllerInterface interface {
    List(selector labels.Selector) (*api.ReplicationControllerList, error)
    Get(name string) (*api.ReplicationController, error)
    Create(ctrl *api.ReplicationController) (*api.ReplicationController, error)
    Update(ctrl *api.ReplicationController) (*api.ReplicationController, error)
    Delete(name string) error
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

ReplicationControllerInterface has methods to work with ReplicationController resources.

type ReplicationControllersNamespacer Uses

type ReplicationControllersNamespacer interface {
    ReplicationControllers(namespace string) ReplicationControllerInterface
}

ReplicationControllersNamespacer has methods to work with ReplicationController resources in a namespace

type Request Uses

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

Request allows for building up a request to a server in a chained fashion. Any errors are stored until the end of your call, so you only have to check once.

func NewRequest Uses

func NewRequest(client HTTPClient, verb string, baseURL *url.URL, apiVersion string,
    codec runtime.Codec) *Request

NewRequest creates a new request helper object for accessing runtime.Objects on a server.

func (*Request) AbsPath Uses

func (r *Request) AbsPath(segments ...string) *Request

AbsPath overwrites an existing path with the segments provided. Trailing slashes are preserved when a single segment is passed.

func (*Request) Body Uses

func (r *Request) Body(obj interface{}) *Request

Body makes the request use obj as the body. Optional. If obj is a string, try to read a file of that name. If obj is a []byte, send it directly. If obj is an io.Reader, use it directly. If obj is a runtime.Object, marshal it correctly. Otherwise, set an error.

func (*Request) Do Uses

func (r *Request) Do() Result

Do formats and executes the request. Returns a Result object for easy response processing.

Error type:

* If the request can't be constructed, or an error happened earlier while building its
  arguments: *RequestConstructionError
* If the server responds with a status: *errors.StatusError or *errors.UnexpectedObjectError
* http.Client.Do errors are returned directly.

func (*Request) DoRaw Uses

func (r *Request) DoRaw() ([]byte, error)

DoRaw executes the request but does not process the response body.

func (*Request) FieldsSelectorParam Uses

func (r *Request) FieldsSelectorParam(s fields.Selector) *Request

FieldsSelectorParam adds the given selector as a query parameter with the name paramName.

func (*Request) LabelsSelectorParam Uses

func (r *Request) LabelsSelectorParam(s labels.Selector) *Request

LabelsSelectorParam adds the given selector as a query parameter

func (*Request) Name Uses

func (r *Request) Name(resourceName string) *Request

Name sets the name of a resource to access (<resource>/[ns/<namespace>/]<name>)

func (*Request) Namespace Uses

func (r *Request) Namespace(namespace string) *Request

Namespace applies the namespace scope to a request (<resource>/[ns/<namespace>/]<name>)

func (*Request) NamespaceIfScoped Uses

func (r *Request) NamespaceIfScoped(namespace string, scoped bool) *Request

NamespaceIfScoped is a convenience function to set a namespace if scoped is true

func (*Request) Param Uses

func (r *Request) Param(paramName, s string) *Request

Param creates a query parameter with the given string value.

func (*Request) Prefix Uses

func (r *Request) Prefix(segments ...string) *Request

Prefix adds segments to the relative beginning to the request path. These items will be placed before the optional Namespace, Resource, or Name sections. Setting AbsPath will clear any previously set Prefix segments

func (*Request) RequestURI Uses

func (r *Request) RequestURI(uri string) *Request

RequestURI overwrites existing path and parameters with the value of the provided server relative URI. Some parameters (those in specialParameters) cannot be overwritten.

func (*Request) Resource Uses

func (r *Request) Resource(resource string) *Request

Resource sets the resource to access (<resource>/[ns/<namespace>/]<name>)

func (*Request) SetHeader Uses

func (r *Request) SetHeader(key, value string) *Request

func (*Request) Stream Uses

func (r *Request) Stream() (io.ReadCloser, error)

Stream formats and executes the request, and offers streaming of the response. Returns io.ReadCloser which could be used for streaming of the response, or an error Any non-2xx http status code causes an error. If we get a non-2xx code, we try to convert the body into an APIStatus object. If we can, we return that as an error. Otherwise, we create an error that lists the http status and the content of the response.

func (*Request) SubResource Uses

func (r *Request) SubResource(subresources ...string) *Request

SubResource sets a sub-resource path which can be multiple segments segment after the resource name but before the suffix.

func (*Request) Suffix Uses

func (r *Request) Suffix(segments ...string) *Request

Suffix appends segments to the end of the path. These items will be placed after the prefix and optional Namespace, Resource, or Name sections.

func (*Request) Timeout Uses

func (r *Request) Timeout(d time.Duration) *Request

Timeout makes the request use the given duration as a timeout. Sets the "timeout" parameter.

func (*Request) URL Uses

func (r *Request) URL() *url.URL

URL returns the current working URL.

func (*Request) UintParam Uses

func (r *Request) UintParam(paramName string, u uint64) *Request

UintParam creates a query parameter with the given value.

func (*Request) UnversionedPath Uses

func (r *Request) UnversionedPath(segments ...string) *Request

UnversionedPath strips the apiVersion from the baseURL before appending segments.

func (*Request) Upgrade Uses

func (r *Request) Upgrade(config *Config, newRoundTripperFunc func(*tls.Config) httpstream.UpgradeRoundTripper) (httpstream.Connection, error)

Upgrade upgrades the request so that it supports multiplexed bidirectional streams. The current implementation uses SPDY, but this could be replaced with HTTP/2 once it's available, or something else.

func (*Request) Watch Uses

func (r *Request) Watch() (watch.Interface, error)

Watch attempts to begin watching the requested location. Returns a watch.Interface, or an error.

type RequestConstructionError Uses

type RequestConstructionError struct {
    Err error
}

RequestConstructionError is returned when there's an error assembling a request.

func (*RequestConstructionError) Error Uses

func (r *RequestConstructionError) Error() string

Error returns a textual description of 'r'.

type RequestInfo Uses

type RequestInfo struct {
    RequestHeaders http.Header
    RequestVerb    string
    RequestURL     string

    ResponseStatus  string
    ResponseHeaders http.Header
    ResponseErr     error

    Duration time.Duration
}

RequestInfo keeps track of information about a request/response combination

func NewRequestInfo Uses

func NewRequestInfo(req *http.Request) *RequestInfo

NewRequestInfo creates a new RequestInfo based on an http request

func (*RequestInfo) Complete Uses

func (r *RequestInfo) Complete(response *http.Response, err error)

Complete adds information about the response to the RequestInfo

func (RequestInfo) ToCurl Uses

func (r RequestInfo) ToCurl() string

ToCurl returns a string that can be run as a command in a terminal (minus the body)

type ResourceQuotaInterface Uses

type ResourceQuotaInterface interface {
    List(selector labels.Selector) (*api.ResourceQuotaList, error)
    Get(name string) (*api.ResourceQuota, error)
    Delete(name string) error
    Create(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
    Update(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
    UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

ResourceQuotaInterface has methods to work with ResourceQuota resources.

type ResourceQuotasNamespacer Uses

type ResourceQuotasNamespacer interface {
    ResourceQuotas(namespace string) ResourceQuotaInterface
}

ResourceQuotasNamespacer has methods to work with ResourceQuota resources in a namespace

type ResponseWrapper Uses

type ResponseWrapper interface {
    DoRaw() ([]byte, error)
    Stream() (io.ReadCloser, error)
}

ResponseWrapper is an interface for getting a response. The response may be either accessed as a raw data (the whole output is put into memory) or as a stream.

type Result Uses

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

Result contains the result of calling Request.Do().

func (Result) Error Uses

func (r Result) Error() error

Error returns the error executing the request, nil if no error occurred. See the Request.Do() comment for what errors you might get.

func (Result) Get Uses

func (r Result) Get() (runtime.Object, error)

Get returns the result as an object.

func (Result) Into Uses

func (r Result) Into(obj runtime.Object) error

Into stores the result into obj, if possible.

func (Result) Raw Uses

func (r Result) Raw() ([]byte, error)

Raw returns the raw result.

func (Result) StatusCode Uses

func (r Result) StatusCode(statusCode *int) Result

StatusCode returns the HTTP status code of the request. (Only valid if no error was returned.)

func (Result) WasCreated Uses

func (r Result) WasCreated(wasCreated *bool) Result

WasCreated updates the provided bool pointer to whether the server returned 201 created or a different response.

type ScaleInterface Uses

type ScaleInterface interface {
    Get(string, string) (*expapi.Scale, error)
    Update(string, *expapi.Scale) (*expapi.Scale, error)
}

ScaleInterface has methods to work with Scale (sub)resources.

type ScaleNamespacer Uses

type ScaleNamespacer interface {
    Scales(namespace string) ScaleInterface
}

type SecretsInterface Uses

type SecretsInterface interface {
    Create(secret *api.Secret) (*api.Secret, error)
    Update(secret *api.Secret) (*api.Secret, error)
    Delete(name string) error
    List(label labels.Selector, field fields.Selector) (*api.SecretList, error)
    Get(name string) (*api.Secret, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

type SecretsNamespacer Uses

type SecretsNamespacer interface {
    Secrets(namespace string) SecretsInterface
}

type ServiceAccountsInterface Uses

type ServiceAccountsInterface interface {
    Create(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error)
    Update(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error)
    Delete(name string) error
    List(label labels.Selector, field fields.Selector) (*api.ServiceAccountList, error)
    Get(name string) (*api.ServiceAccount, error)
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

type ServiceAccountsNamespacer Uses

type ServiceAccountsNamespacer interface {
    ServiceAccounts(namespace string) ServiceAccountsInterface
}

type ServiceInterface Uses

type ServiceInterface interface {
    List(selector labels.Selector) (*api.ServiceList, error)
    Get(name string) (*api.Service, error)
    Create(srv *api.Service) (*api.Service, error)
    Update(srv *api.Service) (*api.Service, error)
    Delete(name string) error
    Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
    ProxyGet(name, path string, params map[string]string) ResponseWrapper
}

ServiceInterface has methods to work with Service resources.

type ServicesNamespacer Uses

type ServicesNamespacer interface {
    Services(namespace string) ServiceInterface
}

ServicesNamespacer has methods to work with Service resources in a namespace

type TLSClientConfig Uses

type TLSClientConfig struct {
    // Server requires TLS client certificate authentication
    CertFile string
    // Server requires TLS client certificate authentication
    KeyFile string
    // Trusted root certificates for server
    CAFile string

    // CertData holds PEM-encoded bytes (typically read from a client certificate file).
    // CertData takes precedence over CertFile
    CertData []byte
    // KeyData holds PEM-encoded bytes (typically read from a client certificate key file).
    // KeyData takes precedence over KeyFile
    KeyData []byte
    // CAData holds PEM-encoded bytes (typically read from a root certificates bundle).
    // CAData takes precedence over CAFile
    CAData []byte
}

TLSClientConfig contains settings to enable transport layer security

type VersionInterface Uses

type VersionInterface interface {
    ServerVersion() (*version.Info, error)
    ServerAPIVersions() (*api.APIVersions, error)
}

VersionInterface has a method to retrieve the server version.

Directories

PathSynopsis
authPackage auth defines a file format for holding authentication information needed by clients of Kubernetes.
cachePackage cache is a client-side caching mechanism.
clientcmdPackage clientcmd provides one stop shopping for building a working client from a fixed config, from a .kubeconfig file, from command line flags, or from any merged combination.
clientcmd/api
clientcmd/api/latest
clientcmd/api/v1
portforwardPackage portforward adds support for SSH-like port forwarding from the client's local host to remote containers.
recordPackage record has all client logic for recording and reporting events.
remotecommandPackage remotecommand adds support for executing commands in containers, with support for separate stdin, stdout, and stderr streams, as well as TTY.
testclient

Package unversioned imports 38 packages (graph). Updated 2017-06-27. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).