kubeapi

package
v4.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLabelToDeployment

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

func AddLabelToPod

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

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 Createpgtask

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

Createpgtask creates a pgtask

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 ExecToPodThroughAPI

func ExecToPodThroughAPI(config *rest.Config, clientset kubernetes.Interface, 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 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 GetpgtasksBySelector

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

GetpgtasksBySelector gets a list of pgtasks by selector

func Int32

func Int32(i int32) *int32

Int32 returns a pointer to an int32.

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists returns true if the err indicates that a resource already exists.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if err indicates that a resource was not found.

func NewKubeClient

func NewKubeClient() (*rest.Config, *kubernetes.Clientset, error)

NewKubeClient returns a Clientset for interacting with Kubernetes resources, along with the REST config used to create the client

func NewPGOClient

func NewPGOClient() (*rest.Config, *rest.RESTClient, *clientset.Clientset, error)

NewPGOClient returns a Clientset and a REST client for interacting with PostgreSQL Operator resources, along with the REST config used to create the clients

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 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 ControllerClients

type ControllerClients struct {
	Config        *rest.Config
	Kubeclientset *kubernetes.Clientset
	PGOClientset  *clientset.Clientset
	PGORestclient *rest.RESTClient
}

ControllerClients stores the various clients needed by a controller

func NewControllerClients

func NewControllerClients() (*ControllerClients, error)

NewControllerClients returns a ControllerClients struct containing the various clients needed for a controller. This includes a Kubernetes Clientset, along with a PGO Clientset with its associated RESTClient and its underlying configuration. The Clientset is configured with a higher than normal QPS and Burst limit.

type GetEndpointRequest

type GetEndpointRequest struct {
	Clientset kubernetes.Interface // 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

Jump to

Keyboard shortcuts

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