Documentation
¶
Index ¶
- Constants
- Variables
- func Apply(ctx context.Context, opts ApplyOpts) error
- func Create(ctx context.Context, opts CreateOpts) error
- func DecodeYAML(src []byte) (*unstructured.Unstructured, *schema.GroupVersionKind, error)
- func Delete(ctx context.Context, opts DeleteOpts) error
- func DynamicForGVR(restConfig *rest.Config, gvk schema.GroupVersionKind, namespace string) (dynamic.ResourceInterface, error)
- func Filter(list []unstructured.Unstructured, accept FilterFunc) ([]unstructured.Unstructured, error)
- func FindGVR(cfg *rest.Config, gvk schema.GroupVersionKind) (*meta.RESTMapping, error)
- func FromUnstructuredViaJSON(u map[string]interface{}, obj interface{}) error
- func Get(ctx context.Context, opts GetOpts) (*unstructured.Unstructured, error)
- func GetByAPIResource(ctx context.Context, opts GetByAPIResourceOpts) (*unstructured.Unstructured, error)
- func InstalledBySelector() (labels.Selector, error)
- func IsNoKindMatchError(err error) bool
- func List(ctx context.Context, opts ListOpts) ([]unstructured.Unstructured, error)
- func ListByAPIResource(ctx context.Context, opts ListByAPIResourceOpts) ([]unstructured.Unstructured, error)
- func Patch(ctx context.Context, opts PatchOpts) error
- func RESTConfigFromBytes(data []byte, withContext string) (*rest.Config, error)
- func Watch(ctx context.Context, opts WatchOpts) error
- type APIResource
- type ApplyOpts
- type CreateOpts
- type DeleteOpts
- type FilterFunc
- type GetByAPIResourceOpts
- type GetOpts
- type ListByAPIResourceOpts
- type ListOpts
- type PatchOpts
- type ResolveAPIResourceOpts
- type StopFunc
- type WatchOpts
Constants ¶
View Source
const ( InstalledByLabel = "app.kubernetes.io/installed-by" InstalledByValue = "krateo" PackageNameLabel = "krateo.io/package-name" DefaultNamespace = "crossplane-system" )
Variables ¶
View Source
var ( ErrCannotResolveResourceType = errors.New("cannot resolve resource type") ErrCannotListByAPIResource = errors.New("cannot list objects by API resource") )
View Source
var (
ErrWatcherTimeout = errors.New("watcher timed out")
)
View Source
var (
NoKindMatchError = errors.New("RESTMapper can't find any match for kind")
)
Functions ¶
func Create ¶
func Create(ctx context.Context, opts CreateOpts) error
Create creates a resource if does not exists.
func DecodeYAML ¶
func DecodeYAML(src []byte) (*unstructured.Unstructured, *schema.GroupVersionKind, error)
func DynamicForGVR ¶
func DynamicForGVR(restConfig *rest.Config, gvk schema.GroupVersionKind, namespace string) (dynamic.ResourceInterface, error)
func Filter ¶
func Filter(list []unstructured.Unstructured, accept FilterFunc) ([]unstructured.Unstructured, error)
func FindGVR ¶
func FindGVR(cfg *rest.Config, gvk schema.GroupVersionKind) (*meta.RESTMapping, error)
FindGVR find the corresponding GVR (available in *meta.RESTMapping) for gvk
func FromUnstructuredViaJSON ¶ added in v1.3.0
func Get ¶
func Get(ctx context.Context, opts GetOpts) (*unstructured.Unstructured, error)
func GetByAPIResource ¶
func GetByAPIResource(ctx context.Context, opts GetByAPIResourceOpts) (*unstructured.Unstructured, error)
GetByAPIResource returns an object that matches the provided name & options on the server.
func InstalledBySelector ¶
func IsNoKindMatchError ¶
func List ¶
func List(ctx context.Context, opts ListOpts) ([]unstructured.Unstructured, error)
func ListByAPIResource ¶
func ListByAPIResource(ctx context.Context, opts ListByAPIResourceOpts) ([]unstructured.Unstructured, error)
listByAPI list all objects of the provided API & namespace. If listing the API at the cluster scope, set the namespace argument as an empty string.
func RESTConfigFromBytes ¶
Types ¶
type APIResource ¶
type APIResource struct { // name is the plural name of the resource. Name string `json:"name"` // namespaced indicates if a resource is namespaced or not. Namespaced bool `json:"namespaced"` // group is the preferred group of the resource. Empty implies the group of the containing resource list. // For subresources, this may have a different value, for example: Scale". Group string `json:"group,omitempty"` // version is the preferred version of the resource. Empty implies the version of the containing resource list // For subresources, this may have a different value, for example: v1 (while inside a v1beta1 version of the core resource's group)". Version string `json:"version,omitempty"` // kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo') Kind string `json:"kind"` }
APIResource represents a Kubernetes API resource.
func ResolveAPIResource ¶
func ResolveAPIResource(opts ResolveAPIResourceOpts) (*APIResource, error)
func (*APIResource) GroupKind ¶
func (r *APIResource) GroupKind() schema.GroupKind
func (*APIResource) GroupVersionKind ¶
func (r *APIResource) GroupVersionKind() schema.GroupVersionKind
func (*APIResource) GroupVersionResource ¶
func (r *APIResource) GroupVersionResource() schema.GroupVersionResource
func (*APIResource) String ¶
func (r *APIResource) String() string
func (*APIResource) WithGroupString ¶
func (r *APIResource) WithGroupString() string
type ApplyOpts ¶
type ApplyOpts struct { RESTConfig *rest.Config Object *unstructured.Unstructured GVK schema.GroupVersionKind }
type CreateOpts ¶
type CreateOpts struct { RESTConfig *rest.Config GVK schema.GroupVersionKind Object *unstructured.Unstructured Namespace string }
type DeleteOpts ¶
type DeleteOpts struct { RESTConfig *rest.Config Object *unstructured.Unstructured }
type FilterFunc ¶
type FilterFunc func(unstructured.Unstructured) bool
type GetByAPIResourceOpts ¶
type GetByAPIResourceOpts struct { RESTConfig *rest.Config APIResource APIResource Name string Namespace string }
type ListByAPIResourceOpts ¶
type ListByAPIResourceOpts struct { RESTConfig *rest.Config APIResource APIResource Namespace string }
type ResolveAPIResourceOpts ¶
type StopFunc ¶ added in v1.3.0
type StopFunc func(et watch.EventType, obj *unstructured.Unstructured) (bool, error)
Click to show internal directories.
Click to hide internal directories.