common

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CpuUsage    = "cpu/usage_rate"
	MemoryUsage = "memory/usage"
)
View Source
const (
	ResourceKindConfigMap               = "configmap"
	ResourceKindDaemonSet               = "daemonset"
	ResourceKindDeployment              = "deployment"
	ResourceKindEvent                   = "event"
	ResourceKindHorizontalPodAutoscaler = "horizontalpodautoscaler"
	ResourceKindIngress                 = "ingress"
	ResourceKindJob                     = "job"
	ResourceKindLimitRange              = "limitrange"
	ResourceKindNamespace               = "namespace"
	ResourceKindNode                    = "node"
	ResourceKindPersistentVolumeClaim   = "persistentvolumeclaim"
	ResourceKindPersistentVolume        = "persistentvolume"
	ResourceKindPod                     = "pod"
	ResourceKindReplicaSet              = "replicaset"
	ResourceKindReplicationController   = "replicationcontroller"
	ResourceKindResourceQuota           = "resourcequota"
	ResourceKindSecret                  = "secret"
	ResourceKindService                 = "service"
	ResourceKindStatefulSet             = "statefulset"
	ResourceKindThirdPartyResource      = "thirdpartyresource"
	ResourceKindStorageClass            = "storageclass"
	ResourceKindRbacRole                = "role"
	ResourceKindRbacClusterRole         = "clusterrole"
	ResourceKindRbacRoleBinding         = "rolebinding"
	ResourceKindRbacClusterRoleBinding  = "clusterrolebinding"
)

List of all resource kinds supported by the UI.

View Source
const (
	ClientTypeDefault           = "restclient"
	ClientTypeExtensionClient   = "extensionclient"
	ClientTypeAppsClient        = "appsclient"
	ClientTypeBatchClient       = "batchclient"
	ClientTypeAutoscalingClient = "autoscalingclient"
	ClientTypeStorageClient     = "storageclient"
)

List of client types supported by the UI.

Variables

This section is empty.

Functions

func EqualIgnoreHash added in v1.6.1

func EqualIgnoreHash(template1, template2 api.PodTemplateSpec) bool

EqualIgnoreHash returns true if two given podTemplateSpec are equal, ignoring the diff in value of Labels[pod-template-hash] We ignore pod-template-hash because the hash result would be different upon podTemplateSpec API changes (e.g. the addition of a new field will cause the hash code to change) Note that we assume input podTemplateSpecs contain non-empty labels

func FilterDeploymentPodsByOwnerReference added in v1.6.1

func FilterDeploymentPodsByOwnerReference(deployment extensions.Deployment,
	allRS []extensions.ReplicaSet, allPods []api.Pod) []api.Pod

FilterPodsByControllerResource returns a subset of pods controlled by given deployment.

func FilterNamespacedPodsByLabelSelector

func FilterNamespacedPodsByLabelSelector(pods []api.Pod, namespace string,
	labelSelector *v1.LabelSelector) []api.Pod

FilterNamespacedPodsByLabelSelector returns pods targeted by given resource label selector in given namespace.

func FilterNamespacedServicesBySelector added in v1.1.1

func FilterNamespacedServicesBySelector(services []api.Service, namespace string,
	resourceSelector map[string]string) []api.Service

FilterNamespacedServicesBySelector returns services targeted by given resource selector in given namespace.

func FilterPodsByOwnerReference added in v1.6.1

func FilterPodsByOwnerReference(namespace string, uid types.UID, allPods []api.Pod) []api.Pod

FilterPodsByControllerResource returns a subset of pods controlled by given controller resource, excluding deployments.

func FilterPodsBySelector

func FilterPodsBySelector(pods []api.Pod, resourceSelector map[string]string) []api.Pod

FilterPodsBySelector returns pods targeted by given resource selector.

func GetContainerImages

func GetContainerImages(podTemplate *api.PodSpec) []string

GetContainerImages returns container image strings from the given pod spec.

func GetNodeByName

func GetNodeByName(nodes []api.Node, nodeName string) *api.Node

GetNodeByName returns the node with the given name from the list

func IsLabelSelectorMatching

func IsLabelSelectorMatching(selector map[string]string,
	labelSelector *v1.LabelSelector) bool

IsLabelSelectorMatching returns true when a resource with the given selector targets the same Resources(or subset) that a tested object selector with the given selector.

func IsSelectorMatching

func IsSelectorMatching(labelSelector map[string]string,
	testedObjectLabels map[string]string) bool

IsSelectorMatching returns true when an object with the given selector targets the same Resources (or subset) that the tested object with the given selector.

func LocalizeError added in v1.6.1

func LocalizeError(err error) error

LocalizeError returns error code (string) that can be used by frontend to localize error message.

Types

type ClientType

type ClientType string

ClientType represents type of client that is used to perform generic operations on resources. Different resources belong to different client, i.e. Deployments belongs to extension client and StatefulSets to apps client.

type ClusterRoleBindingListChannel added in v1.6.1

type ClusterRoleBindingListChannel struct {
	List  chan *rbac.ClusterRoleBindingList
	Error chan error
}

ClusterRoleBindingListChannel is a list and error channels to ClusterRoleBindings.

func GetClusterRoleBindingListChannel added in v1.6.1

func GetClusterRoleBindingListChannel(client client.Interface,
	numReads int) ClusterRoleBindingListChannel

GetClusterRoleBindingListChannel returns a pair of channels to a ClusterRoleBinding list and errors that both must be read numReads times.

type ClusterRoleListChannel added in v1.6.1

type ClusterRoleListChannel struct {
	List  chan *rbac.ClusterRoleList
	Error chan error
}

ClusterRoleListChannel is a list and error channels to ClusterRoles.

func GetClusterRoleListChannel added in v1.6.1

func GetClusterRoleListChannel(client client.Interface, numReads int) ClusterRoleListChannel

GetClusterRoleListChannel returns a pair of channels to a ClusterRole list and errors that both must be read numReads times.

type Condition added in v1.5.0

type Condition struct {
	// Type of a condition.
	Type string `json:"type"`
	// Status of a condition.
	Status api.ConditionStatus `json:"status"`
	// Last probe time of a condition.
	LastProbeTime v1.Time `json:"lastProbeTime"`
	// Last transition time of a condition.
	LastTransitionTime v1.Time `json:"lastTransitionTime"`
	// Reason of a condition.
	Reason string `json:"reason"`
	// Message of a condition.
	Message string `json:"message"`
}

Condition represents a single condition of a pod or node.

type ConfigMapListChannel added in v1.1.1

type ConfigMapListChannel struct {
	List  chan *api.ConfigMapList
	Error chan error
}

ConfigMapListChannel is a list and error channels to ConfigMaps.

func GetConfigMapListChannel added in v1.1.1

func GetConfigMapListChannel(client client.Interface, nsQuery *NamespaceQuery,
	numReads int) ConfigMapListChannel

GetConfigMapListChannel returns a pair of channels to a ConfigMap list and errors that both must be read numReads times.

type DaemonSetListChannel

type DaemonSetListChannel struct {
	List  chan *extensions.DaemonSetList
	Error chan error
}

DaemonSetListChannel is a list and error channels to Nodes.

func GetDaemonSetListChannel

func GetDaemonSetListChannel(client client.Interface,
	nsQuery *NamespaceQuery, numReads int) DaemonSetListChannel

GetDaemonSetListChannel returns a pair of channels to a DaemonSet list and errors that both must be read numReads times.

type DeploymentListChannel

type DeploymentListChannel struct {
	List  chan *extensions.DeploymentList
	Error chan error
}

DeploymentListChannel is a list and error channels to Deployments.

func GetDeploymentListChannel

func GetDeploymentListChannel(client client.Interface,
	nsQuery *NamespaceQuery, numReads int) DeploymentListChannel

GetDeploymentListChannel returns a pair of channels to a Deployment list and errors that both must be read numReads times.

type Endpoint

type Endpoint struct {
	// Hostname, either as a domain name or IP address.
	Host string `json:"host"`

	// List of ports opened for this endpoint on the hostname.
	Ports []ServicePort `json:"ports"`
}

Endpoint describes an endpoint that is host and a list of available ports for that host.

func GetExternalEndpoints

func GetExternalEndpoints(service *api.Service) []Endpoint

GetExternalEndpoints returns endpoints that are externally reachable for a service.

func GetInternalEndpoint

func GetInternalEndpoint(serviceName, namespace string, ports []api.ServicePort) Endpoint

GetInternalEndpoint returns internal endpoint name for the given service properties, e.g., "my-service.namespace 80/TCP" or "my-service 53/TCP,53/UDP".

type Event

type Event struct {
	ObjectMeta ObjectMeta `json:"objectMeta"`
	TypeMeta   TypeMeta   `json:"typeMeta"`

	// A human-readable description of the status of related object.
	Message string `json:"message"`

	// Component from which the event is generated.
	SourceComponent string `json:"sourceComponent"`

	// Host name on which the event is generated.
	SourceHost string `json:"sourceHost"`

	// Reference to a piece of an object, which triggered an event. For example
	// "spec.containers{name}" refers to container within pod with given name, if no container
	// name is specified, for example "spec.containers[2]", then it refers to container with
	// index 2 in this pod.
	SubObject string `json:"object"`

	// The number of times this event has occurred.
	Count int32 `json:"count"`

	// The time at which the event was first recorded.
	FirstSeen v1.Time `json:"firstSeen"`

	// The time at which the most recent occurrence of this event was recorded.
	LastSeen v1.Time `json:"lastSeen"`

	// Short, machine understandable string that gives the reason
	// for this event being generated.
	Reason string `json:"reason"`

	// Event type (at the moment only normal and warning are supported).
	Type string `json:"type"`
}

Event is a single event representation.

type EventList

type EventList struct {
	ListMeta ListMeta `json:"listMeta"`

	// List of events from given namespace.
	Events []Event `json:"events"`
}

EventList is an events response structure.

type EventListChannel

type EventListChannel struct {
	List  chan *api.EventList
	Error chan error
}

EventListChannel is a list and error channels to Nodes.

func GetEventListChannel

func GetEventListChannel(client client.Interface,
	nsQuery *NamespaceQuery, numReads int) EventListChannel

GetEventListChannel returns a pair of channels to an Event list and errors that both must be read numReads times.

func GetEventListChannelWithOptions

func GetEventListChannelWithOptions(client client.Interface,
	nsQuery *NamespaceQuery, options metaV1.ListOptions, numReads int) EventListChannel

GetEventListChannelWithOptions is GetEventListChannel plus list options.

type HorizontalPodAutoscalerListChannel added in v1.5.0

type HorizontalPodAutoscalerListChannel struct {
	List  chan *autoscaling.HorizontalPodAutoscalerList
	Error chan error
}

HorizontalPodAutoscalerListChannel is a list and error channels.

func GetHorizontalPodAutoscalerListChannel added in v1.5.0

func GetHorizontalPodAutoscalerListChannel(client client.Interface, nsQuery *NamespaceQuery,
	numReads int) HorizontalPodAutoscalerListChannel

GetPodListMetricsChannel returns a pair of channels to MetricsByPod and errors that both must be read numReads times.

type IngressListChannel added in v1.4.0

type IngressListChannel struct {
	List  chan *extensions.IngressList
	Error chan error
}

IngressListChannel is a list and error channels to Ingresss.

func GetIngressListChannel added in v1.4.0

func GetIngressListChannel(client client.Interface, nsQuery *NamespaceQuery,
	numReads int) IngressListChannel

GetIngressListChannel returns a pair of channels to an Ingress list and errors that both must be read numReads times.

type JobListChannel

type JobListChannel struct {
	List  chan *batch.JobList
	Error chan error
}

JobListChannel is a list and error channels to Nodes.

func GetJobListChannel

func GetJobListChannel(client client.Interface,
	nsQuery *NamespaceQuery, numReads int) JobListChannel

GetJobListChannel returns a pair of channels to a Job list and errors that both must be read numReads times.

type LimitRangeListChannel added in v1.4.1

type LimitRangeListChannel struct {
	List  chan *api.LimitRangeList
	Error chan error
}

LimitRangeListChannel is a list and error channels to LimitRanges.

func GetLimitRangeListChannel added in v1.4.1

func GetLimitRangeListChannel(client client.Interface, nsQuery *NamespaceQuery,
	numReads int) LimitRangeListChannel

GetLimitRangeListChannel returns a pair of channels to a LimitRange list and errors that both must be read numReads times.

type ListMeta added in v1.1.1

type ListMeta struct {
	// Total number of items on the list. Used for pagination.
	TotalItems int `json:"totalItems"`
}

ListMeta describes list of objects, i.e. holds information about pagination options set for the list.

type MetricResult added in v1.1.1

type MetricResult struct {
	Timestamp time.Time `json:"timestamp"`
	Value     uint64    `json:"value"`
}

MetricResult is a some sample measurement of a non-negative, integer quantity (for example, memory usage in bytes observed at some moment)

type MetricsByPod added in v1.1.1

type MetricsByPod struct {
	// Metrics by namespace and name of a pod.
	MetricsMap map[string]map[string]PodMetrics `json:"metricsMap"`
}

MetricsByPod is a metrics map by pod name.

type NamespaceListChannel added in v1.4.0

type NamespaceListChannel struct {
	List  chan *api.NamespaceList
	Error chan error
}

NamespaceListChannel is a list and error channels to Namespaces.

func GetNamespaceListChannel added in v1.4.0

func GetNamespaceListChannel(client client.Interface, numReads int) NamespaceListChannel

GetNamespaceListChannel returns a pair of channels to a Namespace list and errors that both must be read numReads times.

type NamespaceQuery

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

NamespaceQuery is a query for namespaces of a list of objects. There's three cases:

  1. No namespace selected: this means "user namespaces" query, i.e., all except kube-system
  2. Single namespace selected: this allows for optimizations when querying backends
  3. More than one namespace selected: resources from all namespaces are queried and then filtered here.

func NewNamespaceQuery

func NewNamespaceQuery(namespaces []string) *NamespaceQuery

NewNamespaceQuery creates new query for given namespaces.

func NewSameNamespaceQuery

func NewSameNamespaceQuery(namespace string) *NamespaceQuery

NewSameNamespaceQuery creates new namespace query that queries single namespace.

func (*NamespaceQuery) Matches

func (n *NamespaceQuery) Matches(namespace string) bool

Matches returns true when the given namespace matches this query.

func (*NamespaceQuery) ToRequestParam

func (n *NamespaceQuery) ToRequestParam() string

ToRequestParam returns K8s API namespace query for list of objects from this namespaces. This is an optimization to query for single namespace if one was selected and for all namespaces otherwise.

type NodeListChannel

type NodeListChannel struct {
	List  chan *api.NodeList
	Error chan error
}

NodeListChannel is a list and error channels to Nodes.

func GetNodeListChannel

func GetNodeListChannel(client client.Interface, numReads int) NodeListChannel

GetNodeListChannel returns a pair of channels to a Node list and errors that both must be read numReads times.

type ObjectMeta

type ObjectMeta struct {
	// Name is unique within a namespace. Name is primarily intended for creation
	// idempotence and configuration definition.
	Name string `json:"name,omitempty"`

	// Namespace defines the space within which name must be unique. An empty namespace is
	// equivalent to the "default" namespace, but "default" is the canonical representation.
	// Not all objects are required to be scoped to a namespace - the value of this field for
	// those objects will be empty.
	Namespace string `json:"namespace,omitempty"`

	// Labels are key value pairs that may be used to scope and select individual resources.
	// Label keys are of the form:
	//     label-key ::= prefixed-name | name
	//     prefixed-name ::= prefix '/' name
	//     prefix ::= DNS_SUBDOMAIN
	//     name ::= DNS_LABEL
	// The prefix is optional.  If the prefix is not specified, the key is assumed to be private
	// to the user.  Other system components that wish to use labels must specify a prefix.
	Labels map[string]string `json:"labels,omitempty"`

	// Annotations are unstructured key value data stored with a resource that may be set by
	// external tooling. They are not queryable and should be preserved when modifying
	// objects.  Annotation keys have the same formatting restrictions as Label keys. See the
	// comments on Labels for details.
	Annotations map[string]string `json:"annotations,omitempty"`

	// CreationTimestamp is a timestamp representing the server time when this object was
	// created. It is not guaranteed to be set in happens-before order across separate operations.
	// Clients may not set this value. It is represented in RFC3339 form and is in UTC.
	CreationTimestamp v1.Time `json:"creationTimestamp,omitempty"`
}

ObjectMeta is metadata about an instance of a resource.

func NewObjectMeta

func NewObjectMeta(k8SObjectMeta metaV1.ObjectMeta) ObjectMeta

NewObjectMeta returns internal endpoint name for the given service properties, e.g., NewObjectMeta creates a new instance of ObjectMeta struct based on K8s object meta.

type PersistentVolumeClaimListChannel added in v1.4.0

type PersistentVolumeClaimListChannel struct {
	List  chan *api.PersistentVolumeClaimList
	Error chan error
}

PersistentVolumeClaimListChannel is a list and error channels to PersistentVolumeClaims.

func GetPersistentVolumeClaimListChannel added in v1.4.0

func GetPersistentVolumeClaimListChannel(client client.Interface, nsQuery *NamespaceQuery,
	numReads int) PersistentVolumeClaimListChannel

GetPersistentVolumeClaimListChannel returns a pair of channels to a PersistentVolumeClaim list and errors that both must be read numReads times.

type PersistentVolumeListChannel added in v1.1.1

type PersistentVolumeListChannel struct {
	List  chan *api.PersistentVolumeList
	Error chan error
}

PersistentVolumeListChannel is a list and error channels to PersistentVolumes.

func GetPersistentVolumeListChannel added in v1.1.1

func GetPersistentVolumeListChannel(client client.Interface,
	numReads int) PersistentVolumeListChannel

GetPersistentVolumeListChannel returns a pair of channels to a PersistentVolume list and errors that both must be read numReads times.

type PodInfo

type PodInfo struct {
	// Number of pods that are created.
	Current int32 `json:"current"`

	// Number of pods that are desired.
	Desired int32 `json:"desired"`

	// Number of pods that are currently running.
	Running int32 `json:"running"`

	// Number of pods that are currently waiting.
	Pending int32 `json:"pending"`

	// Number of pods that are failed.
	Failed int32 `json:"failed"`

	// Number of pods that are succeeded.
	Succeeded int32 `json:"succeeded"`

	// Unique warning messages related to pods in this resource.
	Warnings []Event `json:"warnings"`
}

PodInfo represents aggregate information about controller's pods.

func GetPodInfo

func GetPodInfo(current int32, desired int32, pods []api.Pod) PodInfo

GetPodInfo returns aggregate information about a group of pods.

type PodListChannel

type PodListChannel struct {
	List  chan *api.PodList
	Error chan error
}

PodListChannel is a list and error channels to Nodes.

func GetPodListChannel

func GetPodListChannel(client client.Interface,
	nsQuery *NamespaceQuery, numReads int) PodListChannel

GetPodListChannel returns a pair of channels to a Pod list and errors that both must be read numReads times.

func GetPodListChannelWithOptions

func GetPodListChannelWithOptions(client client.Interface, nsQuery *NamespaceQuery,
	options metaV1.ListOptions, numReads int) PodListChannel

GetPodListChannelWithOptions is GetPodListChannel plus listing options.

type PodMetrics added in v1.1.1

type PodMetrics struct {
	// Most recent measure of CPU usage on all cores in nanoseconds.
	CPUUsage *uint64 `json:"cpuUsage"`
	// Pod memory usage in bytes.
	MemoryUsage *uint64 `json:"memoryUsage"`
	// Timestamped samples of CPUUsage over some short period of history
	CPUUsageHistory []MetricResult `json:"cpuUsageHistory"`
	// Timestamped samples of pod memory usage over some short period of history
	MemoryUsageHistory []MetricResult `json:"memoryUsageHistory"`
}

PodMetrics is a structure representing pods metrics, contains information about CPU and memory usage.

type PodMetricsChannel added in v1.1.1

type PodMetricsChannel struct {
	MetricsByPod chan *MetricsByPod
	Error        chan error
}

PodMetricsChannel is a list and error channels to MetricsByPod.

func GetPodListMetricsChannel added in v1.1.1

func GetPodListMetricsChannel(heapsterClient kdClient.HeapsterClient, pods []api.Pod,
	numReads int) PodMetricsChannel

GetPodListMetricsChannel returns a pair of channels to MetricsByPod and errors that both must be read numReads times.

func GetPodMetricsChannel added in v1.1.1

func GetPodMetricsChannel(heapsterClient kdClient.HeapsterClient, name,
	namespace string) PodMetricsChannel

GetPodMetricsChannel returns a pair of channels to MetricsByPod and errors that both must be read 1 time.

type RESTClient

type RESTClient interface {
	Delete() *restclient.Request
	Put() *restclient.Request
	Get() *restclient.Request
}

RESTClient is an interface for REST operations used in this file.

type ReplicaSetListChannel

type ReplicaSetListChannel struct {
	List  chan *extensions.ReplicaSetList
	Error chan error
}

ReplicaSetListChannel is a list and error channels to Replica Sets.

func GetReplicaSetListChannel

func GetReplicaSetListChannel(client client.Interface,
	nsQuery *NamespaceQuery, numReads int) ReplicaSetListChannel

GetReplicaSetListChannel returns a pair of channels to a ReplicaSet list and errors that both must be read numReads times.

func GetReplicaSetListChannelWithOptions

func GetReplicaSetListChannelWithOptions(client client.Interface,
	nsQuery *NamespaceQuery, options metaV1.ListOptions, numReads int) ReplicaSetListChannel

GetReplicaSetListChannelWithOptions returns a pair of channels to a ReplicaSet list filtered by provided options and errors that both must be read numReads times.

type ReplicationControllerListChannel

type ReplicationControllerListChannel struct {
	List  chan *api.ReplicationControllerList
	Error chan error
}

ReplicationControllerListChannel is a list and error channels to Nodes.

func GetReplicationControllerListChannel

func GetReplicationControllerListChannel(client client.Interface,
	nsQuery *NamespaceQuery, numReads int) ReplicationControllerListChannel

GetReplicationControllerListChannel Returns a pair of channels to a Replication Controller list and errors that both must be read numReads times.

type ResourceChannels

type ResourceChannels struct {
	// List and error channels to Replication Controllers.
	ReplicationControllerList ReplicationControllerListChannel

	// List and error channels to Replica Sets.
	ReplicaSetList ReplicaSetListChannel

	// List and error channels to Deployments.
	DeploymentList DeploymentListChannel

	// List and error channels to Daemon Sets.
	DaemonSetList DaemonSetListChannel

	// List and error channels to Jobs.
	JobList JobListChannel

	// List and error channels to Services.
	ServiceList ServiceListChannel

	// List and error channels to Ingresses.
	IngressList IngressListChannel

	// List and error channels to Pods.
	PodList PodListChannel

	// List and error channels to Events.
	EventList EventListChannel

	// List and error channels to LimitRanges.
	LimitRangeList LimitRangeListChannel

	// List and error channels to Nodes.
	NodeList NodeListChannel

	// List and error channels to Namespaces.
	NamespaceList NamespaceListChannel

	// List and error channels to StatefulSets.
	StatefulSetList StatefulSetListChannel

	// List and error channels to ConfigMaps.
	ConfigMapList ConfigMapListChannel

	// List and error channels to Secrets.
	SecretList SecretListChannel

	// List and error channels to PodMetrics.
	PodMetrics PodMetricsChannel

	// List and error channels to PersistentVolumes
	PersistentVolumeList PersistentVolumeListChannel

	// List and error channels to PersistentVolumeClaims
	PersistentVolumeClaimList PersistentVolumeClaimListChannel

	// List and error channels to ResourceQuotas
	ResourceQuotaList ResourceQuotaListChannel

	// List and error channels to HorizontalPodAutoscalers
	HorizontalPodAutoscalerList HorizontalPodAutoscalerListChannel

	// List and error channels to ThirdPartyResources
	ThirdPartyResourceList ThirdPartyResourceListChannel

	// List and error channels to StorageClasses
	StorageClassList StorageClassListChannel

	// List and error channels to Roles
	RoleList RoleListChannel

	// List and error channels to ClusterRoles
	ClusterRoleList ClusterRoleListChannel

	// List and error channels to RoleBindings
	RoleBindingList RoleBindingListChannel

	// List and error channels to ClusterRoleBindings
	ClusterRoleBindingList ClusterRoleBindingListChannel
}

ResourceChannels struct holds channels to resource lists. Each list channel is paired with an error channel which *must* be read sequentially: first read the list channel and then the error channel.

This struct can be used when there are multiple clients that want to process, e.g., a list of pods. With this helper, the list can be read only once from the backend and distributed asynchronously to clients that need it.

When a channel is nil, it means that no resource list is available for getting.

Each channel pair can be read up to N times. N is specified upon creation of the channels.

type ResourceKind

type ResourceKind string

ResourceKind is an unique name for each resource. It can used for API discovery and generic code that does things based on the kind. For example, there may be a generic "deleter" that based on resource kind, name and namespace deletes it.

type ResourceQuotaListChannel added in v1.4.0

type ResourceQuotaListChannel struct {
	List  chan *api.ResourceQuotaList
	Error chan error
}

ResourceQuotaListChannel is a list and error channels to ResourceQuotas.

func GetResourceQuotaListChannel added in v1.4.0

func GetResourceQuotaListChannel(client client.Interface, nsQuery *NamespaceQuery,
	numReads int) ResourceQuotaListChannel

GetResourceQuotaListChannel returns a pair of channels to a ResourceQuota list and errors that both must be read numReads times.

type ResourceVerber

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

ResourceVerber is a struct responsible for doing common verb operations on resources, like DELETE, PUT, UPDATE.

func NewResourceVerber

func NewResourceVerber(client, extensionsClient, appsClient,
	batchClient, autoscalingClient, storageClient RESTClient) ResourceVerber

NewResourceVerber creates a new resource verber that uses the given client for performing operations.

func (*ResourceVerber) Delete

func (verber *ResourceVerber) Delete(kind string, namespaceSet bool, namespace string, name string) error

Delete deletes the resource of the given kind in the given namespace with the given name.

func (*ResourceVerber) Get

func (verber *ResourceVerber) Get(kind string, namespaceSet bool, namespace string, name string) (runtime.Object, error)

Get gets the resource of the given kind in the given namespace with the given name.

func (*ResourceVerber) Put

func (verber *ResourceVerber) Put(kind string, namespaceSet bool, namespace string, name string,
	object *runtime.Unknown) error

Put puts new resource version of the given kind in the given namespace with the given name.

type RoleBindingListChannel added in v1.6.1

type RoleBindingListChannel struct {
	List  chan *rbac.RoleBindingList
	Error chan error
}

RoleBindingListChannel is a list and error channels to RoleBindings.

func GetRoleBindingListChannel added in v1.6.1

func GetRoleBindingListChannel(client client.Interface, numReads int) RoleBindingListChannel

GetRoleBindingListChannel returns a pair of channels to a RoleBinding list for a namespace and errors that both must be read numReads times.

type RoleListChannel added in v1.6.1

type RoleListChannel struct {
	List  chan *rbac.RoleList
	Error chan error
}

RoleListChannel is a list and error channels to Roles.

func GetRoleListChannel added in v1.6.1

func GetRoleListChannel(client client.Interface, numReads int) RoleListChannel

GetRoleListChannel returns a pair of channels to a Role list for a namespace and errors that both must be read numReads times.

type SecretListChannel added in v1.4.0

type SecretListChannel struct {
	List  chan *api.SecretList
	Error chan error
}

SecretListChannel is a list and error channels to Secrets.

func GetSecretListChannel added in v1.4.0

func GetSecretListChannel(client client.Interface, nsQuery *NamespaceQuery,
	numReads int) SecretListChannel

GetSecretListChannel returns a pair of channels to a Secret list and errors that both must be read numReads times.

type ServiceListChannel

type ServiceListChannel struct {
	List  chan *api.ServiceList
	Error chan error
}

ServiceListChannel is a list and error channels to Services.

func GetServiceListChannel

func GetServiceListChannel(client client.Interface, nsQuery *NamespaceQuery,
	numReads int) ServiceListChannel

GetServiceListChannel returns a pair of channels to a Service list and errors that both must be read numReads times.

type ServicePort

type ServicePort struct {
	// Positive port number.
	Port int32 `json:"port"`

	// Protocol name, e.g., TCP or UDP.
	Protocol api.Protocol `json:"protocol"`

	// The port on each node on which service is exposed.
	NodePort int32 `json:"nodePort"`
}

ServicePort is a pair of port and protocol, e.g. a service endpoint.

func GetServicePorts

func GetServicePorts(apiPorts []api.ServicePort) []ServicePort

GetServicePorts returns human readable name for the given service ports list.

type StatefulSetListChannel added in v1.5.0

type StatefulSetListChannel struct {
	List  chan *apps.StatefulSetList
	Error chan error
}

StatefulSetListChannel is a list and error channels to Nodes.

func GetStatefulSetListChannel added in v1.5.0

func GetStatefulSetListChannel(client client.Interface,
	nsQuery *NamespaceQuery, numReads int) StatefulSetListChannel

GetStatefulSetListChannel returns a pair of channels to a StatefulSet list and errors that both must be read numReads times.

type StorageClassListChannel added in v1.6.0

type StorageClassListChannel struct {
	List  chan *storage.StorageClassList
	Error chan error
}

StorageClassListChannel is a list and error channels to storage classes.

func GetStorageClassListChannel added in v1.6.0

func GetStorageClassListChannel(client client.Interface, numReads int) StorageClassListChannel

GetStorageClassListChannel returns a pair of channels to a storage class list and errors that both must be read numReads times.

type ThirdPartyResourceListChannel added in v1.6.0

type ThirdPartyResourceListChannel struct {
	List  chan *extensions.ThirdPartyResourceList
	Error chan error
}

ThirdPartyResourceListChannel is a list and error channels to third party resources.

func GetThirdPartyResourceListChannel added in v1.6.0

func GetThirdPartyResourceListChannel(client client.Interface,
	numReads int) ThirdPartyResourceListChannel

GetThirdPartyResourceListChannel returns a pair of channels to a third party resource list and errors that both must be read numReads times.

type TypeMeta

type TypeMeta struct {
	// Kind is a string value representing the REST resource this object represents.
	// Servers may infer this from the endpoint the client submits requests to.
	// In smalllettercase.
	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
	Kind ResourceKind `json:"kind,omitempty"`
}

TypeMeta describes an individual object in an API response or request with strings representing the type of the object.

func NewTypeMeta

func NewTypeMeta(kind ResourceKind) TypeMeta

NewTypeMeta creates new type mete for the resource kind.

Jump to

Keyboard shortcuts

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