kube

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package kube provides helper utilities common for kubernetes

Index

Constants

View Source
const (
	ServiceKind               = "Service"
	EndpointsKind             = "Endpoints"
	DeploymentKind            = "Deployment"
	ReplicaSetKind            = "ReplicaSet"
	StatefulSetKind           = "StatefulSet"
	DaemonSetKind             = "DaemonSet"
	IngressKind               = "Ingress"
	PersistentVolumeClaimKind = "PersistentVolumeClaim"
)

Variables

This section is empty.

Functions

func ApplyResource

func ApplyResource(config *rest.Config, obj *unstructured.Unstructured, namespace string, dryRun, force bool) (string, error)

ApplyResource performs an apply of a unstructured resource

func ConvertToVersion added in v0.6.0

func ConvertToVersion(obj *unstructured.Unstructured, group, version string) (*unstructured.Unstructured, error)

ConvertToVersion converts an unstructured object into the specified group/version

func DeleteResource added in v0.3.2

func DeleteResource(config *rest.Config, obj *unstructured.Unstructured, namespace string) error

DeleteResource deletes resource

func DeleteResourceWithLabel

func DeleteResourceWithLabel(config *rest.Config, namespace string, labelName string, labelValue string) error

DeleteResourceWithLabel delete all resources which match to specified label selector

func GetCachedServerResources added in v0.4.0

func GetCachedServerResources(host string, disco discovery.DiscoveryInterface) ([]*metav1.APIResourceList, error)

GetCachedServerResources discovers API resources supported by a Kube API server. Caches the results for apiResourceCacheDuration (per host)

func GetLiveResource

func GetLiveResource(dclient dynamic.Interface, obj *unstructured.Unstructured, apiResource *metav1.APIResource, namespace string) (*unstructured.Unstructured, error)

GetLiveResource returns the corresponding live resource from a unstructured object

func GetResourcesWithLabel added in v0.3.0

func GetResourcesWithLabel(config *rest.Config, namespace string, labelName string, labelValue string) ([]*unstructured.Unstructured, error)

GetResourcesWithLabel returns all kubernetes resources with specified label

func ListResources

func ListResources(dclient dynamic.Interface, apiResource metav1.APIResource, namespace string, listOpts metav1.ListOptions) ([]*unstructured.Unstructured, error)

ListResources returns a list of resources of a particular API type using the dynamic client

func MustToUnstructured

func MustToUnstructured(obj interface{}) *unstructured.Unstructured

MustToUnstructured converts a concrete K8s API type to a un unstructured object and panics if not successful

func SetLabel added in v0.5.3

func SetLabel(target *unstructured.Unstructured, key, val string) error

SetLabel sets our app labels against an unstructured object

func SplitYAML added in v0.7.0

func SplitYAML(out string) ([]*unstructured.Unstructured, error)

SplitYAML splits a YAML file into unstructured objects. Returns list of all unstructured objects found in the yaml. If any errors occurred, returns the first one

func TestConfig

func TestConfig(config *rest.Config) error

TestConfig tests to make sure the REST config is usable

func ToUnstructured

func ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)

ToUnstructured converts a concrete K8s API type to a un unstructured object

func UnsetLabel added in v0.8.0

func UnsetLabel(target *unstructured.Unstructured, key string)

UnsetLabel removes our app labels from an unstructured object

func WatchResourcesWithLabel added in v0.3.0

func WatchResourcesWithLabel(ctx context.Context, config *rest.Config, namespace string, labelName string) (chan watch.Event, error)

func WriteKubeConfig added in v0.3.2

func WriteKubeConfig(restConfig *rest.Config, namespace, filename string) error

WriteKubeConfig takes a rest.Config and writes it as a kubeconfig at the specified path

Types

This section is empty.

Jump to

Keyboard shortcuts

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