kubeutils

package
v0.0.0-...-97cf01e Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: Apache-2.0 Imports: 17 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecuteCommand = func(args []string) (string, error) {
	glog.V(3).Infof("Running command: %s\n", strings.Join(args, " "))

	output, err := exec.Command(args[0], args[1:]...).Output()
	if err != nil {
		err = fmt.Errorf("unexpected error in executing command %q: error: %q, output: %q", strings.Join(args, " "), err, output)
		glog.V(3).Infof("%s", err)
	}
	return strings.TrimSuffix(string(output), "\n"), err
}

ExecuteCommand executes the command in 'args' and returns the output and error, if any. Extracted out here to allow overriding in tests.

Functions

func GetClients

func GetClients(kubeconfig string, kubeContexts []string) (map[string]kubeclient.Interface, error)

GetClients returns a map of cluster name to kubeclient for each cluster context. Uses all contexts from the given kubeconfig if kubeContexts is empty.

func GetClusterContexts

func GetClusterContexts(kubeconfig string, kubeContexts []string) ([]string, error)

GetClusterContexts extracts and returns the list of contexts from the given kubeconfig. Returns the passed kubeContexts if they are all valid. Returns an error otherwise.

func GetProbe

func GetProbe(client kubeclient.Interface, port ingressbe.ServicePort) (*api_v1.Probe, error)

GetProbe returns a probe that's used for the given nodeport TODO refactor `getHTTPProbe` in ingress-gce/controller/utils.go so we can share code

func GetServiceNodePort

func GetServiceNodePort(be v1beta1.IngressBackend, namespace string, client kubeclient.Interface) (ingressbe.ServicePort, error)

GetServiceNodePort takes an IngressBackend and returns a corresponding ServicePort

func ObjectMetaAndSpecEquivalent

func ObjectMetaAndSpecEquivalent(a, b runtime.Object, ignoreAnnotationKeys map[string]string) bool

ObjectMetaAndSpecEquivalent checks if cluster-independent, user provided data in ObjectMeta and Spec in two given top level api objects are equivalent. Ignores annotations with keys in ignoreAnnotationKeys. Note: copied from https://github.com/kubernetes/federation/blob/7951a643cebc3abdcd903eaff90d1383b43928d1/pkg/federation-controller/util/meta.go#L79

func ObjectMetaEquivalent

func ObjectMetaEquivalent(a, b meta_v1.ObjectMeta, ignoreAnnotationKeys map[string]string) bool

ObjectMetaEquivalent checks if cluster-independent, user provided data in two given ObjectMeta are equal. If in the future the ObjectMeta structure is expanded then any field that is not populated by the api server should be included here. Ignores annotations with keys in ignoreAnnotationKeys. Note: copied from https://github.com/kubernetes/federation/blob/7951a643cebc3abdcd903eaff90d1383b43928d1/pkg/federation-controller/util/meta.go#L61

Types

This section is empty.

Jump to

Keyboard shortcuts

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