k8s

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClusterRoleBinding

func NewClusterRoleBinding(name, namespace, serviceAccount string) *rbacv1.ClusterRoleBinding

func NewIngressClass added in v0.10.0

func NewIngressClass(name, controllerName string) *networkingv1.IngressClass

func NewSecret

func NewSecret(name, namespace string, data map[string][]byte) *corev1.Secret

func NewServiceAccount

func NewServiceAccount(name string) *corev1.ServiceAccount

func NewTLSSecret

func NewTLSSecret(name, namespace string, data map[string][]byte) *corev1.Secret

NewTLSSecret return a Secret of the type kubernetes.io/tls. Note that for this kind of Secret, both tls.key and tls.crt are required in data.

Types

type Client

type Client struct {
	Clientset        kubernetes.Interface
	DynamicClientset dynamic.Interface
	CiliumClientset  ciliumClientset.Interface
	Config           *rest.Config
	RawConfig        clientcmdapi.Config
	// contains filtered or unexported fields
}

func NewClient

func NewClient(contextName, kubeconfig string) (*Client, error)

func (*Client) AutodetectFlavor

func (c *Client) AutodetectFlavor(ctx context.Context) Flavor

func (*Client) CheckDeploymentStatus added in v0.8.3

func (c *Client) CheckDeploymentStatus(ctx context.Context, namespace, deployment string) error

func (*Client) CiliumLogs

func (c *Client) CiliumLogs(ctx context.Context, namespace, pod string, since time.Time, filter *regexp.Regexp) (string, error)

func (*Client) CiliumStatus

func (c *Client) CiliumStatus(ctx context.Context, namespace, pod string) (*models.StatusResponse, error)

func (*Client) ClusterName

func (c *Client) ClusterName() (name string)

ClusterName returns the name of the cluster the client is connected to

func (*Client) ContextName

func (c *Client) ContextName() (name string)

ContextName returns the name of the context the client is connected to

func (*Client) CopyFromPod added in v0.10.1

func (c *Client) CopyFromPod(ctx context.Context, namespace, pod, container string, srcFile, destFile string) error

CopyFromPod is to copy srcFile in a given pod to local destFile with defaultMaxTries.

func (*Client) CreateCiliumNetworkPolicy

func (c *Client) CreateCiliumNetworkPolicy(ctx context.Context, cnp *ciliumv2.CiliumNetworkPolicy, opts metav1.CreateOptions) (*ciliumv2.CiliumNetworkPolicy, error)

func (*Client) CreateClusterRole

func (c *Client) CreateClusterRole(ctx context.Context, role *rbacv1.ClusterRole, opts metav1.CreateOptions) (*rbacv1.ClusterRole, error)

func (*Client) CreateClusterRoleBinding

func (c *Client) CreateClusterRoleBinding(ctx context.Context, role *rbacv1.ClusterRoleBinding, opts metav1.CreateOptions) (*rbacv1.ClusterRoleBinding, error)

func (*Client) CreateConfigMap

func (c *Client) CreateConfigMap(ctx context.Context, namespace string, config *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error)

func (*Client) CreateDaemonSet

func (c *Client) CreateDaemonSet(ctx context.Context, namespace string, ds *appsv1.DaemonSet, opts metav1.CreateOptions) (*appsv1.DaemonSet, error)

func (*Client) CreateDeployment

func (c *Client) CreateDeployment(ctx context.Context, namespace string, deployment *appsv1.Deployment, opts metav1.CreateOptions) (*appsv1.Deployment, error)

func (*Client) CreateIngressClass added in v0.10.0

func (c *Client) CreateIngressClass(ctx context.Context, ingressClass *networkingv1.IngressClass, opts metav1.CreateOptions) (*networkingv1.IngressClass, error)

func (*Client) CreateNamespace

func (c *Client) CreateNamespace(ctx context.Context, namespace string, opts metav1.CreateOptions) (*corev1.Namespace, error)

func (*Client) CreateResourceQuota

func (c *Client) CreateResourceQuota(ctx context.Context, namespace string, rq *corev1.ResourceQuota, opts metav1.CreateOptions) (*corev1.ResourceQuota, error)

func (*Client) CreateSecret

func (c *Client) CreateSecret(ctx context.Context, namespace string, secret *corev1.Secret, opts metav1.CreateOptions) (*corev1.Secret, error)

func (*Client) CreateService

func (c *Client) CreateService(ctx context.Context, namespace string, service *corev1.Service, opts metav1.CreateOptions) (*corev1.Service, error)

func (*Client) CreateServiceAccount

func (c *Client) CreateServiceAccount(ctx context.Context, namespace string, account *corev1.ServiceAccount, opts metav1.CreateOptions) (*corev1.ServiceAccount, error)

func (*Client) DeleteCiliumClusterwideNetworkPolicy

func (c *Client) DeleteCiliumClusterwideNetworkPolicy(ctx context.Context, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteCiliumExternalWorkload

func (c *Client) DeleteCiliumExternalWorkload(ctx context.Context, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteCiliumNetworkPolicy

func (c *Client) DeleteCiliumNetworkPolicy(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteClusterRole

func (c *Client) DeleteClusterRole(ctx context.Context, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteClusterRoleBinding

func (c *Client) DeleteClusterRoleBinding(ctx context.Context, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteConfigMap

func (c *Client) DeleteConfigMap(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteDaemonSet

func (c *Client) DeleteDaemonSet(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteDeployment

func (c *Client) DeleteDeployment(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteIngressClass added in v0.10.0

func (c *Client) DeleteIngressClass(ctx context.Context, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteNamespace

func (c *Client) DeleteNamespace(ctx context.Context, namespace string, opts metav1.DeleteOptions) error

func (*Client) DeletePod

func (c *Client) DeletePod(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) DeletePodCollection

func (c *Client) DeletePodCollection(ctx context.Context, namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error

func (*Client) DeleteResourceQuota

func (c *Client) DeleteResourceQuota(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteSecret

func (c *Client) DeleteSecret(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteService

func (c *Client) DeleteService(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) DeleteServiceAccount

func (c *Client) DeleteServiceAccount(ctx context.Context, namespace, name string, opts metav1.DeleteOptions) error

func (*Client) ExecInPod

func (c *Client) ExecInPod(ctx context.Context, namespace, pod, container string, command []string) (bytes.Buffer, error)

func (*Client) ExecInPodWithStderr

func (c *Client) ExecInPodWithStderr(ctx context.Context, namespace, pod, container string, command []string) (bytes.Buffer, bytes.Buffer, error)

func (*Client) ExecInPodWithTTY added in v0.9.0

func (c *Client) ExecInPodWithTTY(ctx context.Context, namespace, pod, container string, command []string) (bytes.Buffer, error)

func (*Client) GetCiliumClusterwideNetworkPolicy

func (c *Client) GetCiliumClusterwideNetworkPolicy(ctx context.Context, name string, opts metav1.GetOptions) (*ciliumv2.CiliumClusterwideNetworkPolicy, error)

func (*Client) GetCiliumEndpoint

func (c *Client) GetCiliumEndpoint(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*ciliumv2.CiliumEndpoint, error)

func (*Client) GetCiliumExternalWorkload

func (c *Client) GetCiliumExternalWorkload(ctx context.Context, name string, opts metav1.GetOptions) (*ciliumv2.CiliumExternalWorkload, error)

func (*Client) GetCiliumNetworkPolicy

func (c *Client) GetCiliumNetworkPolicy(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*ciliumv2.CiliumNetworkPolicy, error)

func (*Client) GetConfigMap

func (c *Client) GetConfigMap(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*corev1.ConfigMap, error)

func (*Client) GetDaemonSet

func (c *Client) GetDaemonSet(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*appsv1.DaemonSet, error)

func (*Client) GetDeployment

func (c *Client) GetDeployment(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*appsv1.Deployment, error)

func (*Client) GetLogs

func (c *Client) GetLogs(ctx context.Context, namespace, name, container string, sinceTime time.Time, limitBytes int64, previous bool) (string, error)

func (*Client) GetNamespace

func (c *Client) GetNamespace(ctx context.Context, namespace string, options metav1.GetOptions) (*corev1.Namespace, error)

func (*Client) GetPlatform added in v0.9.3

func (c *Client) GetPlatform(ctx context.Context) (*Platform, error)

func (*Client) GetPodsTable

func (c *Client) GetPodsTable(ctx context.Context) (*metav1.Table, error)

func (*Client) GetRunningCiliumVersion added in v0.8.4

func (c *Client) GetRunningCiliumVersion(ctx context.Context, namespace string) (string, error)

func (*Client) GetSecret

func (c *Client) GetSecret(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*corev1.Secret, error)

func (*Client) GetService

func (c *Client) GetService(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*corev1.Service, error)

func (*Client) GetVersion

func (c *Client) GetVersion(_ context.Context) (string, error)

func (*Client) ListCiliumClusterwideNetworkPolicies

func (c *Client) ListCiliumClusterwideNetworkPolicies(ctx context.Context, opts metav1.ListOptions) (*ciliumv2.CiliumClusterwideNetworkPolicyList, error)

func (*Client) ListCiliumEgressNATPolicies added in v0.9.1

func (c *Client) ListCiliumEgressNATPolicies(ctx context.Context, opts metav1.ListOptions) (*ciliumv2alpha1.CiliumEgressNATPolicyList, error)

func (*Client) ListCiliumEndpoints

func (c *Client) ListCiliumEndpoints(ctx context.Context, namespace string, options metav1.ListOptions) (*ciliumv2.CiliumEndpointList, error)

func (*Client) ListCiliumExternalWorkloads

func (c *Client) ListCiliumExternalWorkloads(ctx context.Context, opts metav1.ListOptions) (*ciliumv2.CiliumExternalWorkloadList, error)

func (*Client) ListCiliumIdentities

func (c *Client) ListCiliumIdentities(ctx context.Context) (*ciliumv2.CiliumIdentityList, error)

func (*Client) ListCiliumLocalRedirectPolicies added in v0.9.1

func (c *Client) ListCiliumLocalRedirectPolicies(ctx context.Context, namespace string, opts metav1.ListOptions) (*ciliumv2.CiliumLocalRedirectPolicyList, error)

func (*Client) ListCiliumNetworkPolicies

func (c *Client) ListCiliumNetworkPolicies(ctx context.Context, namespace string, opts metav1.ListOptions) (*ciliumv2.CiliumNetworkPolicyList, error)

func (*Client) ListCiliumNodes

func (c *Client) ListCiliumNodes(ctx context.Context) (*ciliumv2.CiliumNodeList, error)

func (*Client) ListDaemonSet added in v0.10.1

func (c *Client) ListDaemonSet(ctx context.Context, namespace string, o metav1.ListOptions) (*appsv1.DaemonSetList, error)

func (*Client) ListEndpoints added in v0.10.5

func (c *Client) ListEndpoints(ctx context.Context, o metav1.ListOptions) (*corev1.EndpointsList, error)

func (*Client) ListEvents

func (c *Client) ListEvents(ctx context.Context, o metav1.ListOptions) (*corev1.EventList, error)

func (*Client) ListNamespaces

func (c *Client) ListNamespaces(ctx context.Context, o metav1.ListOptions) (*corev1.NamespaceList, error)

func (*Client) ListNetworkPolicies

func (c *Client) ListNetworkPolicies(ctx context.Context, o metav1.ListOptions) (*networkingv1.NetworkPolicyList, error)

func (*Client) ListNodes

func (c *Client) ListNodes(ctx context.Context, options metav1.ListOptions) (*corev1.NodeList, error)

func (*Client) ListPods

func (c *Client) ListPods(ctx context.Context, namespace string, options metav1.ListOptions) (*corev1.PodList, error)

func (*Client) ListServices

func (c *Client) ListServices(ctx context.Context, namespace string, options metav1.ListOptions) (*corev1.ServiceList, error)

func (*Client) ListUnstructured added in v0.8.3

func (c *Client) ListUnstructured(ctx context.Context, gvr schema.GroupVersionResource, namespace *string, o metav1.ListOptions) (*unstructured.UnstructuredList, error)

func (*Client) PatchConfigMap

func (c *Client) PatchConfigMap(ctx context.Context, namespace, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*corev1.ConfigMap, error)

func (*Client) PatchDaemonSet

func (c *Client) PatchDaemonSet(ctx context.Context, namespace, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*appsv1.DaemonSet, error)

func (*Client) PatchDeployment

func (c *Client) PatchDeployment(ctx context.Context, namespace, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*appsv1.Deployment, error)

func (*Client) PatchSecret

func (c *Client) PatchSecret(ctx context.Context, namespace, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (*corev1.Secret, error)

func (*Client) PodLogs

func (c *Client) PodLogs(namespace, name string, opts *corev1.PodLogOptions) *rest.Request

func (*Client) UpdateCiliumNetworkPolicy

func (c *Client) UpdateCiliumNetworkPolicy(ctx context.Context, cnp *ciliumv2.CiliumNetworkPolicy, opts metav1.UpdateOptions) (*ciliumv2.CiliumNetworkPolicy, error)

type CopyOptions added in v0.10.1

type CopyOptions struct {
	// Maximum number of retries, -1 for unlimited retries.
	MaxTries int

	// ReaderFunc is the actual implementation for reading file content
	ReadFunc ReadFunc
}

CopyOptions have the data required to perform the copy operation

type CopyPipe added in v0.10.1

type CopyPipe struct {
	Options *CopyOptions

	Reader *io.PipeReader
	Writer *io.PipeWriter
	// contains filtered or unexported fields
}

CopyPipe struct is simple implementation to support copy files with retry.

func (*CopyPipe) Read added in v0.10.1

func (t *CopyPipe) Read(p []byte) (int, error)

Read function is to satisfy io.Reader interface. This is simple implementation to support resuming copy in case of there is any temporary issue (e.g. networking)

type ExecParameters

type ExecParameters struct {
	Namespace string
	Pod       string
	Container string
	Command   []string
	TTY       bool // fuses stderr into stdout if 'true', needed for Ctrl-C support
}

type ExecResult

type ExecResult struct {
	Stdout bytes.Buffer
	Stderr bytes.Buffer
}

type Flavor

type Flavor struct {
	ClusterName string
	Kind        Kind
}

type Kind

type Kind int
const (
	KindUnknown Kind = iota
	KindMinikube
	KindKind
	KindEKS
	KindGKE
	KindAKS
	KindMicrok8s
)

func (Kind) String

func (k Kind) String() string

type Platform added in v0.9.3

type Platform struct {
	OS   string
	Arch string
}

type ReadFunc added in v0.10.1

type ReadFunc func(offset uint64, writer io.Writer) error

ReadFunc function is to support reading content from given offset till EOF. The content will be written to io.Writer.

Jump to

Keyboard shortcuts

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