Documentation ¶
Index ¶
- func SetInstance(i Ops)
- type Client
- func (c *Client) AddLabelOnNode(name, key, value string) error
- func (c *Client) CordonNode(nodeName string, timeout, retryInterval time.Duration) error
- func (c *Client) CreateConfigMap(configMap *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (c *Client) CreateEndpoints(endpoints *corev1.Endpoints) (*corev1.Endpoints, error)
- func (c *Client) CreateEvent(event *corev1.Event) (*corev1.Event, error)
- func (c *Client) CreateLimitRange(limitrange *corev1.LimitRange) (*corev1.LimitRange, error)
- func (c *Client) CreateNamespace(namespace *corev1.Namespace) (*corev1.Namespace, error)
- func (c *Client) CreateNode(n *corev1.Node) (*corev1.Node, error)
- func (c *Client) CreatePersistentVolume(pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
- func (c *Client) CreatePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
- func (c *Client) CreatePod(pod *corev1.Pod) (*corev1.Pod, error)
- func (c *Client) CreateSecret(secret *corev1.Secret) (*corev1.Secret, error)
- func (c *Client) CreateService(service *corev1.Service) (*corev1.Service, error)
- func (c *Client) CreateServiceAccount(account *corev1.ServiceAccount) (*corev1.ServiceAccount, error)
- func (c *Client) DeleteConfigMap(name, namespace string) error
- func (c *Client) DeleteEndpoints(name, ns string) error
- func (c *Client) DeleteLimitRange(name, namespace string) error
- func (c *Client) DeleteNamespace(name string) error
- func (c *Client) DeleteNode(name string) error
- func (c *Client) DeletePersistentVolume(pvName string) error
- func (c *Client) DeletePersistentVolumeClaim(name, namespace string) error
- func (c *Client) DeletePod(name string, ns string, force bool) error
- func (c *Client) DeletePods(pods []corev1.Pod, force bool) error
- func (c *Client) DeleteSecret(name, namespace string) error
- func (c *Client) DeleteService(name, namespace string) error
- func (c *Client) DeleteServiceAccount(accountName, namespace string) error
- func (c *Client) DescribeService(svcName string, svcNamespace string) (*corev1.ServiceStatus, error)
- func (c *Client) DrainPodsFromNode(nodeName string, pods []corev1.Pod, timeout time.Duration, ...) error
- func (c *Client) FindMyNode() (*corev1.Node, error)
- func (c *Client) GetConfigMap(name string, namespace string) (*corev1.ConfigMap, error)
- func (c *Client) GetEndpoints(name, ns string) (*corev1.Endpoints, error)
- func (c *Client) GetLabelsOnNode(name string) (map[string]string, error)
- func (c *Client) GetLimitRange(name string, namespace string) (*corev1.LimitRange, error)
- func (c *Client) GetNamespace(name string) (*corev1.Namespace, error)
- func (c *Client) GetNodeByName(name string) (*corev1.Node, error)
- func (c *Client) GetNodes() (*corev1.NodeList, error)
- func (c *Client) GetPVCsUsingStorageClass(scName string) ([]corev1.PersistentVolumeClaim, error)
- func (c *Client) GetPersistentVolume(pvName string) (*corev1.PersistentVolume, error)
- func (c *Client) GetPersistentVolumeClaim(pvcName string, namespace string) (*corev1.PersistentVolumeClaim, error)
- func (c *Client) GetPersistentVolumeClaimParams(pvc *corev1.PersistentVolumeClaim) (map[string]string, error)
- func (c *Client) GetPersistentVolumeClaimStatus(pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaimStatus, error)
- func (c *Client) GetPersistentVolumeClaims(namespace string, labelSelector map[string]string) (*corev1.PersistentVolumeClaimList, error)
- func (c *Client) GetPersistentVolumes() (*corev1.PersistentVolumeList, error)
- func (c *Client) GetPodByName(podName string, namespace string) (*corev1.Pod, error)
- func (c *Client) GetPodByUID(uid types.UID, namespace string) (*corev1.Pod, error)
- func (c *Client) GetPods(namespace string, labelSelector map[string]string) (*corev1.PodList, error)
- func (c *Client) GetPodsByNode(nodeName, namespace string) (*corev1.PodList, error)
- func (c *Client) GetPodsByNodeAndLabels(nodeName, namespace string, labels map[string]string) (*corev1.PodList, error)
- func (c *Client) GetPodsByOwner(ownerUID types.UID, namespace string) ([]corev1.Pod, error)
- func (c *Client) GetPodsUsingPV(pvName string) ([]corev1.Pod, error)
- func (c *Client) GetPodsUsingPVByNodeName(pvName, nodeName string) ([]corev1.Pod, error)
- func (c *Client) GetPodsUsingPVC(pvcName, pvcNamespace string) ([]corev1.Pod, error)
- func (c *Client) GetPodsUsingPVCByNodeName(pvcName, pvcNamespace, nodeName string) ([]corev1.Pod, error)
- func (c *Client) GetPodsUsingVolumePlugin(plugin string) ([]corev1.Pod, error)
- func (c *Client) GetPodsUsingVolumePluginByNodeName(nodeName, plugin string) ([]corev1.Pod, error)
- func (c *Client) GetSecret(name string, namespace string) (*corev1.Secret, error)
- func (c *Client) GetService(svcName string, svcNS string) (*corev1.Service, error)
- func (c *Client) GetServiceAccount(name, namespace string) (*corev1.ServiceAccount, error)
- func (c *Client) GetServiceEndpoint(svcName, namespace string) (string, error)
- func (c *Client) GetStorageClassForPVC(pvc *corev1.PersistentVolumeClaim) (*storagev1.StorageClass, error)
- func (c *Client) GetStorageProvisionerForPVC(pvc *corev1.PersistentVolumeClaim) (string, error)
- func (c *Client) GetVersion() (*version.Info, error)
- func (c *Client) GetVolumeForPersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim) (string, error)
- func (c *Client) IsNodeMaster(node corev1.Node) bool
- func (c *Client) IsNodeReady(name string) error
- func (c *Client) IsPodBeingManaged(pod corev1.Pod) bool
- func (c *Client) IsPodReady(pod corev1.Pod) bool
- func (c *Client) IsPodRunning(pod corev1.Pod) bool
- func (c *Client) ListEvents(namespace string, opts metav1.ListOptions) (*corev1.EventList, error)
- func (c *Client) ListLimitRange(namespace string, opts metav1.ListOptions) (*corev1.LimitRangeList, error)
- func (c *Client) ListNamespaces(labelSelector map[string]string) (*corev1.NamespaceList, error)
- func (c *Client) ListServices(svcNamespace string, listOptions metav1.ListOptions) (*corev1.ServiceList, error)
- func (c *Client) PatchEndpoints(name, ns string, pt types.PatchType, jsonPatch []byte, subresources ...string) (*corev1.Endpoints, error)
- func (c *Client) PatchService(name, namespace string, jsonPatch []byte, subresources ...string) (*corev1.Service, error)
- func (c *Client) RecordEvent(source v1.EventSource, object runtime.Object, ...)
- func (c *Client) RemoveLabelOnNode(name, key string) error
- func (c *Client) ResourceExists(gvk schema.GroupVersionKind) (bool, error)
- func (c *Client) RunCommandInPod(cmds []string, podName, containerName, namespace string) (string, error)
- func (c *Client) SearchNodeByAddresses(addresses []string) (*corev1.Node, error)
- func (c *Client) SetConfig(cfg *rest.Config)
- func (c *Client) UnCordonNode(nodeName string, timeout, retryInterval time.Duration) error
- func (c *Client) UpdateConfigMap(configMap *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (c *Client) UpdateEndpoints(endpoints *corev1.Endpoints) (*corev1.Endpoints, error)
- func (c *Client) UpdateLimitRange(limitrange *corev1.LimitRange) (*corev1.LimitRange, error)
- func (c *Client) UpdateNamespace(namespace *corev1.Namespace) (*corev1.Namespace, error)
- func (c *Client) UpdateNode(n *corev1.Node) (*corev1.Node, error)
- func (c *Client) UpdatePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
- func (c *Client) UpdatePod(pod *corev1.Pod) (*corev1.Pod, error)
- func (c *Client) UpdateSecret(secret *corev1.Secret) (*corev1.Secret, error)
- func (c *Client) UpdateSecretData(name string, ns string, data map[string][]byte) (*corev1.Secret, error)
- func (c *Client) UpdateService(service *corev1.Service) (*corev1.Service, error)
- func (c *Client) UpdateServiceAccount(account *corev1.ServiceAccount) (*corev1.ServiceAccount, error)
- func (c *Client) ValidateDeletedService(svcName string, svcNS string) error
- func (c *Client) ValidatePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim, timeout, retryInterval time.Duration) error
- func (c *Client) ValidatePersistentVolumeClaimSize(pvc *corev1.PersistentVolumeClaim, expectedPVCSize int64, ...) error
- func (c *Client) ValidatePod(pod *corev1.Pod, timeout, retryInterval time.Duration) error
- func (c *Client) WaitForPodDeletion(uid types.UID, namespace string, timeout time.Duration) error
- func (c *Client) WatchConfigMap(configMap *corev1.ConfigMap, fn WatchFunc) error
- func (c *Client) WatchLimitRange(limitrange *corev1.LimitRange, fn WatchFunc) error
- func (c *Client) WatchNode(node *corev1.Node, watchNodeFn WatchFunc) error
- func (c *Client) WatchPods(namespace string, fn WatchFunc, listOptions metav1.ListOptions) error
- func (c *Client) WatchSecret(secret *v1.Secret, fn WatchFunc) error
- type ConfigMapOps
- type EndpointsOps
- type EventOps
- type LimitRangeOps
- type NamespaceOps
- type NodeOps
- type Ops
- type PersistentVolumeClaimOps
- type PodOps
- type RecorderOps
- type SecretOps
- type ServiceAccountOps
- type ServiceOps
- type WatchFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetInstance ¶
func SetInstance(i Ops)
SetInstance replaces the instance with the provided one. Should be used only for testing purposes.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper for kubernetes core client.
func NewForConfig ¶
NewForConfig builds a new client for the given config.
func (*Client) AddLabelOnNode ¶
AddLabelOnNode adds a label key=value on the given node
func (*Client) CordonNode ¶
CordonNode cordons the given node
func (*Client) CreateConfigMap ¶
CreateConfigMap creates a new config map object if it does not already exist.
func (*Client) CreateEndpoints ¶
CreateEndpoints creates a given endpoints.
func (*Client) CreateEvent ¶
CreateEvent puts an event into k8s etcd
func (*Client) CreateLimitRange ¶
func (c *Client) CreateLimitRange(limitrange *corev1.LimitRange) (*corev1.LimitRange, error)
CreateLimitRange creates the given limitrange
func (*Client) CreateNamespace ¶
CreateNamespace creates a namespace with given name and metadata
func (*Client) CreateNode ¶
CreateNode creates the given node
func (*Client) CreatePersistentVolume ¶
func (c *Client) CreatePersistentVolume(pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error)
CreatePersistentVolume creates the given PV
func (*Client) CreatePersistentVolumeClaim ¶
func (c *Client) CreatePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
CreatePersistentVolumeClaim creates the given persistent volume claim
func (*Client) CreateSecret ¶
CreateSecret creates the given secret
func (*Client) CreateService ¶
CreateService creates the given service
func (*Client) CreateServiceAccount ¶
func (c *Client) CreateServiceAccount(account *corev1.ServiceAccount) (*corev1.ServiceAccount, error)
CreateServiceAccount creates the given service account
func (*Client) DeleteConfigMap ¶
DeleteConfigMap deletes the given config map
func (*Client) DeleteEndpoints ¶
DeleteEndpoints retrieves endpoints for a given namespace/name.
func (*Client) DeleteLimitRange ¶
DeleteLimitRange deletes the given limitrange
func (*Client) DeleteNamespace ¶
DeleteNamespace deletes a namespace with given name
func (*Client) DeleteNode ¶
DeleteNode deletes a node
func (*Client) DeletePersistentVolume ¶
DeletePersistentVolume deletes the PV for given name
func (*Client) DeletePersistentVolumeClaim ¶
DeletePersistentVolumeClaim deletes the given persistent volume claim
func (*Client) DeletePods ¶
DeletePods deletes the given pods
func (*Client) DeleteSecret ¶
DeleteSecret deletes the given secret
func (*Client) DeleteService ¶
DeleteService deletes the given service
func (*Client) DeleteServiceAccount ¶
DeleteServiceAccount deletes the given service account
func (*Client) DescribeService ¶
func (c *Client) DescribeService(svcName string, svcNamespace string) (*corev1.ServiceStatus, error)
DescribeService gets the service status
func (*Client) DrainPodsFromNode ¶
func (c *Client) DrainPodsFromNode(nodeName string, pods []corev1.Pod, timeout time.Duration, retryInterval time.Duration) error
DrainPodsFromNode drains given pods from given node. If timeout is set to a non-zero value, it waits for timeout duration for each pod to get deleted
func (*Client) FindMyNode ¶
FindMyNode finds LOCAL Node in Kubernetes cluster.
func (*Client) GetConfigMap ¶
GetConfigMap gets the config map object for the given name and namespace
func (*Client) GetEndpoints ¶
GetEndpoints retrieves endpoints for a given namespace/name.
func (*Client) GetLabelsOnNode ¶
GetLabelsOnNode gets all the labels on the given node
func (*Client) GetLimitRange ¶
GetLimitRange gets the limitranges object given its name and namespace
func (*Client) GetNamespace ¶
GetNamespace returns a namespace object for given name
func (*Client) GetNodeByName ¶
GetNodeByName returns the k8s node given it's name
func (*Client) GetPVCsUsingStorageClass ¶
func (c *Client) GetPVCsUsingStorageClass(scName string) ([]corev1.PersistentVolumeClaim, error)
GetPVCsUsingStorageClass returns all PVCs that use the given storage class
func (*Client) GetPersistentVolume ¶
func (c *Client) GetPersistentVolume(pvName string) (*corev1.PersistentVolume, error)
GetPersistentVolume returns the PV for given name
func (*Client) GetPersistentVolumeClaim ¶
func (c *Client) GetPersistentVolumeClaim(pvcName string, namespace string) (*corev1.PersistentVolumeClaim, error)
GetPersistentVolumeClaim returns the PVC for given name and namespace
func (*Client) GetPersistentVolumeClaimParams ¶
func (c *Client) GetPersistentVolumeClaimParams(pvc *corev1.PersistentVolumeClaim) (map[string]string, error)
GetPersistentVolumeClaimParams fetches custom parameters for the given PVC
func (*Client) GetPersistentVolumeClaimStatus ¶
func (c *Client) GetPersistentVolumeClaimStatus(pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaimStatus, error)
GetPersistentVolumeClaimStatus returns the status of the given pvc
func (*Client) GetPersistentVolumeClaims ¶
func (c *Client) GetPersistentVolumeClaims(namespace string, labelSelector map[string]string) (*corev1.PersistentVolumeClaimList, error)
GetPersistentVolumeClaims returns all PVCs in given namespace and that match the optional labelSelector
func (*Client) GetPersistentVolumes ¶
func (c *Client) GetPersistentVolumes() (*corev1.PersistentVolumeList, error)
GetPersistentVolumes returns all PVs in cluster
func (*Client) GetPodByName ¶
GetPodByName returns pod for the given pod name and namespace
func (*Client) GetPodByUID ¶
GetPodByUID returns pod with the given UID, or error if nothing found
func (*Client) GetPods ¶
func (c *Client) GetPods(namespace string, labelSelector map[string]string) (*corev1.PodList, error)
GetPods returns pods for the given namespace
func (*Client) GetPodsByNode ¶
GetPodsByNode returns all pods in given namespace and given k8s node name.
If namespace is empty, it will return pods from all namespaces
func (*Client) GetPodsByNodeAndLabels ¶
func (c *Client) GetPodsByNodeAndLabels(nodeName, namespace string, labels map[string]string) (*corev1.PodList, error)
GetPodsByNodeAndLabels returns all pods in given namespace and given k8s node name for the given labels
If namespace is empty, it will return pods from all namespaces
func (*Client) GetPodsByOwner ¶
GetPodsByOwner returns pods for the given owner and namespace
func (*Client) GetPodsUsingPV ¶
GetPodsUsingPV returns all pods in cluster using given pv
func (*Client) GetPodsUsingPVByNodeName ¶
GetPodsUsingPVByNodeName returns all pods running on the node using the given pv
func (*Client) GetPodsUsingPVC ¶
GetPodsUsingPVC returns all pods in cluster using given pvc
func (*Client) GetPodsUsingPVCByNodeName ¶
func (c *Client) GetPodsUsingPVCByNodeName(pvcName, pvcNamespace, nodeName string) ([]corev1.Pod, error)
GetPodsUsingPVCByNodeName returns all pods running on the node using given pvc
func (*Client) GetPodsUsingVolumePlugin ¶
GetPodsUsingVolumePlugin returns all pods who use PVCs provided by the given volume plugin
func (*Client) GetPodsUsingVolumePluginByNodeName ¶
GetPodsUsingVolumePluginByNodeName returns all pods who use PVCs provided by the given volume plugin on the given node
func (*Client) GetService ¶
GetService gets the service by the name
func (*Client) GetServiceAccount ¶
func (c *Client) GetServiceAccount(name, namespace string) (*corev1.ServiceAccount, error)
GetServiceAccount gets the given service account
func (*Client) GetServiceEndpoint ¶
GetServiceEndpoint gets the externalIP if service is a LoadBalancer or ClusterIP otherwise
func (*Client) GetStorageClassForPVC ¶
func (c *Client) GetStorageClassForPVC(pvc *corev1.PersistentVolumeClaim) (*storagev1.StorageClass, error)
GetStorageClassForPVC returns the appropriate storage class object for a certain pvc
func (*Client) GetStorageProvisionerForPVC ¶
func (c *Client) GetStorageProvisionerForPVC(pvc *corev1.PersistentVolumeClaim) (string, error)
GetStorageProvisionerForPVC returns storage provisioner for given PVC if it exists
func (*Client) GetVersion ¶
GetVersion returns server version
func (*Client) GetVolumeForPersistentVolumeClaim ¶
func (c *Client) GetVolumeForPersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim) (string, error)
GetVolumeForPersistentVolumeClaim returns the volumeID for the given PVC
func (*Client) IsNodeMaster ¶
IsNodeMaster returns true if given node is a kubernetes master node
func (*Client) IsNodeReady ¶
IsNodeReady checks if node with given name is ready. Returns nil is ready.
func (*Client) IsPodBeingManaged ¶
IsPodBeingManaged returns true if the pod is being managed by a controller
func (*Client) IsPodReady ¶
IsPodReady checks if all containers in a pod are ready (passed readiness probe)
func (*Client) IsPodRunning ¶
IsPodRunning checks if all containers in a pod are in running state
func (*Client) ListEvents ¶
ListEvents retrieves all events registered with kubernetes
func (*Client) ListLimitRange ¶
func (c *Client) ListLimitRange(namespace string, opts metav1.ListOptions) (*corev1.LimitRangeList, error)
ListLimitRange creates the given limitrange
func (*Client) ListNamespaces ¶
ListNamespaces returns all the namespaces
func (*Client) ListServices ¶
func (c *Client) ListServices(svcNamespace string, listOptions metav1.ListOptions) (*corev1.ServiceList, error)
ListServices list services using filters or list all if options are empty
func (*Client) PatchEndpoints ¶
func (c *Client) PatchEndpoints(name, ns string, pt types.PatchType, jsonPatch []byte, subresources ...string) (*corev1.Endpoints, error)
PatchEndpoints applies a patch for a given endpoints.
func (*Client) PatchService ¶
func (c *Client) PatchService(name, namespace string, jsonPatch []byte, subresources ...string) (*corev1.Service, error)
PatchService patches the current service with the given json path
func (*Client) RecordEvent ¶
func (*Client) RemoveLabelOnNode ¶
RemoveLabelOnNode removes the label with key on given node
func (*Client) ResourceExists ¶
func (c *Client) ResourceExists(gvk schema.GroupVersionKind) (bool, error)
ResourceExists checks if resource already exists
func (*Client) RunCommandInPod ¶
func (c *Client) RunCommandInPod(cmds []string, podName, containerName, namespace string) (string, error)
RunCommandInPod runs given command in the given pod
func (*Client) SearchNodeByAddresses ¶
SearchNodeByAddresses searches the node based on the IP addresses, then it falls back to a search by hostname, and finally by the labels
func (*Client) UnCordonNode ¶
UnCordonNode uncordons the given node
func (*Client) UpdateConfigMap ¶
UpdateConfigMap updates the given config map object
func (*Client) UpdateEndpoints ¶
UpdateEndpoints updates the given endpoint.
func (*Client) UpdateLimitRange ¶
func (c *Client) UpdateLimitRange(limitrange *corev1.LimitRange) (*corev1.LimitRange, error)
UpdateLimitRange updates the given limitrange
func (*Client) UpdateNamespace ¶
UpdateNamespace updates a namespace with given metadata
func (*Client) UpdateNode ¶
UpdateNode updates the given node
func (*Client) UpdatePersistentVolumeClaim ¶
func (c *Client) UpdatePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error)
UpdatePersistentVolumeClaim updates an existing persistent volume claim
func (*Client) UpdateSecret ¶
UpdateSecret updates the given secret
func (*Client) UpdateSecretData ¶
func (c *Client) UpdateSecretData(name string, ns string, data map[string][]byte) (*corev1.Secret, error)
UpdateSecretData updates or creates a new secret with the given data
func (*Client) UpdateService ¶
UpdateService updates the given service
func (*Client) UpdateServiceAccount ¶
func (c *Client) UpdateServiceAccount(account *corev1.ServiceAccount) (*corev1.ServiceAccount, error)
UpdaeServiceAccount updates the given service account
func (*Client) ValidateDeletedService ¶
ValidateDeletedService validates if given service is deleted
func (*Client) ValidatePersistentVolumeClaim ¶
func (c *Client) ValidatePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim, timeout, retryInterval time.Duration) error
ValidatePersistentVolumeClaim validates the given pvc
func (*Client) ValidatePersistentVolumeClaimSize ¶
func (c *Client) ValidatePersistentVolumeClaimSize(pvc *corev1.PersistentVolumeClaim, expectedPVCSize int64, timeout, retryInterval time.Duration) error
ValidatePersistentVolumeClaimSize validates the given pvc size
func (*Client) ValidatePod ¶
ValidatePod validates the given pod if it's ready
func (*Client) WaitForPodDeletion ¶
WaitForPodDeletion waits for given timeout for given pod to be deleted
func (*Client) WatchConfigMap ¶
WatchConfigMap sets up a watcher that listens for changes on the config map
func (*Client) WatchLimitRange ¶
func (c *Client) WatchLimitRange(limitrange *corev1.LimitRange, fn WatchFunc) error
type ConfigMapOps ¶
type ConfigMapOps interface { // GetConfigMap gets the config map object for the given name and namespace GetConfigMap(name string, namespace string) (*corev1.ConfigMap, error) // CreateConfigMap creates a new config map object if it does not already exist. CreateConfigMap(configMap *corev1.ConfigMap) (*corev1.ConfigMap, error) // DeleteConfigMap deletes the given config map DeleteConfigMap(name, namespace string) error // UpdateConfigMap updates the given config map object UpdateConfigMap(configMap *corev1.ConfigMap) (*corev1.ConfigMap, error) // WatchConfigMap sets up a watcher that listens for changes on the config map WatchConfigMap(configMap *corev1.ConfigMap, fn WatchFunc) error }
ConfigMapOps is an interface to perform k8s ConfigMap operations
type EndpointsOps ¶
type EndpointsOps interface { // CreateEndpoints creates a given endpoints. CreateEndpoints(endpoints *corev1.Endpoints) (*corev1.Endpoints, error) // GetEndpoints retrieves endpoints for a given namespace/name. GetEndpoints(name, namespace string) (*corev1.Endpoints, error) // PatchEndpoints applies a patch for a given endpoints. PatchEndpoints(name, namespace string, pt types.PatchType, jsonPatch []byte, subresources ...string) (*corev1.Endpoints, error) // DeleteEndpoints removes endpoints for a given namespace/name. DeleteEndpoints(name, namespace string) error // UpdateEndpoints updates the given endpoint UpdateEndpoints(endpoints *corev1.Endpoints) (*corev1.Endpoints, error) }
EndpointsOps is an interface to deal with kubernetes endpoints.
type EventOps ¶
type EventOps interface { // CreateEvent puts an event into k8s etcd CreateEvent(event *corev1.Event) (*corev1.Event, error) // ListEvents retrieves all events registered with kubernetes ListEvents(namespace string, opts metav1.ListOptions) (*corev1.EventList, error) }
EventOps is an interface to put and get k8s events
type LimitRangeOps ¶
type LimitRangeOps interface { // GetLimitRange gets the limitranges object given its name and namespace GetLimitRange(name string, namespace string) (*corev1.LimitRange, error) // CreateLimitRange creates the given limitrange CreateLimitRange(*corev1.LimitRange) (*corev1.LimitRange, error) // ListLimitRange changes and callback fn ListLimitRange(string, metav1.ListOptions) (*corev1.LimitRangeList, error) // UpdateLimitRange updates the given limitrange UpdateLimitRange(*corev1.LimitRange) (*corev1.LimitRange, error) // DeleteLimitRange deletes the given limitrange DeleteLimitRange(name, namespace string) error // WatchLimitRange changes and callback fn WatchLimitRange(*corev1.LimitRange, WatchFunc) error }
LimitRangeOps is an interface to perform k8s LimitRange operations
type NamespaceOps ¶
type NamespaceOps interface { // ListNamespaces returns all the namespaces ListNamespaces(labelSelector map[string]string) (*corev1.NamespaceList, error) // GetNamespace returns a namespace object for given name GetNamespace(name string) (*corev1.Namespace, error) // CreateNamespace creates a namespace with given name and metadata CreateNamespace(*corev1.Namespace) (*corev1.Namespace, error) // UpdateNamespace update a namespace with given metadata UpdateNamespace(*corev1.Namespace) (*corev1.Namespace, error) // DeleteNamespace deletes a namespace with given name DeleteNamespace(name string) error }
NamespaceOps is an interface to perform namespace operations
type NodeOps ¶
type NodeOps interface { // CreateNode creates the given node CreateNode(n *corev1.Node) (*corev1.Node, error) // UpdateNode updates the given node UpdateNode(n *corev1.Node) (*corev1.Node, error) // GetNodes talks to the k8s api server and gets the nodes in the cluster GetNodes() (*corev1.NodeList, error) // GetNodeByName returns the k8s node given it's name GetNodeByName(string) (*corev1.Node, error) // SearchNodeByAddresses searches corresponding k8s node match any of the given address SearchNodeByAddresses(addresses []string) (*corev1.Node, error) // FindMyNode finds LOCAL Node in Kubernetes cluster FindMyNode() (*corev1.Node, error) // IsNodeReady checks if node with given name is ready. Returns nil is ready. IsNodeReady(string) error // IsNodeMaster returns true if given node is a kubernetes master node IsNodeMaster(corev1.Node) bool // GetLabelsOnNode gets all the labels on the given node GetLabelsOnNode(string) (map[string]string, error) // AddLabelOnNode adds a label key=value on the given node AddLabelOnNode(string, string, string) error // RemoveLabelOnNode removes the label with key on given node RemoveLabelOnNode(string, string) error // WatchNode sets up a watcher that listens for the changes on Node. WatchNode(node *corev1.Node, fn WatchFunc) error // CordonNode cordons the given node CordonNode(nodeName string, timeout, retryInterval time.Duration) error // UnCordonNode uncordons the given node UnCordonNode(nodeName string, timeout, retryInterval time.Duration) error // DrainPodsFromNode drains given pods from given node. If timeout is set to // a non-zero value, it waits for timeout duration for each pod to get deleted DrainPodsFromNode(nodeName string, pods []corev1.Pod, timeout, retryInterval time.Duration) error // DeleteNode deletes the given node DeleteNode(name string) error }
NodeOps is an interface to perform k8s node operations
type Ops ¶
type Ops interface { ConfigMapOps EndpointsOps EventOps RecorderOps NamespaceOps NodeOps PersistentVolumeClaimOps PodOps SecretOps ServiceOps ServiceAccountOps LimitRangeOps // SetConfig sets the config and resets the client SetConfig(config *rest.Config) // GetVersion gets the version from the kubernetes cluster GetVersion() (*version.Info, error) // ResourceExists returns true if given resource type exists in kubernetes API server ResourceExists(schema.GroupVersionKind) (bool, error) }
Ops is an interface to perform kubernetes related operations on the core resources.
func NewInstanceFromConfigFile ¶
NewInstanceFromConfigFile returns new instance of client by using given config file
type PersistentVolumeClaimOps ¶
type PersistentVolumeClaimOps interface { // CreatePersistentVolumeClaim creates the given persistent volume claim CreatePersistentVolumeClaim(*corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error) // UpdatePersistentVolumeClaim updates an existing persistent volume claim UpdatePersistentVolumeClaim(*corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaim, error) // DeletePersistentVolumeClaim deletes the given persistent volume claim DeletePersistentVolumeClaim(name, namespace string) error // ValidatePersistentVolumeClaim validates the given pvc ValidatePersistentVolumeClaim(vv *corev1.PersistentVolumeClaim, timeout, retryInterval time.Duration) error // ValidatePersistentVolumeClaimSize validates the given pvc size ValidatePersistentVolumeClaimSize(vv *corev1.PersistentVolumeClaim, expectedPVCSize int64, timeout, retryInterval time.Duration) error // GetPersistentVolumeClaim returns the PVC for given name and namespace GetPersistentVolumeClaim(pvcName string, namespace string) (*corev1.PersistentVolumeClaim, error) // GetPersistentVolumeClaims returns all PVCs in given namespace and that match the optional labelSelector GetPersistentVolumeClaims(namespace string, labelSelector map[string]string) (*corev1.PersistentVolumeClaimList, error) // CreatePersistentVolume creates the given PV CreatePersistentVolume(pv *corev1.PersistentVolume) (*corev1.PersistentVolume, error) // GetPersistentVolume returns the PV for given name GetPersistentVolume(pvName string) (*corev1.PersistentVolume, error) // DeletePersistentVolume deletes the PV for given name DeletePersistentVolume(pvName string) error // GetPersistentVolumes returns all PVs in cluster GetPersistentVolumes() (*corev1.PersistentVolumeList, error) // GetVolumeForPersistentVolumeClaim returns the volumeID for the given PVC GetVolumeForPersistentVolumeClaim(*corev1.PersistentVolumeClaim) (string, error) // GetPersistentVolumeClaimParams fetches custom parameters for the given PVC GetPersistentVolumeClaimParams(*corev1.PersistentVolumeClaim) (map[string]string, error) // GetPersistentVolumeClaimStatus returns the status of the given pvc GetPersistentVolumeClaimStatus(*corev1.PersistentVolumeClaim) (*corev1.PersistentVolumeClaimStatus, error) // GetPVCsUsingStorageClass returns all PVCs that use the given storage class GetPVCsUsingStorageClass(scName string) ([]corev1.PersistentVolumeClaim, error) // GetStorageProvisionerForPVC returns storage provisioner for given PVC if it exists GetStorageProvisionerForPVC(pvc *corev1.PersistentVolumeClaim) (string, error) // GetStorageClassForPVC returns the appropriate storage class object for a certain pvc GetStorageClassForPVC(pvc *corev1.PersistentVolumeClaim) (*storagev1.StorageClass, error) }
PersistentVolumeClaimOps is an interface to perform k8s PVC operations
type PodOps ¶
type PodOps interface { // CreatePod creates the given pod. CreatePod(pod *corev1.Pod) (*corev1.Pod, error) // UpdatePod updates the given pod UpdatePod(pod *corev1.Pod) (*corev1.Pod, error) // GetPods returns pods for the given namespace GetPods(string, map[string]string) (*corev1.PodList, error) // GetPodsByNode returns all pods in given namespace and given k8s node name. // If namespace is empty, it will return pods from all namespaces. GetPodsByNode(nodeName, namespace string) (*corev1.PodList, error) // GetPodsByNodeAndLabels returns all pods in given namespace and given k8s node name // with a given label selector. // If namespace is empty, it will return pods from all namespaces. GetPodsByNodeAndLabels(nodeName, namespace string, labelSelector map[string]string) (*corev1.PodList, error) // GetPodsByOwner returns pods for the given owner and namespace GetPodsByOwner(types.UID, string) ([]corev1.Pod, error) // GetPodsUsingPV returns all pods in cluster using given pv GetPodsUsingPV(pvName string) ([]corev1.Pod, error) // GetPodsUsingPVByNodeName returns all pods running on the node using the given pv GetPodsUsingPVByNodeName(pvName, nodeName string) ([]corev1.Pod, error) // GetPodsUsingPVC returns all pods in cluster using given pvc GetPodsUsingPVC(pvcName, pvcNamespace string) ([]corev1.Pod, error) // GetPodsUsingPVCByNodeName returns all pods running on the node using given pvc GetPodsUsingPVCByNodeName(pvcName, pvcNamespace, nodeName string) ([]corev1.Pod, error) // GetPodsUsingVolumePlugin returns all pods who use PVCs provided by the given volume plugin GetPodsUsingVolumePlugin(plugin string) ([]corev1.Pod, error) // GetPodsUsingVolumePluginByNodeName returns all pods who use PVCs provided by the given volume plugin on the given node GetPodsUsingVolumePluginByNodeName(nodeName, plugin string) ([]corev1.Pod, error) // GetPodByName returns pod for the given pod name and namespace GetPodByName(string, string) (*corev1.Pod, error) // GetPodByUID returns pod with the given UID, or error if nothing found GetPodByUID(types.UID, string) (*corev1.Pod, error) // DeletePod deletes the given pod DeletePod(string, string, bool) error // DeletePods deletes the given pods DeletePods([]corev1.Pod, bool) error // IsPodRunning checks if all containers in a pod are in running state IsPodRunning(corev1.Pod) bool // IsPodReady checks if all containers in a pod are ready (passed readiness probe) IsPodReady(corev1.Pod) bool // IsPodBeingManaged returns true if the pod is being managed by a controller IsPodBeingManaged(corev1.Pod) bool // WaitForPodDeletion waits for given timeout for given pod to be deleted WaitForPodDeletion(uid types.UID, namespace string, timeout time.Duration) error // RunCommandInPod runs given command in the given pod RunCommandInPod(cmds []string, podName, containerName, namespace string) (string, error) // ValidatePod validates the given pod if it's ready ValidatePod(pod *corev1.Pod, timeout, retryInterval time.Duration) error // WatchPods sets up a watcher that listens for the changes to pods in given namespace WatchPods(namespace string, fn WatchFunc, listOptions metav1.ListOptions) error }
PodOps is an interface to perform k8s pod operations
type RecorderOps ¶
type RecorderOps interface { // RecordEvent records an event into k8s using client-go's EventRecorder inteface // It takes the event source and the object on which the event is being raised. RecordEvent(source v1.EventSource, object runtime.Object, eventtype, reason, message string) }
RecorderOps is an interface to record k8s events
type SecretOps ¶
type SecretOps interface { // GetSecret gets the secrets object given its name and namespace GetSecret(name string, namespace string) (*corev1.Secret, error) // CreateSecret creates the given secret CreateSecret(*corev1.Secret) (*corev1.Secret, error) // UpdateSecret updates the given secret UpdateSecret(*corev1.Secret) (*corev1.Secret, error) // UpdateSecretData updates or creates a new secret with the given data UpdateSecretData(string, string, map[string][]byte) (*corev1.Secret, error) // DeleteSecret deletes the given secret DeleteSecret(name, namespace string) error // WatchSecret changes and callback fn WatchSecret(*corev1.Secret, WatchFunc) error }
SecretOps is an interface to perform k8s Secret operations
type ServiceAccountOps ¶
type ServiceAccountOps interface { // CreateServiceAccount creates the given service account CreateServiceAccount(account *corev1.ServiceAccount) (*corev1.ServiceAccount, error) // GetServiceAccount gets the given service account GetServiceAccount(name, namespace string) (*corev1.ServiceAccount, error) // UpdateServiceAccount updates the given service account UpdateServiceAccount(account *corev1.ServiceAccount) (*corev1.ServiceAccount, error) // DeleteServiceAccount deletes the given service account DeleteServiceAccount(accountName, namespace string) error }
ServiceAccountOps is an interface to perform operations on role resources.
type ServiceOps ¶
type ServiceOps interface { // GetService gets the service by the name GetService(string, string) (*corev1.Service, error) // ListServices list services using filters or list all if options are empty ListServices(string, metav1.ListOptions) (*corev1.ServiceList, error) // GetServiceEndpoint gets the externalIP if service is a LoadBalancer or ClusterIP otherwise GetServiceEndpoint(string, string) (string, error) // CreateService creates the given service CreateService(*corev1.Service) (*corev1.Service, error) // DeleteService deletes the given service DeleteService(name, namespace string) error // ValidateDeletedService validates if given service is deleted ValidateDeletedService(string, string) error // DescribeService gets the service status DescribeService(string, string) (*corev1.ServiceStatus, error) // PatchService patches the current service with the given json path PatchService(name, namespace string, jsonPatch []byte, subresources ...string) (*corev1.Service, error) // UpdateService updates the given service UpdateService(*corev1.Service) (*corev1.Service, error) }
ServiceOps is an interface to perform k8s service operations