kubeapi

package
v4.2.4-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLabelToDeployment

func AddLabelToDeployment(clientset *kubernetes.Clientset, origDeployment *v1.Deployment, key, value, namespace string) error

func AddLabelToPod

func AddLabelToPod(clientset *kubernetes.Clientset, origPod *v1.Pod, key, value, namespace string) error

func CreateConfigMap

func CreateConfigMap(clientset *kubernetes.Clientset, configMap *v1.ConfigMap, namespace string) error

CreateConfigMap creates a ConfigMap

func CreateDeployment

func CreateDeployment(clientset *kubernetes.Clientset, deployment *v1.Deployment, namespace string) error

CreateDeployment creates a deployment

func CreateDeploymentV1

func CreateDeploymentV1(clientset *kubernetes.Clientset, deployment *v1.Deployment, namespace string) error

CreateDeployment creates a deployment

func CreateJob

func CreateJob(clientset *kubernetes.Clientset, job *v1batch.Job, namespace string) (string, error)

CreateJob deletes a backup job

func CreateNamespace

func CreateNamespace(clientset *kubernetes.Clientset, ns *v1.Namespace) error

CreateNamespace

func CreatePVC

func CreatePVC(clientset *kubernetes.Clientset, pvc *v1.PersistentVolumeClaim, namespace string) error

CreatePVC creates a PVC

func CreatePod

func CreatePod(clientset *kubernetes.Clientset, svc *v1.Pod, namespace string) (*v1.Pod, error)

CreatePod creates a Pod

func CreateRole

func CreateRole(clientset *kubernetes.Clientset, role *v1.Role, namespace string) error

CreateRole

func CreateRoleBinding

func CreateRoleBinding(clientset *kubernetes.Clientset, roleBinding *v1.RoleBinding, namespace string) error

CreateRoleBinding

func CreateSecret

func CreateSecret(clientset *kubernetes.Clientset, secret *v1.Secret, namespace string) error

CreateSecret

func CreateService

func CreateService(clientset *kubernetes.Clientset, svc *v1.Service, namespace string) (*v1.Service, error)

CreateService creates a Service

func CreateServiceAccount

func CreateServiceAccount(clientset *kubernetes.Clientset, sa *v1.ServiceAccount, namespace string) error

CreateServiceAccount

func Createpgbackup

func Createpgbackup(client *rest.RESTClient, backup *crv1.Pgbackup, namespace string) error

Createpgbackup creates a pgbackup

func Createpgcluster

func Createpgcluster(client *rest.RESTClient, cluster *crv1.Pgcluster, namespace string) error

Createpgcluster creates a pgcluster

func Createpgpolicy

func Createpgpolicy(client *rest.RESTClient, policy *crv1.Pgpolicy, namespace string) error

Createpgpolicy creates a pgpolicy

func Createpgreplica

func Createpgreplica(client *rest.RESTClient, replica *crv1.Pgreplica, namespace string) error

Createpgreplica creates a pgreplica

func Createpgtask

func Createpgtask(client *rest.RESTClient, task *crv1.Pgtask, namespace string) error

Createpgtask creates a pgtask

func DeleteAllpgbackup

func DeleteAllpgbackup(client *rest.RESTClient, namespace string) error

Deletepgbackups deletes all pgbackups

func DeleteConfigMap

func DeleteConfigMap(clientset *kubernetes.Clientset, name, namespace string) error

DeleteConfigMap deletes a ConfigMap by name

func DeleteConfigMaps

func DeleteConfigMaps(clientset *kubernetes.Clientset, selector, namespace string) error

DeleteConfigMaps deletes a ConfigMap by a selector

func DeleteDeployment

func DeleteDeployment(clientset *kubernetes.Clientset, name, namespace string) error

DeleteDeployment deletes a deployment

func DeleteJob

func DeleteJob(clientset *kubernetes.Clientset, jobName, namespace string) error

DeleteJob deletes a job

func DeleteJobs

func DeleteJobs(clientset *kubernetes.Clientset, selector, namespace string) error

DeleteJobs deletes all jobs that match a selector

func DeleteNamespace

func DeleteNamespace(clientset *kubernetes.Clientset, name string) error

DeleteNamespace

func DeletePVC

func DeletePVC(clientset *kubernetes.Clientset, name, namespace string) error

DeletePVC deletes a PVC by name

func DeletePVCs

func DeletePVCs(clientset *kubernetes.Clientset, selector, namespace string) error

DeletePVCs deletes all PVCs by selector

func DeletePod

func DeletePod(clientset *kubernetes.Clientset, name, namespace string) error

DeletePod deletes a Pod

func DeleteRole

func DeleteRole(clientset *kubernetes.Clientset, name, namespace string) error

DeleteRole

func DeleteRoleBinding

func DeleteRoleBinding(clientset *kubernetes.Clientset, name, namespace string) error

DeleteRoleBinding

func DeleteSecret

func DeleteSecret(clientset *kubernetes.Clientset, name, namespace string) error

DeleteSecret

func DeleteService

func DeleteService(clientset *kubernetes.Clientset, name, namespace string) error

DeleteService deletes a Service

func DeleteServiceAccount

func DeleteServiceAccount(clientset *kubernetes.Clientset, name, namespace string) error

DeleteServiceAccount

func Deletepgbackup

func Deletepgbackup(client *rest.RESTClient, name, namespace string) error

Deletepgbackup deletes pgbackup by name

func Deletepgcluster

func Deletepgcluster(client *rest.RESTClient, name, namespace string) error

Deletepgcluster deletes pgcluster by name

func Deletepgpolicy

func Deletepgpolicy(client *rest.RESTClient, name, namespace string) error

Deletepgpolicy deletes pgpolicy by name

func Deletepgreplica

func Deletepgreplica(client *rest.RESTClient, name, namespace string) error

Deletepgreplica deletes pgreplica by name

func Deletepgtask

func Deletepgtask(client *rest.RESTClient, name, namespace string) error

Deletepgtask deletes pgtask by name

func Deletepgtasks

func Deletepgtasks(client *rest.RESTClient, selector, namespace string) error

Deletepgtasks deletes pgtask by selector

func ExecToPodThroughAPI

func ExecToPodThroughAPI(config *rest.Config, clientset *kubernetes.Clientset, command []string, containerName, podName, namespace string, stdin io.Reader) (string, string, error)

ExecToPodThroughAPI uninterractively exec to the pod with the command specified. :param string command: list of the str which specify the command. :param string pod_name: Pod name :param string namespace: namespace of the Pod. :param io.Reader stdin: Standerd Input if necessary, otherwise `nil` :return: string: Output of the command. (STDOUT)

string: Errors. (STDERR)
 error: If any error has occurred otherwise `nil`

func GetAllNodes

func GetAllNodes(clientset *kubernetes.Clientset) (*v1.NodeList, error)

GetNodes gets a list of all Nodes

func GetAllStorageClasses

func GetAllStorageClasses(clientset *kubernetes.Clientset) (*v1.StorageClassList, error)

GetStorageClasses gets a list of StorageClasses

func GetConfigMap

func GetConfigMap(clientset *kubernetes.Clientset, name, namespace string) (*v1.ConfigMap, bool)

GetConfigMap gets a ConfigMap by name

func GetDeployment

func GetDeployment(clientset *kubernetes.Clientset, name, namespace string) (*v1.Deployment, bool, error)

GetDeployment gets a deployment by name

func GetDeployments

func GetDeployments(clientset *kubernetes.Clientset, selector, namespace string) (*v1.DeploymentList, error)

GetDeployments gets a list of deployments using a label selector

func GetJob

func GetJob(clientset *kubernetes.Clientset, name, namespace string) (*v1batch.Job, bool)

GetJob gets a Job by name

func GetJobs

func GetJobs(clientset *kubernetes.Clientset, selector, namespace string) (*v1batch.JobList, error)

GetJobs gets a list of jobs using a label selector

func GetLogs

func GetLogs(client *kubernetes.Clientset, logOpts v1.PodLogOptions, out io.Writer, podName, ns string) error

func GetNamespace

func GetNamespace(clientset *kubernetes.Clientset, name string) (*v1.Namespace, bool, error)

GetNamespace gets a Namespace by name

func GetNamespaces

func GetNamespaces(clientset *kubernetes.Clientset) (*v1.NamespaceList, error)

GetNamespaces gets a list of Namespaces

func GetNodes

func GetNodes(clientset *kubernetes.Clientset, selector, namespace string) (*v1.NodeList, error)

GetNodes gets a list of Nodes by selector

func GetPVC

func GetPVC(clientset *kubernetes.Clientset, name, namespace string) (*v1.PersistentVolumeClaim, bool, error)

GetPVC gets a PVC by name returns pvc, found=bool, error

func GetPVCs

func GetPVCs(clientset *kubernetes.Clientset, selector, namespace string) (*v1.PersistentVolumeClaimList, error)

GetPVCs gets a list of PVC by selector

func GetPod

func GetPod(clientset *kubernetes.Clientset, name, namespace string) (*v1.Pod, bool, error)

GetPod gets a Pod by name

func GetPods

func GetPods(clientset *kubernetes.Clientset, selector, namespace string) (*v1.PodList, error)

GetPods gets a list of Pods by selector

func GetPodsWithBothSelectors

func GetPodsWithBothSelectors(clientset *kubernetes.Clientset, selector, fieldselector, namespace string) (*v1.PodList, error)

GetPodsWithBothSelectors gets a list of Pods by selector and field selector

func GetRole

func GetRole(clientset *kubernetes.Clientset, name, namespace string) (*v1.Role, bool, error)

GetRole gets a Role by name

func GetRoleBinding

func GetRoleBinding(clientset *kubernetes.Clientset, name, namespace string) (*v1.RoleBinding, bool, error)

GetRoleBinding gets a RoleBinding by name

func GetSecret

func GetSecret(clientset *kubernetes.Clientset, name, namespace string) (*v1.Secret, bool, error)

GetSecret gets a Secrets by name

func GetSecrets

func GetSecrets(clientset *kubernetes.Clientset, selector, namespace string) (*v1.SecretList, error)

GetSecrets gets a list of Secrets by selector

func GetService

func GetService(clientset *kubernetes.Clientset, name, namespace string) (*v1.Service, bool, error)

GetService gets a Service by name

func GetServiceAccount

func GetServiceAccount(clientset *kubernetes.Clientset, name, namespace string) (*v1.ServiceAccount, bool, error)

GetServiceAccount gets a ServiceAccount by name

func GetServices

func GetServices(clientset *kubernetes.Clientset, selector, namespace string) (*v1.ServiceList, error)

GetServices gets a list of Services by selector

func GetStorageClass

func GetStorageClass(clientset *kubernetes.Clientset, name string) (*v1.StorageClass, bool)

GetStorageClass gets a single StorageClasse

func GetStorageClasses

func GetStorageClasses(clientset *kubernetes.Clientset, selector string) (*v1.StorageClassList, error)

GetStorageClasses gets a list of StorageClasses using a selector

func Getpgbackup

func Getpgbackup(client *rest.RESTClient, backup *crv1.Pgbackup, name, namespace string) (bool, error)

Getpgbackup gets a pgbackups by name

func Getpgbackups

func Getpgbackups(client *rest.RESTClient, backupList *crv1.PgbackupList, namespace string) error

Getpgbackups gets a list of pgbackups

func Getpgcluster

func Getpgcluster(client *rest.RESTClient, cluster *crv1.Pgcluster, name, namespace string) (bool, error)

Getpgcluster gets a pgcluster by name

func Getpgclusters

func Getpgclusters(client *rest.RESTClient, clusterList *crv1.PgclusterList, namespace string) error

Getpgclusters gets a list of pgclusters

func GetpgclustersBySelector

func GetpgclustersBySelector(client *rest.RESTClient, clusterList *crv1.PgclusterList, selector, namespace string) error

GetpgclustersBySelector gets a list of pgclusters by selector

func Getpgpolicies

func Getpgpolicies(client *rest.RESTClient, policyList *crv1.PgpolicyList, namespace string) error

Getpgpolicies gets a list of pgpolicies

func Getpgpolicy

func Getpgpolicy(client *rest.RESTClient, policy *crv1.Pgpolicy, name, namespace string) (bool, error)

Getpgpolicy gets a pgpolicies by name

func Getpgreplica

func Getpgreplica(client *rest.RESTClient, replica *crv1.Pgreplica, name, namespace string) (bool, error)

Getpgreplica gets a pgreplica by name

func Getpgreplicas

func Getpgreplicas(client *rest.RESTClient, replicaList *crv1.PgreplicaList, namespace string) error

Getpgreplicas gets a list of pgreplicas

func GetpgreplicasBySelector

func GetpgreplicasBySelector(client *rest.RESTClient, replicaList *crv1.PgreplicaList, selector, namespace string) error

GetpgreplicasBySelector gets a list of pgreplicas by selector

func Getpgtask

func Getpgtask(client *rest.RESTClient, task *crv1.Pgtask, name, namespace string) (bool, error)

Getpgtask gets a pgtask by name

func Getpgtasks

func Getpgtasks(client *rest.RESTClient, taskList *crv1.PgtaskList, namespace string) error

Getpgtasks gets a list of pgtasks

func GetpgtasksBySelector

func GetpgtasksBySelector(client *rest.RESTClient, taskList *crv1.PgtaskList, selector, namespace string) error

GetpgtasksBySelector gets a list of pgtasks by selector

func IsJobComplete

func IsJobComplete(client *kubernetes.Clientset, namespace string, job *v1batch.Job, timeout time.Duration) error

func IsJobDeleted

func IsJobDeleted(client *kubernetes.Clientset, namespace string, job *v1batch.Job, timeout time.Duration) error

func ListConfigMap

func ListConfigMap(clientset *kubernetes.Clientset, label, namespace string) (*v1.ConfigMapList, bool)

ListConfigMap lists ConfigMaps with a given selector

func MergePatchDeployment

func MergePatchDeployment(clientset *kubernetes.Clientset, origDeployment *v1.Deployment, newname, namespace string) error

MergePatchDeployment patches a deployment for failover only at this point

func NewClientConsideringFlag

func NewClientConsideringFlag(kubeconfig string) (*rest.Config, *kubernetes.Clientset, error)

NewClientConsideringFlag returns a Clientset and its underlying configuration. When kubeconfig is not empty, it must be a path to an existing kubeconfig file.

func NewControllerClientConsideringFlag

func NewControllerClientConsideringFlag(kubeconfig string) (*rest.Config, *kubernetes.Clientset, error)

NewControllerClientConsideringFlag returns a Clientset and its underlying configuration. The Clientset is configured with a higher than normal QPS and Burst limit. When kubeconfig is not empty, it must be a path to an existing kubeconfig file.

func PatchDeploymentStrategicMerge

func PatchDeploymentStrategicMerge(clientset *kubernetes.Clientset, deploymentName,
	namespace string, patch string) error

PatchDeploymentStrategicMerge is a helper function for performing a strategic merge patch to update a Deployment. The function is responsible for calling the patchDeployment function in order to perform the strategic merge, specifically ensuring that the proper patch type is set as required to perform a strategic merge.

func PatchReplicas

func PatchReplicas(clientset *kubernetes.Clientset, name, namespace, jsonpath string, patchvalue int) error

PatchDeployment patches a deployment

func PatchpgbackupBackupStatus

func PatchpgbackupBackupStatus(restclient *rest.RESTClient, status string, oldCrd *crv1.Pgbackup, namespace string) error

func PatchpgbackupStatus

func PatchpgbackupStatus(restclient *rest.RESTClient, state crv1.PgbackupState, message string, oldCrd *crv1.Pgbackup, namespace string) error

func PatchpgclusterStatus

func PatchpgclusterStatus(restclient *rest.RESTClient, state crv1.PgclusterState, message string, oldCrd *crv1.Pgcluster, namespace string) error

func PatchpgpolicyStatus

func PatchpgpolicyStatus(restclient *rest.RESTClient, state crv1.PgpolicyState, message string, oldCrd *crv1.Pgpolicy, namespace string) error

func PatchpgreplicaStatus

func PatchpgreplicaStatus(restclient *rest.RESTClient, state crv1.PgreplicaState, message string, oldCrd *crv1.Pgreplica, namespace string) error

func PatchpgtaskStatus

func PatchpgtaskStatus(restclient *rest.RESTClient, state crv1.PgtaskState, message string, oldCrd *crv1.Pgtask, namespace string) error

func PatchpgtaskWorkflowStatus

func PatchpgtaskWorkflowStatus(restclient *rest.RESTClient, oldCrd *crv1.Pgtask, namespace string) error

func UpdateConfigMap

func UpdateConfigMap(clientset *kubernetes.Clientset, configMap *v1.ConfigMap, namespace string) error

UpdateConfigMap updates a configMap by name

func UpdateDeployment

func UpdateDeployment(clientset *kubernetes.Clientset, deployment *v1.Deployment, namespace string) error

func UpdateNamespace

func UpdateNamespace(clientset *kubernetes.Clientset, ns *v1.Namespace) error

func UpdatePod

func UpdatePod(clientset *kubernetes.Clientset, pod *v1.Pod, namespace string) error

func UpdateRole

func UpdateRole(clientset *kubernetes.Clientset, sec *v1.Role, namespace string) error

func UpdateRoleBinding

func UpdateRoleBinding(clientset *kubernetes.Clientset, sec *v1.RoleBinding, namespace string) error

func UpdateSecret

func UpdateSecret(clientset *kubernetes.Clientset, sec *v1.Secret, namespace string) error

func UpdateService

func UpdateService(clientset *kubernetes.Clientset, svc *v1.Service, namespace string) error

func UpdateServiceAccount

func UpdateServiceAccount(clientset *kubernetes.Clientset, sec *v1.ServiceAccount, namespace string) error

func Updatepgbackup

func Updatepgbackup(client *rest.RESTClient, backup *crv1.Pgbackup, name, namespace string) error

func Updatepgcluster

func Updatepgcluster(client *rest.RESTClient, cluster *crv1.Pgcluster, name, namespace string) error

Updatepgcluster updates a pgcluster

func Updatepgpolicy

func Updatepgpolicy(client *rest.RESTClient, task *crv1.Pgpolicy, name, namespace string) error

Updatepgpolicy

func Updatepgreplica

func Updatepgreplica(client *rest.RESTClient, replica *crv1.Pgreplica, name, namespace string) error

Updatepgreplica updates a pgreplica

func Updatepgtask

func Updatepgtask(client *rest.RESTClient, task *crv1.Pgtask, name, namespace string) error

Updatepgtask updates a pgtask

Types

type GetEndpointRequest

type GetEndpointRequest struct {
	Clientset *kubernetes.Clientset // Kubernetes Clientset that interfaces with the Kubernetes cluster
	Name      string                // Name of the endpoint that is being queried
	Namespace string                // Namespace the endpoint being queried resides in
}

GetEndpointRequest is used for the GetEndpoint function, which includes the current Kubernetes request context, as well as the namespace / endpoint name being requested

type GetEndpointResponse

type GetEndpointResponse struct {
	Endpoint  *v1.Endpoints // Kubernetes Endpoint object that specifics about the endpoint
	Name      string        // Name of the endpoint
	Namespace string        // Namespace that the endpoint is in
}

GetEndpointResponse contains the results from a successful request to the endpoint API, including the Kubernetes Endpoint as well as the original request data

func GetEndpoint

func GetEndpoint(request *GetEndpointRequest) (*GetEndpointResponse, error)

GetEndpoint tries to find an individual endpoint in a namespace. Returns the endpoint object if it can be IsNotFound If no endpoint can be found, then an error is returned

type IntThingSpec

type IntThingSpec struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value int    `json:"value"`
}

Jump to

Keyboard shortcuts

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