Documentation ¶
Overview ¶
Package kubernetes provides utility functions and types to be used with code interacting with Kubernetes API.
Index ¶
- func BuildServiceEndpoint(address *v1.EndpointAddress, port *v1.EndpointPort) (*api.ServiceEndpoint, error)
- func BuildServiceInstance(serviceName string, pod *v1.Pod, address *v1.EndpointAddress, ...) (*api.ServiceInstance, error)
- func BuildServiceMetadata(annotations map[string]string) (json.RawMessage, error)
- func BuildServiceStatus(podStatus *v1.PodStatus) (string, error)
- func BuildServiceTags(labels map[string]string) ([]string, error)
- func InitThirdPartyResource(tprConfig *TPRConfig) error
- func NewClient(config Config) (kubernetes.Interface, error)
- func NewTPRClient(config Config, tprConfig *TPRConfig) (*rest.RESTClient, error)
- type AddFunc
- type Config
- type DeleteFunc
- type TPRConfig
- type UpdateFunc
- type Workqueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildServiceEndpoint ¶
func BuildServiceEndpoint(address *v1.EndpointAddress, port *v1.EndpointPort) (*api.ServiceEndpoint, error)
BuildServiceEndpoint builds an api.ServiceEndpoint from the given address and port Kubernetes objects.
func BuildServiceInstance ¶
func BuildServiceInstance(serviceName string, pod *v1.Pod, address *v1.EndpointAddress, port *v1.EndpointPort) (*api.ServiceInstance, error)
BuildServiceInstance builds an api.ServiceInstance from the given serviceName, pod, address and port.
func BuildServiceMetadata ¶
func BuildServiceMetadata(annotations map[string]string) (json.RawMessage, error)
BuildServiceMetadata builds a serialized JSON object from the given Kubernetes resource annotations.
func BuildServiceStatus ¶
BuildServiceStatus builds a service instance status string for the given pod.
func BuildServiceTags ¶
BuildServiceTags builds a slice of string tags from the given Kubernetes resource labels. Each label is converted into a "key=value" string.
func InitThirdPartyResource ¶
InitThirdPartyResource initialize third party resource if it does not exist
func NewClient ¶
func NewClient(config Config) (kubernetes.Interface, error)
NewClient creates a new Kubernetes client using the specified configuration. If no URL and Token are specified, then these values are attempted to be read from the service account (if running within a Kubernetes pod).
func NewTPRClient ¶
func NewTPRClient(config Config, tprConfig *TPRConfig) (*rest.RESTClient, error)
NewTPRClient creates a new Kubernetes client using the specified configuration for working with the specified ThirdPartyResource. If no URL and Token are specified, then these values are attempted to be read from the service account (if running within a Kubernetes pod).
Types ¶
type AddFunc ¶
type AddFunc func(obj interface{})
AddFunc is the ResourceEventHandler function called when a watched Kubernetes API object is added.
type DeleteFunc ¶
type DeleteFunc func(obj interface{})
DeleteFunc is the ResourceEventHandler function called when a watched Kubernetes API object is deleted.
type TPRConfig ¶
type TPRConfig struct { Name string GroupName string Version string Description string Type runtime.Object ListType runtime.Object }
TPRConfig stores configurable attributes of a Kubernetes ThirdPartyResource object.
type UpdateFunc ¶
type UpdateFunc func(oldObj, newObj interface{})
UpdateFunc is the ResourceEventHandler function called when a watched Kubernetes API object is updated.
type Workqueue ¶
type Workqueue struct {
// contains filtered or unexported fields
}
Workqueue enqueues and processes ResourceEventHandler callbacks from cache controllers.
func (*Workqueue) EnqueueingAddFunc ¶
EnqueueingAddFunc returns an AddFunc that enqueues the given AddFunc invocation.
func (*Workqueue) EnqueueingDeleteFunc ¶
func (wq *Workqueue) EnqueueingDeleteFunc(f DeleteFunc) DeleteFunc
EnqueueingDeleteFunc returns an DeleteFunc that enqueues the given DeleteFunc invocation.
func (*Workqueue) EnqueueingUpdateFunc ¶
func (wq *Workqueue) EnqueueingUpdateFunc(f UpdateFunc) UpdateFunc
EnqueueingUpdateFunc returns an UpdateFunc that enqueues the given UpdateFunc invocation. The wrapping UpdateFunc drops events in which the resource version of the old object is the same as the resource version of the new object (e.g., in case of a full cache resync).