kubeapi

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

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 20 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 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 FindOrAppendVolume

func FindOrAppendVolume(volumes *[]v1.Volume, name string) *v1.Volume

FindOrAppendVolume returns a pointer to the Volume in volumes named name. If no such Volume exists, it creates one with that name and returns it.

func FindOrAppendVolumeMount

func FindOrAppendVolumeMount(mounts *[]v1.VolumeMount, name string) *v1.VolumeMount

FindOrAppendVolumeMount returns a pointer to the VolumeMount in mounts named name. If no such VolumeMount exists, it creates one with that name and returns it.

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.

Types

type Client

type Client struct {
	*rest.Config
	*kubernetes.Clientset
	// contains filtered or unexported fields
}

Client provides methods for interacting with Kubernetes resources. It implements both kubernetes and crunchydata clientset Interfaces.

func NewClient

func NewClient() (*Client, error)

NewClient returns a kubernetes.Clientset and its underlying configuration.

func (*Client) CrunchydataV1

func (c *Client) CrunchydataV1() crunchydatav1.CrunchydataV1Interface

CrunchydataV1 retrieves the CrunchydataV1Client

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

type Interface

type Interface interface {
	kubernetes.Interface
	CrunchydataV1() crunchydatav1.CrunchydataV1Interface
}

type JSON6902

type JSON6902 []interface{}

JSON6902 represents a JSON Patch according to RFC 6902; the same as k8s.io/apimachinery/pkg/types.JSONPatchType.

func NewJSONPatch

func NewJSONPatch() *JSON6902

NewJSONPatch creates a new JSON Patch according to RFC 6902; the same as k8s.io/apimachinery/pkg/types.JSONPatchType.

func (*JSON6902) Add

func (patch *JSON6902) Add(path ...string) func(value interface{}) *JSON6902

Add appends an "add" operation to patch.

> The "add" operation performs one of the following functions, > depending upon what the target location references: > > o If the target location specifies an array index, a new value is > inserted into the array at the specified index. > > o If the target location specifies an object member that does not > already exist, a new member is added to the object. > > o If the target location specifies an object member that does exist, > that member's value is replaced.

func (JSON6902) Bytes

func (patch JSON6902) Bytes() ([]byte, error)

Bytes returns the JSON representation of patch.

func (*JSON6902) Remove

func (patch *JSON6902) Remove(path ...string) *JSON6902

Remove appends a "remove" operation to patch.

> The "remove" operation removes the value at the target location. > > The target location MUST exist for the operation to be successful.

func (*JSON6902) Replace

func (patch *JSON6902) Replace(path ...string) func(value interface{}) *JSON6902

Replace appends a "replace" operation to patch.

> The "replace" operation replaces the value at the target location > with a new value. > > The target location MUST exist for the operation to be successful.

type Merge7386

type Merge7386 map[string]interface{}

Merge7386 represents a JSON Merge Patch according to RFC 7386; the same as k8s.io/apimachinery/pkg/types.MergePatchType.

func NewMergePatch

func NewMergePatch() *Merge7386

NewMergePatch creates a new JSON Merge Patch according to RFC 7386; the same as k8s.io/apimachinery/pkg/types.MergePatchType.

func (*Merge7386) Add

func (patch *Merge7386) Add(path ...string) func(value interface{}) *Merge7386

Add modifies patch to indicate that the member at path should be added or replaced with value.

> If the provided merge patch contains members that do not appear > within the target, those members are added. If the target does > contain the member, the value is replaced. Null values in the merge > patch are given special meaning to indicate the removal of existing > values in the target.

func (Merge7386) Bytes

func (patch Merge7386) Bytes() ([]byte, error)

Bytes returns the JSON representation of patch.

func (*Merge7386) Remove

func (patch *Merge7386) Remove(path ...string) *Merge7386

Remove modifies patch to indicate that the member at path should be removed if it exists.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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