Documentation ¶
Index ¶
- Variables
- func FindCRD(objs []unstructured.Unstructured, kind schema.GroupKind) *unstructured.Unstructured
- func FromUnstructured(uns *unstructured.Unstructured) (metav1.Object, error)
- func GVRForGVK(mapper meta.RESTMapper, gvk schema.GroupVersionKind) (schema.GroupVersionResource, error)
- func IsCRD(obj *unstructured.Unstructured) bool
- func IsConfigMap(obj *unstructured.Unstructured) bool
- func IsImmutable(obj *unstructured.Unstructured) bool
- func IsNamespacedKind(gvk schema.GroupVersionKind, clientSet *DynamicClientSet, ...) (bool, error)
- func IsNoNamespaceInfoErr(err error) bool
- func IsSecret(obj *unstructured.Unstructured) bool
- func JobFromUnstructured(uns *unstructured.Unstructured) (*batchv1.Job, error)
- func NamespaceOrDefault(ns string) string
- func NewMemCacheClient(delegate discovery.DiscoveryInterface) discovery.CachedDiscoveryInterface
- func Normalize(uns *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func PodFromUnstructured(uns *unstructured.Unstructured) (*corev1.Pod, error)
- func ResourceClient(kind kinds.Kind, namespace string, client *DynamicClientSet) (dynamic.ResourceInterface, error)
- func ToUnstructured(object metav1.Object) (*unstructured.Unstructured, error)
- type CRDCache
- type DynamicClientSet
- type LogClient
- type NoNamespaceInfoErr
Constants ¶
This section is empty.
Variables ¶
var (
ErrCacheNotFound = errors.New("not found")
)
Error Constants
Functions ¶
func FindCRD ¶
func FindCRD(objs []unstructured.Unstructured, kind schema.GroupKind) *unstructured.Unstructured
FindCRD finds the CRD for a given kind amongst a list of unstructured objects.
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 GVRForGVK ¶
func GVRForGVK(mapper meta.RESTMapper, gvk schema.GroupVersionKind) (schema.GroupVersionResource, error)
GVRForGVK queries the API server to determine the resource for the given GroupVersionKind.
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 has a ConfigMap GVK.
func IsImmutable ¶
func IsImmutable(obj *unstructured.Unstructured) bool
IsMutable returns true if given ConfigMap or Secret is marked as immutable.
func IsNamespacedKind ¶
func IsNamespacedKind(gvk schema.GroupVersionKind, clientSet *DynamicClientSet, objs ...unstructured.Unstructured) (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, look at the given objects for a matching CRD. Finally, attempt to look up the GVK from the API server. If the GVK cannot be found, a NoNamespaceInfoErr is returned.
func IsNoNamespaceInfoErr ¶
func IsSecret ¶
func IsSecret(obj *unstructured.Unstructured) bool
IsSecret returns true if the resource has a Secret GVK.
func JobFromUnstructured ¶
func JobFromUnstructured(uns *unstructured.Unstructured) (*batchv1.Job, error)
func NamespaceOrDefault ¶
NamespaceOrDefault returns `ns` or the the default namespace `"default"` if `ns` is empty.
func NewMemCacheClient ¶
func NewMemCacheClient(delegate discovery.DiscoveryInterface) discovery.CachedDiscoveryInterface
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 Normalize ¶
func Normalize(uns *unstructured.Unstructured) (*unstructured.Unstructured, error)
Normalize converts an Unstructured Kubernetes resource into the typed equivalent and then back to Unstructured. This process normalizes semantically-equivalent resources into an identical output, which is important for diffing. If the scheme is not defined, then return the original resource.
func PodFromUnstructured ¶
func PodFromUnstructured(uns *unstructured.Unstructured) (*corev1.Pod, error)
func ResourceClient ¶
func ResourceClient(kind kinds.Kind, namespace string, client *DynamicClientSet) (dynamic.ResourceInterface, error)
ResourceClient returns a dynamic client for the given built-in Kind and namespace.
func ToUnstructured ¶
func ToUnstructured(object metav1.Object) (*unstructured.Unstructured, error)
ToUnstructured converts a typed Kubernetes resource into the Unstructured equivalent.
Types ¶
type CRDCache ¶
type CRDCache struct {
// contains filtered or unexported fields
}
CRDCache facilitates program-wide resolution of Kubernetes kinds. For example, it allows the yaml/v2 package to lookup a CRD during preview that would be installed by a "CustomResourceDefinition" resource. The user is expected to use DependsOn to ensure that the CRD is created first.
func (*CRDCache) AddCRD ¶
func (c *CRDCache) AddCRD(crd *unstructured.Unstructured) error
AddCRD adds a CRD to the cache.
func (*CRDCache) GetCRD ¶
func (c *CRDCache) GetCRD(kind schema.GroupKind) *unstructured.Unstructured
GetCRD returns the CRD for the given kind, if it exists in the cache.
func (*CRDCache) RemoveCRD ¶
func (c *CRDCache) RemoveCRD(crd *unstructured.Unstructured) error
RemoveCRD removes a CRD from the cache.
type DynamicClientSet ¶
type DynamicClientSet struct { GenericClient dynamic.Interface DiscoveryClientCached discovery.CachedDiscoveryInterface RESTMapper meta.ResettableRESTMapper CRDCache CRDCache }
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)
ResourceClientForObject returns a resource client based on the object's GVK and namespace.
type LogClient ¶
type LogClient struct {
// contains filtered or unexported fields
}
func MakeLogClient ¶
func NewLogClient ¶
func NewLogClient(ctx context.Context, client clientcorev1.CoreV1Interface) *LogClient
type NoNamespaceInfoErr ¶
type NoNamespaceInfoErr struct {
// contains filtered or unexported fields
}
func (*NoNamespaceInfoErr) Error ¶
func (e *NoNamespaceInfoErr) Error() string