Documentation ¶
Overview ¶
Package unversioned 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 nodes.
Most consumers should use the Config object to create a Client:
import ( client "k8s.io/kubernetes/pkg/client/unversioned" "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/devel/api-conventions.md`) for a given API path and is intended for use by consumers implementing their own Kubernetes compatible APIs.
Index ¶
- Constants
- Variables
- func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationController) wait.ConditionFunc
- func DefaultKubernetesUserAgent() string
- func DefaultServerURL(host, apiPath string, groupVersion unversioned.GroupVersion, defaultTLS bool) (*url.URL, string, error)
- func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions.Deployment) wait.ConditionFunc
- func ExtractGroupVersions(l *unversioned.APIGroupList) []string
- func GetInvolvedObjectNameFieldLabel(version string) string
- func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error)
- func IsConfigTransportTLS(config Config) bool
- func IsTimeout(err error) bool
- func JobHasDesiredParallelism(c ExtensionsInterface, job *extensions.Job) wait.ConditionFunc
- func LoadTLSFiles(c *Config) error
- func MatchesServerVersion(client *Client, c *Config) error
- func NegotiateVersion(client *Client, c *Config, requestedGV *unversioned.GroupVersion, ...) (*unversioned.GroupVersion, error)
- func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.ReplicaSet) wait.ConditionFunc
- func RetryOnConflict(backoff wait.Backoff, fn func() error) error
- func ServerAPIVersions(c *Config) (groupVersions []string, err error)
- func SetKubernetesDefaults(config *Config) error
- func TLSConfigFor(config *Config) (*tls.Config, error)
- func TransportFor(config *Config) (http.RoundTripper, error)
- type AutoscalingClient
- type AutoscalingInterface
- type BackoffManager
- type Client
- func (c *Client) Autoscaling() AutoscalingInterface
- func (c *Client) ComponentStatuses() ComponentStatusInterface
- func (c *Client) ConfigMaps(namespace string) ConfigMapsInterface
- func (c *Client) Discovery() DiscoveryInterface
- func (c *Client) Endpoints(namespace string) EndpointsInterface
- func (c *Client) Events(namespace string) EventInterface
- func (c *Client) Extensions() ExtensionsInterface
- func (c *Client) LimitRanges(namespace string) LimitRangeInterface
- func (c *Client) Namespaces() NamespaceInterface
- func (c *Client) Nodes() NodeInterface
- func (c *Client) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface
- func (c *Client) PersistentVolumes() PersistentVolumeInterface
- func (c *Client) PodTemplates(namespace string) PodTemplateInterface
- func (c *Client) Pods(namespace string) PodInterface
- func (c *Client) ReplicationControllers(namespace string) ReplicationControllerInterface
- func (c *Client) ResourceQuotas(namespace string) ResourceQuotaInterface
- func (c *Client) Secrets(namespace string) SecretsInterface
- func (c *Client) ServiceAccounts(namespace string) ServiceAccountsInterface
- func (c *Client) Services(namespace string) ServiceInterface
- type ComponentStatusInterface
- type ComponentStatusesInterface
- type Config
- type ConfigMaps
- func (c *ConfigMaps) Create(cfg *api.ConfigMap) (*api.ConfigMap, error)
- func (c *ConfigMaps) Delete(name string) error
- func (c *ConfigMaps) Get(name string) (*api.ConfigMap, error)
- func (c *ConfigMaps) List(opts api.ListOptions) (*api.ConfigMapList, error)
- func (c *ConfigMaps) Update(cfg *api.ConfigMap) (*api.ConfigMap, error)
- func (c *ConfigMaps) Watch(opts api.ListOptions) (watch.Interface, error)
- type ConfigMapsInterface
- type ConfigMapsNamespacer
- type ContainerInfoGetter
- type ContentConfig
- type DaemonSetInterface
- type DaemonSetsNamespacer
- type DeploymentInterface
- type DeploymentsNamespacer
- type DiscoveryClient
- func (d *DiscoveryClient) ServerGroups() (apiGroupList *unversioned.APIGroupList, err error)
- func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResourceList, error)
- func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (resources *unversioned.APIResourceList, err error)
- func (d *DiscoveryClient) ServerVersion() (*version.Info, error)
- func (d *DiscoveryClient) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error)
- type DiscoveryInterface
- type EndpointsInterface
- type EndpointsNamespacer
- type EventInterface
- type EventNamespacer
- type ExtensionsClient
- func (c *ExtensionsClient) DaemonSets(namespace string) DaemonSetInterface
- func (c *ExtensionsClient) Deployments(namespace string) DeploymentInterface
- func (c *ExtensionsClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
- func (c *ExtensionsClient) Ingress(namespace string) IngressInterface
- func (c *ExtensionsClient) Jobs(namespace string) JobInterface
- func (c *ExtensionsClient) PodSecurityPolicies() PodSecurityPolicyInterface
- func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface
- func (c *ExtensionsClient) Scales(namespace string) ScaleInterface
- func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface
- type ExtensionsInterface
- type FlagSet
- type HTTPClient
- type HTTPContainerInfoGetter
- func (self *HTTPContainerInfoGetter) GetContainerInfo(host, podID, containerID string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
- func (self *HTTPContainerInfoGetter) GetMachineInfo(host string) (*cadvisorapi.MachineInfo, error)
- func (self *HTTPContainerInfoGetter) GetRootInfo(host string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
- type HorizontalPodAutoscalerInterface
- type HorizontalPodAutoscalersNamespacer
- type IngressInterface
- type IngressNamespacer
- type Interface
- type JobInterface
- type JobsNamespacer
- type LimitRangeInterface
- type LimitRangesNamespacer
- type NamespaceInterface
- type NamespacesInterface
- type NoBackoff
- type NodeInterface
- type NodesInterface
- type PersistentVolumeClaimInterface
- type PersistentVolumeClaimsNamespacer
- type PersistentVolumeInterface
- type PersistentVolumesInterface
- type PodInterface
- type PodSecurityPoliciesInterface
- type PodSecurityPolicyInterface
- type PodTemplateInterface
- type PodTemplatesNamespacer
- type PodsNamespacer
- type RESTClient
- func (c *RESTClient) APIVersion() unversioned.GroupVersion
- func (c *RESTClient) Delete() *Request
- func (c *RESTClient) Get() *Request
- func (c *RESTClient) Patch(pt api.PatchType) *Request
- func (c *RESTClient) Post() *Request
- func (c *RESTClient) Put() *Request
- func (c *RESTClient) Verb(verb string) *Request
- type ReplicaSetInterface
- type ReplicaSetsNamespacer
- type ReplicationControllerInterface
- type ReplicationControllersNamespacer
- type Request
- func (r *Request) AbsPath(segments ...string) *Request
- func (r *Request) Body(obj interface{}) *Request
- func (r *Request) Do() Result
- func (r *Request) DoRaw() ([]byte, error)
- func (r *Request) FieldsSelectorParam(s fields.Selector) *Request
- func (r *Request) LabelsSelectorParam(s labels.Selector) *Request
- func (r *Request) Name(resourceName string) *Request
- func (r *Request) Namespace(namespace string) *Request
- func (r *Request) NamespaceIfScoped(namespace string, scoped bool) *Request
- func (r *Request) Param(paramName, s string) *Request
- func (r *Request) Prefix(segments ...string) *Request
- func (r *Request) RequestURI(uri string) *Request
- func (r *Request) Resource(resource string) *Request
- func (r *Request) SetHeader(key, value string) *Request
- func (r *Request) Stream() (io.ReadCloser, error)
- func (r *Request) SubResource(subresources ...string) *Request
- func (r *Request) Suffix(segments ...string) *Request
- func (r *Request) Timeout(d time.Duration) *Request
- func (r *Request) URL() *url.URL
- func (r *Request) UintParam(paramName string, u uint64) *Request
- func (r *Request) VersionedParams(obj runtime.Object, codec runtime.ParameterCodec) *Request
- func (r *Request) Watch() (watch.Interface, error)
- type RequestConstructionError
- type ResourceQuotaInterface
- type ResourceQuotasNamespacer
- type ResponseWrapper
- type Result
- type ScaleInterface
- type ScaleNamespacer
- type SecretsInterface
- type SecretsNamespacer
- type ServerGroupsInterface
- type ServerResourcesInterface
- type ServerVersionInterface
- type ServiceAccountsInterface
- type ServiceAccountsNamespacer
- type ServiceInterface
- type ServicesNamespacer
- type SwaggerSchemaInterface
- type TLSClientConfig
- type ThirdPartyResourceInterface
- type ThirdPartyResourceNamespacer
- type URLBackoff
Constants ¶
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" EventType = "type" EventInvolvedKind = "involvedObject.kind" EventInvolvedNamespace = "involvedObject.namespace" EventInvolvedName = "involvedObject.name" EventInvolvedUID = "involvedObject.uid" EventInvolvedAPIVersion = "involvedObject.apiVersion" EventInvolvedResourceVersion = "involvedObject.resourceVersion" EventInvolvedFieldPath = "involvedObject.fieldPath" )
const (
ConfigMapResourceName string = "configmaps"
)
Variables ¶
var DefaultBackoff = wait.Backoff{ Steps: 4, Duration: 10 * time.Millisecond, Factor: 5.0, Jitter: 0.1, }
DefaultBackoff is the recommended backoff for a conflict where a client may be attempting to make an unrelated modification to a resource under active management by one or more controllers.
var DefaultRetry = wait.Backoff{ Steps: 5, Duration: 10 * time.Millisecond, Factor: 1.0, Jitter: 0.1, }
DefaultRetry is the recommended retry for a conflict where multiple clients are making changes to the same resource.
Functions ¶
func ControllerHasDesiredReplicas ¶
func ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationController) wait.ConditionFunc
ControllerHasDesiredReplicas returns a condition that will be true if and only if the desired replica count for a controller's ReplicaSelector equals the Replicas count.
func DefaultKubernetesUserAgent ¶
func DefaultKubernetesUserAgent() string
DefaultKubernetesUserAgent returns the default user agent that clients can use.
func DefaultServerURL ¶
func DefaultServerURL(host, apiPath string, groupVersion unversioned.GroupVersion, defaultTLS bool) (*url.URL, string, 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 DeploymentHasDesiredReplicas ¶ added in v1.0.0
func DeploymentHasDesiredReplicas(c ExtensionsInterface, deployment *extensions.Deployment) wait.ConditionFunc
DeploymentHasDesiredReplicas returns a condition that will be true if and only if the desired replica count for a deployment equals its updated replicas count. (non-terminated pods that have the desired template spec).
func ExtractGroupVersions ¶ added in v0.19.0
func ExtractGroupVersions(l *unversioned.APIGroupList) []string
func GetInvolvedObjectNameFieldLabel ¶ added in v1.0.0
Returns the appropriate field label to use for name of the involved object as per the given API version.
func HTTPWrappersForConfig ¶
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 ¶
IsConfigTransportTLS returns true if and only if 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 ¶
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 JobHasDesiredParallelism ¶
func JobHasDesiredParallelism(c ExtensionsInterface, job *extensions.Job) wait.ConditionFunc
JobHasDesiredParallelism returns a condition that will be true if the desired parallelism count for a job equals the current active counts or is less by an appropriate successful/unsuccessful count.
func LoadTLSFiles ¶
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 MatchesServerVersion ¶
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 ¶
func NegotiateVersion(client *Client, c *Config, requestedGV *unversioned.GroupVersion, clientRegisteredGVs []unversioned.GroupVersion) (*unversioned.GroupVersion, 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 ReplicaSetHasDesiredReplicas ¶ added in v1.0.0
func ReplicaSetHasDesiredReplicas(c ExtensionsInterface, replicaSet *extensions.ReplicaSet) wait.ConditionFunc
ReplicaSetHasDesiredReplicas returns a condition that will be true if and only if the desired replica count for a ReplicaSet's ReplicaSelector equals the Replicas count.
func RetryOnConflict ¶ added in v1.0.0
RetryConflict executes the provided function repeatedly, retrying if the server returns a conflicting write. Callers should preserve previous executions if they wish to retry changes. It performs an exponential backoff.
var pod *api.Pod err := RetryOnConflict(DefaultBackoff, func() (err error) { pod, err = c.Pods("mynamespace").UpdateStatus(podStatus) return }) if err != nil { // may be conflict if max retries were hit return err } ...
TODO: Make Backoff an interface?
func ServerAPIVersions ¶ added in v0.19.0
ServerAPIVersions returns the GroupVersions supported by the API server. It creates a RESTClient based on the passed in config, but it doesn't rely on the Version and Codec of the config, because it uses AbsPath and takes the raw response.
func SetKubernetesDefaults ¶
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. TODO: this method needs to be split into one that sets defaults per group, expected to be fix in PR "Refactoring clientcache.go and helper.go #14592"
func TLSConfigFor ¶
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 ¶
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.
Types ¶
type AutoscalingClient ¶ added in v1.0.0
type AutoscalingClient struct {
*RESTClient
}
AutoscalingClient is used to interact with Kubernetes autoscaling features.
func NewAutoscaling ¶ added in v1.0.0
func NewAutoscaling(c *Config) (*AutoscalingClient, error)
func NewAutoscalingOrDie ¶ added in v1.0.0
func NewAutoscalingOrDie(c *Config) *AutoscalingClient
func (*AutoscalingClient) HorizontalPodAutoscalers ¶ added in v1.0.0
func (c *AutoscalingClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
type AutoscalingInterface ¶ added in v1.0.0
type AutoscalingInterface interface { HorizontalPodAutoscalersNamespacer }
type BackoffManager ¶ added in v1.0.0
type Client ¶
type Client struct { *RESTClient *AutoscalingClient *ExtensionsClient *DiscoveryClient }
Client is the implementation of a Kubernetes client.
func New ¶
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 ¶
NewInCluster is a shortcut for calling InClusterConfig() and then New().
func NewOrDie ¶
NewOrDie creates a Kubernetes client and panics if the provided API version is not recognized.
func (*Client) Autoscaling ¶ added in v1.0.0
func (c *Client) Autoscaling() AutoscalingInterface
func (*Client) ComponentStatuses ¶
func (c *Client) ComponentStatuses() ComponentStatusInterface
func (*Client) ConfigMaps ¶ added in v1.0.0
func (c *Client) ConfigMaps(namespace string) ConfigMapsInterface
func (*Client) Discovery ¶ added in v0.19.0
func (c *Client) Discovery() DiscoveryInterface
func (*Client) Endpoints ¶
func (c *Client) Endpoints(namespace string) EndpointsInterface
func (*Client) Events ¶
func (c *Client) Events(namespace string) EventInterface
func (*Client) Extensions ¶ added in v0.19.0
func (c *Client) Extensions() ExtensionsInterface
func (*Client) LimitRanges ¶
func (c *Client) LimitRanges(namespace string) LimitRangeInterface
func (*Client) Namespaces ¶
func (c *Client) Namespaces() NamespaceInterface
func (*Client) Nodes ¶
func (c *Client) Nodes() NodeInterface
func (*Client) PersistentVolumeClaims ¶
func (c *Client) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface
func (*Client) PersistentVolumes ¶
func (c *Client) PersistentVolumes() PersistentVolumeInterface
func (*Client) PodTemplates ¶
func (c *Client) PodTemplates(namespace string) PodTemplateInterface
func (*Client) Pods ¶
func (c *Client) Pods(namespace string) PodInterface
func (*Client) ReplicationControllers ¶
func (c *Client) ReplicationControllers(namespace string) ReplicationControllerInterface
func (*Client) ResourceQuotas ¶
func (c *Client) ResourceQuotas(namespace string) ResourceQuotaInterface
func (*Client) Secrets ¶
func (c *Client) Secrets(namespace string) SecretsInterface
func (*Client) ServiceAccounts ¶
func (c *Client) ServiceAccounts(namespace string) ServiceAccountsInterface
func (*Client) Services ¶
func (c *Client) Services(namespace string) ServiceInterface
type ComponentStatusInterface ¶
type ComponentStatusInterface interface { List(opts api.ListOptions) (*api.ComponentStatusList, error) Get(name string) (*api.ComponentStatus, error) }
ComponentStatusInterface contains methods to retrieve ComponentStatus
type ComponentStatusesInterface ¶
type ComponentStatusesInterface interface {
ComponentStatuses() ComponentStatusInterface
}
type Config ¶
type Config struct { // Host must be a host string, a host:port pair, or a URL to the base of the apiserver. // If a URL is given then the (optional) Path of that URL represents a prefix that must // be appended to all request URIs used to access the apiserver. This allows a frontend // proxy to easily relocate all of the apiserver endpoints. Host string // APIPath is a sub-path that points to an API root. APIPath 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 // ContentConfig contains settings that affect how objects are transformed when // sent to the server. ContentConfig // 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 AddUserAgent ¶ added in v1.0.0
func InClusterConfig ¶
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 ConfigMaps ¶ added in v1.0.0
type ConfigMaps struct {
// contains filtered or unexported fields
}
func (*ConfigMaps) Delete ¶ added in v1.0.0
func (c *ConfigMaps) Delete(name string) error
func (*ConfigMaps) Get ¶ added in v1.0.0
func (c *ConfigMaps) Get(name string) (*api.ConfigMap, error)
func (*ConfigMaps) List ¶ added in v1.0.0
func (c *ConfigMaps) List(opts api.ListOptions) (*api.ConfigMapList, error)
func (*ConfigMaps) Watch ¶ added in v1.0.0
func (c *ConfigMaps) Watch(opts api.ListOptions) (watch.Interface, error)
type ConfigMapsInterface ¶ added in v1.0.0
type ConfigMapsNamespacer ¶ added in v1.0.0
type ConfigMapsNamespacer interface {
ConfigMaps(namespace string) ConfigMapsInterface
}
type ContainerInfoGetter ¶
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 ContentConfig ¶ added in v1.0.0
type ContentConfig struct { // ContentType specifies the wire format used to communicate with the server. // This value will be set as the Accept header on requests made to the server, and // as the default content type on any object sent to the server. If not set, // "application/json" is used. ContentType string // GroupVersion 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. GroupVersion *unversioned.GroupVersion // 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 }
type DaemonSetInterface ¶
type DaemonSetInterface interface { List(opts api.ListOptions) (*extensions.DaemonSetList, error) Get(name string) (*extensions.DaemonSet, error) Create(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error) Update(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error) UpdateStatus(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error) Delete(name string) error Watch(opts api.ListOptions) (watch.Interface, error) }
type DaemonSetsNamespacer ¶
type DaemonSetsNamespacer interface {
DaemonSets(namespace string) DaemonSetInterface
}
DaemonsSetsNamespacer has methods to work with DaemonSet resources in a namespace
type DeploymentInterface ¶
type DeploymentInterface interface { List(opts api.ListOptions) (*extensions.DeploymentList, error) Get(name string) (*extensions.Deployment, error) Delete(name string, options *api.DeleteOptions) error Create(*extensions.Deployment) (*extensions.Deployment, error) Update(*extensions.Deployment) (*extensions.Deployment, error) UpdateStatus(*extensions.Deployment) (*extensions.Deployment, error) Watch(opts api.ListOptions) (watch.Interface, error) Rollback(*extensions.DeploymentRollback) error }
DeploymentInterface has methods to work with Deployment resources.
type DeploymentsNamespacer ¶
type DeploymentsNamespacer interface {
Deployments(namespace string) DeploymentInterface
}
DeploymentsNamespacer has methods to work with Deployment resources in a namespace
type DiscoveryClient ¶ added in v0.19.0
type DiscoveryClient struct {
*RESTClient
}
DiscoveryClient implements the functions that discover server-supported API groups, versions and resources.
func NewDiscoveryClient ¶ added in v0.19.0
func NewDiscoveryClient(c *RESTClient) *DiscoveryClient
New creates a new DiscoveryClient for the given RESTClient.
func NewDiscoveryClientForConfig ¶ added in v1.0.0
func NewDiscoveryClientForConfig(c *Config) (*DiscoveryClient, error)
NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. This client can be used to discover supported resources in the API server.
func NewDiscoveryClientForConfigOrDie ¶ added in v1.0.0
func NewDiscoveryClientForConfigOrDie(c *Config) *DiscoveryClient
NewDiscoveryClientForConfig creates a new DiscoveryClient for the given config. If there is an error, it panics.
func (*DiscoveryClient) ServerGroups ¶ added in v0.19.0
func (d *DiscoveryClient) ServerGroups() (apiGroupList *unversioned.APIGroupList, err error)
ServerGroups returns the supported groups, with information like supported versions and the preferred version.
func (*DiscoveryClient) ServerResources ¶ added in v0.19.0
func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResourceList, error)
ServerResources returns the supported resources for all groups and versions.
func (*DiscoveryClient) ServerResourcesForGroupVersion ¶ added in v0.19.0
func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (resources *unversioned.APIResourceList, err error)
ServerResourcesForGroupVersion returns the supported resources for a group and version.
func (*DiscoveryClient) ServerVersion ¶ added in v1.0.0
func (d *DiscoveryClient) ServerVersion() (*version.Info, error)
ServerVersion retrieves and parses the server's version (git version).
func (*DiscoveryClient) SwaggerSchema ¶ added in v1.0.0
func (d *DiscoveryClient) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error)
SwaggerSchema retrieves and parses the swagger API schema the server supports.
type DiscoveryInterface ¶ added in v0.19.0
type DiscoveryInterface interface { ServerGroupsInterface ServerResourcesInterface ServerVersionInterface SwaggerSchemaInterface }
DiscoveryInterface holds the methods that discover server-supported API groups, versions and resources.
type EndpointsInterface ¶
type EndpointsInterface interface { Create(endpoints *api.Endpoints) (*api.Endpoints, error) List(opts api.ListOptions) (*api.EndpointsList, error) Get(name string) (*api.Endpoints, error) Delete(name string) error Update(endpoints *api.Endpoints) (*api.Endpoints, error) Watch(opts api.ListOptions) (watch.Interface, error) }
EndpointsInterface has methods to work with Endpoints resources
type EndpointsNamespacer ¶
type EndpointsNamespacer interface {
Endpoints(namespace string) EndpointsInterface
}
EndpointsNamespacer has methods to work with Endpoints resources in a namespace
type EventInterface ¶
type EventInterface interface { Create(event *api.Event) (*api.Event, error) Update(event *api.Event) (*api.Event, error) Patch(event *api.Event, data []byte) (*api.Event, error) List(opts api.ListOptions) (*api.EventList, error) Get(name string) (*api.Event, error) Watch(opts api.ListOptions) (watch.Interface, error) // Search finds events about the specified object Search(objOrRef runtime.Object) (*api.EventList, error) Delete(name string) error // DeleteCollection deletes a collection of events. DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) 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 ¶
type EventNamespacer interface {
Events(namespace string) EventInterface
}
EventNamespacer can return an EventInterface for the given namespace.
type ExtensionsClient ¶ added in v0.19.0
type ExtensionsClient struct {
*RESTClient
}
ExtensionsClient is used to interact with experimental Kubernetes features. Features of Extensions group are not supported and may be changed or removed in incompatible ways at any time.
func NewExtensions ¶ added in v0.19.0
func NewExtensions(c *Config) (*ExtensionsClient, error)
NewExtensions creates a new ExtensionsClient for the given config. This client provides access to experimental Kubernetes features. Features of Extensions group are not supported and may be changed or removed in incompatible ways at any time.
func NewExtensionsOrDie ¶ added in v0.19.0
func NewExtensionsOrDie(c *Config) *ExtensionsClient
NewExtensionsOrDie creates a new ExtensionsClient for the given config and panics if there is an error in the config. Features of Extensions group are not supported and may be changed or removed in incompatible ways at any time.
func (*ExtensionsClient) DaemonSets ¶ added in v0.19.0
func (c *ExtensionsClient) DaemonSets(namespace string) DaemonSetInterface
func (*ExtensionsClient) Deployments ¶ added in v0.19.0
func (c *ExtensionsClient) Deployments(namespace string) DeploymentInterface
func (*ExtensionsClient) HorizontalPodAutoscalers ¶ added in v0.19.0
func (c *ExtensionsClient) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
func (*ExtensionsClient) Ingress ¶ added in v0.19.0
func (c *ExtensionsClient) Ingress(namespace string) IngressInterface
func (*ExtensionsClient) Jobs ¶ added in v0.19.0
func (c *ExtensionsClient) Jobs(namespace string) JobInterface
func (*ExtensionsClient) PodSecurityPolicies ¶ added in v1.0.0
func (c *ExtensionsClient) PodSecurityPolicies() PodSecurityPolicyInterface
func (*ExtensionsClient) ReplicaSets ¶ added in v1.0.0
func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface
func (*ExtensionsClient) Scales ¶ added in v0.19.0
func (c *ExtensionsClient) Scales(namespace string) ScaleInterface
func (*ExtensionsClient) ThirdPartyResources ¶ added in v1.0.0
func (c *ExtensionsClient) ThirdPartyResources(namespace string) ThirdPartyResourceInterface
type ExtensionsInterface ¶ added in v0.19.0
type ExtensionsInterface interface { HorizontalPodAutoscalersNamespacer ScaleNamespacer DaemonSetsNamespacer DeploymentsNamespacer JobsNamespacer IngressNamespacer ThirdPartyResourceNamespacer ReplicaSetsNamespacer PodSecurityPoliciesInterface }
Interface holds the experimental methods for clients of Kubernetes to allow mock testing. Features of Extensions group are not supported and may be changed or removed in incompatible ways at any time.
type FlagSet ¶
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 ¶
HTTPClient is an interface for testing a request object.
type HTTPContainerInfoGetter ¶
func (*HTTPContainerInfoGetter) GetContainerInfo ¶
func (self *HTTPContainerInfoGetter) GetContainerInfo(host, podID, containerID string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
func (*HTTPContainerInfoGetter) GetMachineInfo ¶
func (self *HTTPContainerInfoGetter) GetMachineInfo(host string) (*cadvisorapi.MachineInfo, error)
func (*HTTPContainerInfoGetter) GetRootInfo ¶
func (self *HTTPContainerInfoGetter) GetRootInfo(host string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error)
type HorizontalPodAutoscalerInterface ¶
type HorizontalPodAutoscalerInterface interface { List(opts api.ListOptions) (*extensions.HorizontalPodAutoscalerList, error) Get(name string) (*extensions.HorizontalPodAutoscaler, error) Delete(name string, options *api.DeleteOptions) error Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) UpdateStatus(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error) Watch(opts api.ListOptions) (watch.Interface, error) }
HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources.
type HorizontalPodAutoscalersNamespacer ¶
type HorizontalPodAutoscalersNamespacer interface {
HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface
}
HorizontalPodAutoscalersNamespacer has methods to work with HorizontalPodAutoscaler resources in a namespace
type IngressInterface ¶
type IngressInterface interface { List(opts api.ListOptions) (*extensions.IngressList, error) Get(name string) (*extensions.Ingress, error) Create(ingress *extensions.Ingress) (*extensions.Ingress, error) Update(ingress *extensions.Ingress) (*extensions.Ingress, error) Delete(name string, options *api.DeleteOptions) error Watch(opts api.ListOptions) (watch.Interface, error) UpdateStatus(ingress *extensions.Ingress) (*extensions.Ingress, error) }
IngressInterface exposes methods to work on Ingress resources.
type IngressNamespacer ¶
type IngressNamespacer interface {
Ingress(namespace string) IngressInterface
}
IngressNamespacer has methods to work with Ingress resources in a namespace
type Interface ¶
type Interface interface { PodsNamespacer PodTemplatesNamespacer ReplicationControllersNamespacer ServicesNamespacer EndpointsNamespacer NodesInterface EventNamespacer LimitRangesNamespacer ResourceQuotasNamespacer ServiceAccountsNamespacer SecretsNamespacer NamespacesInterface PersistentVolumesInterface PersistentVolumeClaimsNamespacer ComponentStatusesInterface ConfigMapsNamespacer Autoscaling() AutoscalingInterface Extensions() ExtensionsInterface Discovery() DiscoveryInterface }
Interface holds the methods for clients of Kubernetes, an interface to allow mock testing.
type JobInterface ¶
type JobInterface interface { List(opts api.ListOptions) (*extensions.JobList, error) Get(name string) (*extensions.Job, error) Create(job *extensions.Job) (*extensions.Job, error) Update(job *extensions.Job) (*extensions.Job, error) Delete(name string, options *api.DeleteOptions) error Watch(opts api.ListOptions) (watch.Interface, error) UpdateStatus(job *extensions.Job) (*extensions.Job, error) }
JobInterface exposes methods to work on Job resources.
type JobsNamespacer ¶
type JobsNamespacer interface {
Jobs(namespace string) JobInterface
}
JobsNamespacer has methods to work with Job resources in a namespace
type LimitRangeInterface ¶
type LimitRangeInterface interface { List(opts api.ListOptions) (*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(opts api.ListOptions) (watch.Interface, error) }
LimitRangeInterface has methods to work with LimitRange resources.
type LimitRangesNamespacer ¶
type LimitRangesNamespacer interface {
LimitRanges(namespace string) LimitRangeInterface
}
LimitRangesNamespacer has methods to work with LimitRange resources in a namespace
type NamespaceInterface ¶
type NamespaceInterface interface { Create(item *api.Namespace) (*api.Namespace, error) Get(name string) (result *api.Namespace, err error) List(opts api.ListOptions) (*api.NamespaceList, error) Delete(name string) error Update(item *api.Namespace) (*api.Namespace, error) Watch(opts api.ListOptions) (watch.Interface, error) Finalize(item *api.Namespace) (*api.Namespace, error) Status(item *api.Namespace) (*api.Namespace, error) }
type NamespacesInterface ¶
type NamespacesInterface interface {
Namespaces() NamespaceInterface
}
type NoBackoff ¶ added in v1.0.0
type NoBackoff struct { }
NoBackoff is a stub implementation, can be used for mocking or else as a default.
func (*NoBackoff) CalculateBackoff ¶ added in v1.0.0
type NodeInterface ¶
type NodeInterface interface { Get(name string) (result *api.Node, err error) Create(node *api.Node) (*api.Node, error) List(opts api.ListOptions) (*api.NodeList, error) Delete(name string) error Update(*api.Node) (*api.Node, error) UpdateStatus(*api.Node) (*api.Node, error) Watch(opts api.ListOptions) (watch.Interface, error) }
type NodesInterface ¶
type NodesInterface interface {
Nodes() NodeInterface
}
type PersistentVolumeClaimInterface ¶
type PersistentVolumeClaimInterface interface { List(opts api.ListOptions) (*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(opts api.ListOptions) (watch.Interface, error) }
PersistentVolumeClaimInterface has methods to work with PersistentVolumeClaim resources.
type PersistentVolumeClaimsNamespacer ¶
type PersistentVolumeClaimsNamespacer interface {
PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface
}
PersistentVolumeClaimsNamespacer has methods to work with PersistentVolumeClaim resources in a namespace
type PersistentVolumeInterface ¶
type PersistentVolumeInterface interface { List(opts api.ListOptions) (*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(opts api.ListOptions) (watch.Interface, error) }
PersistentVolumeInterface has methods to work with PersistentVolume resources.
type PersistentVolumesInterface ¶
type PersistentVolumesInterface interface {
PersistentVolumes() PersistentVolumeInterface
}
type PodInterface ¶
type PodInterface interface { List(opts api.ListOptions) (*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(opts api.ListOptions) (watch.Interface, error) Bind(binding *api.Binding) error UpdateStatus(pod *api.Pod) (*api.Pod, error) GetLogs(name string, opts *api.PodLogOptions) *Request }
PodInterface has methods to work with Pod resources.
type PodSecurityPoliciesInterface ¶ added in v1.0.0
type PodSecurityPoliciesInterface interface {
PodSecurityPolicies() PodSecurityPolicyInterface
}
type PodSecurityPolicyInterface ¶ added in v1.0.0
type PodSecurityPolicyInterface interface { Get(name string) (result *extensions.PodSecurityPolicy, err error) Create(scc *extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) List(opts api.ListOptions) (*extensions.PodSecurityPolicyList, error) Delete(name string) error Update(*extensions.PodSecurityPolicy) (*extensions.PodSecurityPolicy, error) Watch(opts api.ListOptions) (watch.Interface, error) }
type PodTemplateInterface ¶
type PodTemplateInterface interface { List(opts api.ListOptions) (*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(opts api.ListOptions) (watch.Interface, error) }
PodTemplateInterface has methods to work with PodTemplate resources.
type PodTemplatesNamespacer ¶
type PodTemplatesNamespacer interface {
PodTemplates(namespace string) PodTemplateInterface
}
PodTemplatesNamespacer has methods to work with PodTemplate resources in a namespace
type PodsNamespacer ¶
type PodsNamespacer interface {
Pods(namespace string) PodInterface
}
PodsNamespacer has methods to work with Pod resources in a namespace
type RESTClient ¶
type RESTClient struct { // TODO extract this into a wrapper interface via the RESTClient interface in kubectl. Throttle util.RateLimiter // Set specific behavior of the client. If not set http.DefaultClient will be used. Client *http.Client // 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 ¶
func NewRESTClient(baseURL *url.URL, versionedAPIPath string, config ContentConfig, maxQPS float32, maxBurst int, client *http.Client) *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 ¶
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 UnversionedRESTClientFor ¶ added in v0.19.0
func UnversionedRESTClientFor(config *Config) (*RESTClient, error)
UnversionedRESTClientFor is the same as RESTClientFor, except that it allows the config.Version to be empty.
func (*RESTClient) APIVersion ¶
func (c *RESTClient) APIVersion() unversioned.GroupVersion
APIVersion returns the APIVersion this RESTClient is expected to use.
func (*RESTClient) Delete ¶
func (c *RESTClient) Delete() *Request
Delete begins a DELETE request. Short for c.Verb("DELETE").
func (*RESTClient) Get ¶
func (c *RESTClient) Get() *Request
Get begins a GET request. Short for c.Verb("GET").
func (*RESTClient) Patch ¶
func (c *RESTClient) Patch(pt api.PatchType) *Request
Patch begins a PATCH request. Short for c.Verb("Patch").
func (*RESTClient) Post ¶
func (c *RESTClient) Post() *Request
Post begins a POST request. Short for c.Verb("POST").
func (*RESTClient) Put ¶
func (c *RESTClient) Put() *Request
Put begins a PUT request. Short for c.Verb("PUT").
func (*RESTClient) Verb ¶
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 ReplicaSetInterface ¶ added in v1.0.0
type ReplicaSetInterface interface { List(opts api.ListOptions) (*extensions.ReplicaSetList, error) Get(name string) (*extensions.ReplicaSet, error) Create(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error) Update(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error) UpdateStatus(ctrl *extensions.ReplicaSet) (*extensions.ReplicaSet, error) Delete(name string, options *api.DeleteOptions) error Watch(opts api.ListOptions) (watch.Interface, error) }
ReplicaSetInterface has methods to work with ReplicaSet resources.
type ReplicaSetsNamespacer ¶ added in v1.0.0
type ReplicaSetsNamespacer interface {
ReplicaSets(namespace string) ReplicaSetInterface
}
ReplicaSetsNamespacer has methods to work with ReplicaSet resources in a namespace
type ReplicationControllerInterface ¶
type ReplicationControllerInterface interface { List(opts api.ListOptions) (*api.ReplicationControllerList, error) Get(name string) (*api.ReplicationController, error) Create(ctrl *api.ReplicationController) (*api.ReplicationController, error) Update(ctrl *api.ReplicationController) (*api.ReplicationController, error) UpdateStatus(ctrl *api.ReplicationController) (*api.ReplicationController, error) Delete(name string) error Watch(opts api.ListOptions) (watch.Interface, error) }
ReplicationControllerInterface has methods to work with ReplicationController resources.
type ReplicationControllersNamespacer ¶
type ReplicationControllersNamespacer interface {
ReplicationControllers(namespace string) ReplicationControllerInterface
}
ReplicationControllersNamespacer has methods to work with ReplicationController resources in a namespace
type Request ¶
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 ¶
func NewRequest(client HTTPClient, verb string, baseURL *url.URL, versionedAPIPath string, content ContentConfig, backoff BackoffManager, throttle util.RateLimiter) *Request
NewRequest creates a new request helper object for accessing runtime.Objects on a server.
func (*Request) AbsPath ¶
AbsPath overwrites an existing path with the segments provided. Trailing slashes are preserved when a single segment is passed.
func (*Request) Body ¶
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, and set Content-Type header. If obj is a runtime.Object and nil, do nothing. Otherwise, set an error.
func (*Request) Do ¶
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) FieldsSelectorParam ¶
FieldsSelectorParam adds the given selector as a query parameter with the name paramName.
func (*Request) LabelsSelectorParam ¶
LabelsSelectorParam adds the given selector as a query parameter
func (*Request) Name ¶
Name sets the name of a resource to access (<resource>/[ns/<namespace>/]<name>)
func (*Request) Namespace ¶
Namespace applies the namespace scope to a request (<resource>/[ns/<namespace>/]<name>)
func (*Request) NamespaceIfScoped ¶
NamespaceIfScoped is a convenience function to set a namespace if scoped is true
func (*Request) Prefix ¶
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 ¶
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 ¶
Resource sets the resource to access (<resource>/[ns/<namespace>/]<name>)
func (*Request) Stream ¶
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 ¶
SubResource sets a sub-resource path which can be multiple segments segment after the resource name but before the suffix.
func (*Request) Suffix ¶
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 ¶
Timeout makes the request use the given duration as a timeout. Sets the "timeout" parameter.
func (*Request) VersionedParams ¶ added in v0.19.0
VersionedParams will take the provided object, serialize it to a map[string][]string using the implicit RESTClient API version and the default parameter codec, and then add those as parameters to the request. Use this to provide versioned query parameters from client libraries.
type RequestConstructionError ¶
type RequestConstructionError struct {
Err error
}
RequestConstructionError is returned when there's an error assembling a request.
func (*RequestConstructionError) Error ¶
func (r *RequestConstructionError) Error() string
Error returns a textual description of 'r'.
type ResourceQuotaInterface ¶
type ResourceQuotaInterface interface { List(opts api.ListOptions) (*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(opts api.ListOptions) (watch.Interface, error) }
ResourceQuotaInterface has methods to work with ResourceQuota resources.
type ResourceQuotasNamespacer ¶
type ResourceQuotasNamespacer interface {
ResourceQuotas(namespace string) ResourceQuotaInterface
}
ResourceQuotasNamespacer has methods to work with ResourceQuota resources in a namespace
type ResponseWrapper ¶
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 ¶
type Result struct {
// contains filtered or unexported fields
}
Result contains the result of calling Request.Do().
func (Result) 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) StatusCode ¶
StatusCode returns the HTTP status code of the request. (Only valid if no error was returned.)
func (Result) WasCreated ¶
WasCreated updates the provided bool pointer to whether the server returned 201 created or a different response.
type ScaleInterface ¶
type ScaleInterface interface { Get(string, string) (*extensions.Scale, error) Update(string, *extensions.Scale) (*extensions.Scale, error) }
ScaleInterface has methods to work with Scale (sub)resources.
type ScaleNamespacer ¶
type ScaleNamespacer interface {
Scales(namespace string) ScaleInterface
}
type SecretsInterface ¶
type SecretsInterface interface { Create(secret *api.Secret) (*api.Secret, error) Update(secret *api.Secret) (*api.Secret, error) Delete(name string) error List(opts api.ListOptions) (*api.SecretList, error) Get(name string) (*api.Secret, error) Watch(opts api.ListOptions) (watch.Interface, error) }
type SecretsNamespacer ¶
type SecretsNamespacer interface {
Secrets(namespace string) SecretsInterface
}
type ServerGroupsInterface ¶ added in v0.19.0
type ServerGroupsInterface interface { // ServerGroups returns the supported groups, with information like supported versions and the // preferred version. ServerGroups() (*unversioned.APIGroupList, error) }
ServerGroupsInterface has methods for obtaining supported groups on the API server
type ServerResourcesInterface ¶ added in v0.19.0
type ServerResourcesInterface interface { // ServerResourcesForGroupVersion returns the supported resources for a group and version. ServerResourcesForGroupVersion(groupVersion string) (*unversioned.APIResourceList, error) // ServerResources returns the supported resources for all groups and versions. ServerResources() (map[string]*unversioned.APIResourceList, error) }
ServerResourcesInterface has methods for obtaining supported resources on the API server
type ServerVersionInterface ¶ added in v1.0.0
type ServerVersionInterface interface { // ServerVersion retrieves and parses the server's version (git version). ServerVersion() (*version.Info, error) }
ServerVersionInterface has a method for retrieving the server's version.
type ServiceAccountsInterface ¶
type ServiceAccountsInterface interface { Create(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error) Update(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error) Delete(name string) error List(opts api.ListOptions) (*api.ServiceAccountList, error) Get(name string) (*api.ServiceAccount, error) Watch(opts api.ListOptions) (watch.Interface, error) }
type ServiceAccountsNamespacer ¶
type ServiceAccountsNamespacer interface {
ServiceAccounts(namespace string) ServiceAccountsInterface
}
type ServiceInterface ¶
type ServiceInterface interface { List(opts api.ListOptions) (*api.ServiceList, error) Get(name string) (*api.Service, error) Create(srv *api.Service) (*api.Service, error) Update(srv *api.Service) (*api.Service, error) UpdateStatus(srv *api.Service) (*api.Service, error) Delete(name string) error Watch(opts api.ListOptions) (watch.Interface, error) ProxyGet(scheme, name, port, path string, params map[string]string) ResponseWrapper }
ServiceInterface has methods to work with Service resources.
type ServicesNamespacer ¶
type ServicesNamespacer interface {
Services(namespace string) ServiceInterface
}
ServicesNamespacer has methods to work with Service resources in a namespace
type SwaggerSchemaInterface ¶
type SwaggerSchemaInterface interface { // SwaggerSchema retrieves and parses the swagger API schema the server supports. SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) }
SwaggerSchemaInterface has a method to retrieve the swagger schema.
type TLSClientConfig ¶
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 ThirdPartyResourceInterface ¶ added in v1.0.0
type ThirdPartyResourceInterface interface { List(opts api.ListOptions) (*extensions.ThirdPartyResourceList, error) Get(name string) (*extensions.ThirdPartyResource, error) Create(ctrl *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) Update(ctrl *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) UpdateStatus(ctrl *extensions.ThirdPartyResource) (*extensions.ThirdPartyResource, error) Delete(name string) error Watch(opts api.ListOptions) (watch.Interface, error) }
type ThirdPartyResourceNamespacer ¶ added in v1.0.0
type ThirdPartyResourceNamespacer interface {
ThirdPartyResources(namespace string) ThirdPartyResourceInterface
}
ThirdPartyResourceNamespacer has methods to work with ThirdPartyResource resources in a namespace
type URLBackoff ¶ added in v1.0.0
URLBackoff struct implements the semantics on top of Backoff which we need for URL specific exponential backoff.
func (*URLBackoff) CalculateBackoff ¶ added in v1.0.0
func (b *URLBackoff) CalculateBackoff(actualUrl *url.URL) time.Duration
CalculateBackoff takes a url and back's off exponentially, based on its knowledge of existing failures.
func (*URLBackoff) Disable ¶ added in v1.0.0
func (b *URLBackoff) Disable()
Disable makes the backoff trivial, i.e., sets it to zero. This might be used by tests which want to run 1000s of mock requests without slowing down.
func (*URLBackoff) UpdateBackoff ¶ added in v1.0.0
func (b *URLBackoff) UpdateBackoff(actualUrl *url.URL, err error, responseCode int)
UpdateBackoff updates backoff metadata
Source Files ¶
- autoscaling.go
- client.go
- componentstatuses.go
- conditions.go
- configmap.go
- containerinfo.go
- daemon_sets.go
- deployment.go
- discovery_client.go
- doc.go
- endpoints.go
- events.go
- extensions.go
- flags.go
- helper.go
- horizontalpodautoscaler.go
- import_known_versions.go
- ingress.go
- jobs.go
- limit_ranges.go
- namespaces.go
- nodes.go
- persistentvolumeclaim.go
- persistentvolumes.go
- pod_templates.go
- pods.go
- podsecuritypolicy.go
- replica_sets.go
- replication_controllers.go
- request.go
- resource_quotas.go
- restclient.go
- scale.go
- secrets.go
- service_accounts.go
- services.go
- thirdpartyresources.go
- transport.go
- urlbackoff.go
Directories ¶
Path | Synopsis |
---|---|
Package auth defines a file format for holding authentication information needed by clients of Kubernetes.
|
Package auth defines a file format for holding authentication information needed by clients of Kubernetes. |
Package 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.
|
Package 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. |