clients

package
v3.0.0-...-3d101a0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCacheNotFound = errors.New("not found")
)

Error Constants

Functions

func FromUnstructured

func FromUnstructured(uns *unstructured.Unstructured) (metav1.Object, error)

FromUnstructured dynamically converts an Unstructured Kubernetes resource into the typed equivalent. Only built-in resource types are supported, so CustomResources will fail conversion with an error.

func IsCRD

func IsCRD(obj *unstructured.Unstructured) bool

IsCRD returns true if a Kubernetes resource is a CRD.

func IsConfigMap

func IsConfigMap(obj *unstructured.Unstructured) bool

IsConfigMap returns true if the resource is a configmap marked as immutable.

func IsNamespacedKind

func IsNamespacedKind(gvk schema.GroupVersionKind, clientSet *DynamicClientSet) (bool, error)

IsNamespacedKind checks if a given GVK is namespace-scoped. Known GVKs are compared against a static lookup table. For GVKs not in the table, attempt to look up the GVK from the API server. If the GVK cannot be found, a NoNamespaceInfoErr is returned.

func IsNoNamespaceInfoErr

func IsNoNamespaceInfoErr(err error) bool

func JobFromUnstructured

func JobFromUnstructured(uns *unstructured.Unstructured) (*batchv1.Job, error)

func NamespaceOrDefault

func NamespaceOrDefault(ns string) string

NamespaceOrDefault returns `ns` or the the default namespace `"default"` if `ns` is empty.

func NewMemCacheClient

NewMemCacheClient creates a new CachedDiscoveryInterface which caches discovery information in memory and will stay up-to-date if Invalidate is called with regularity.

NOTE: The client will NOT resort to live lookups on cache misses.

func PodFromUnstructured

func PodFromUnstructured(uns *unstructured.Unstructured) (*corev1.Pod, error)

func ResourceClient

func ResourceClient(kind kinds.Kind, namespace string, client *DynamicClientSet) (dynamic.ResourceInterface, error)

Types

type DynamicClientSet

type DynamicClientSet struct {
	GenericClient         dynamic.Interface
	DiscoveryClientCached discovery.CachedDiscoveryInterface
	RESTMapper            *restmapper.DeferredDiscoveryRESTMapper
}

func NewDynamicClientSet

func NewDynamicClientSet(clientConfig *rest.Config) (*DynamicClientSet, error)

func (*DynamicClientSet) ResourceClient

func (dcs *DynamicClientSet) ResourceClient(gvk schema.GroupVersionKind, namespace string,
) (dynamic.ResourceInterface, error)

func (*DynamicClientSet) ResourceClientForObject

func (dcs *DynamicClientSet) ResourceClientForObject(obj *unstructured.Unstructured,
) (dynamic.ResourceInterface, error)

type LogClient

type LogClient struct {
	// contains filtered or unexported fields
}

func NewLogClient

func NewLogClient(ctx context.Context, clientConfig *rest.Config) (*LogClient, error)

func (*LogClient) Logs

func (lc *LogClient) Logs(namespace, name string) (io.ReadCloser, error)

type NoNamespaceInfoErr

type NoNamespaceInfoErr struct {
	// contains filtered or unexported fields
}

func (*NoNamespaceInfoErr) Error

func (e *NoNamespaceInfoErr) Error() string

Jump to

Keyboard shortcuts

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