utils

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIResource

func GetAPIResource(restMapper meta.RESTMapper, gvk schema.GroupVersionKind) (schema.GroupVersionResource, bool, error)

GetAPIResource uses a rest mapper to get the GroupVersionResource and determine whether an object is namespaced or not

func JSONToUnstructured

func JSONToUnstructured(in []byte) (unstructured.Unstructured, error)

JSONToUnstructured converts a raw json document into an Unstructured object

func NewRestMapper

func NewRestMapper(config *rest.Config) (meta.RESTMapper, error)

NewRestMapper creates a restMapper from the discovery client

func YAMLToUnstructured

func YAMLToUnstructured(in []byte) (u unstructured.Unstructured, err error)

YAMLToUnstructured converts a raw yaml document into an Unstructured object

func YAMLToUnstructuredSlice

func YAMLToUnstructuredSlice(in []byte) ([]*unstructured.Unstructured, error)

YAMLToUnstructuredSlice converts a raw yaml document into a slice of pointers to Unstructured objects

Types

type AnyPredicate added in v0.7.0

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

AnyPredicate takes a list of predicates and returns true if any one of them returns true

func NewAnyPredicate added in v0.7.0

func NewAnyPredicate(elems ...predicate.Predicate) AnyPredicate

NewAnyPredicate constructs a new AnyPredicate

func (AnyPredicate) Create added in v0.7.0

func (p AnyPredicate) Create(e event.CreateEvent) bool

Create returns true if any of the elements return true

func (AnyPredicate) Delete added in v0.7.0

func (p AnyPredicate) Delete(e event.DeleteEvent) bool

Delete returns true if any of the elements return true

func (AnyPredicate) Generic added in v0.7.0

func (p AnyPredicate) Generic(e event.GenericEvent) bool

Generic returns true if any of the elements return true

func (AnyPredicate) Update added in v0.7.0

func (p AnyPredicate) Update(e event.UpdateEvent) bool

Update returns true if any of the elements return true

type DryRunVerifier added in v0.4.0

type DryRunVerifier struct {
	Finder        cmdutil.CRDFinder
	OpenAPIGetter discovery.OpenAPISchemaInterface
}

DryRunVerifier verifies if a given group-version-kind supports DryRun against the current server. Sending dryRun requests to apiserver that don't support it will result in objects being unwillingly persisted.

It reads the OpenAPI to see if the given GVK supports dryRun. If the GVK can not be found, we assume that CRDs will have the same level of support as "namespaces", and non-CRDs will not be supported. We delay the check for CRDs as much as possible though, since it requires an extra round-trip to the server.

func NewDryRunVerifier added in v0.4.0

func NewDryRunVerifier(config *rest.Config) (*DryRunVerifier, error)

NewDryRunVerifier constructs a new DryRunVerifier

func (*DryRunVerifier) HasSupport added in v0.4.0

func (v *DryRunVerifier) HasSupport(gvk schema.GroupVersionKind) error

HasSupport verifies if the given gvk supports DryRun. An error is returned if it doesn't.

type OwnerIsClusterGitTrackPredicate added in v0.7.0

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

OwnerIsClusterGitTrackPredicate filters events to check the owner of the event object is a ClusterGitTrack

func NewOwnerIsClusterGitTrackPredicate added in v0.7.0

func NewOwnerIsClusterGitTrackPredicate(client client.Client) OwnerIsClusterGitTrackPredicate

NewOwnerIsClusterGitTrackPredicate constructs a new OwnerIsClusterGitTrackPredicate

func (OwnerIsClusterGitTrackPredicate) Create added in v0.7.0

Create returns true if the event object owner is a ClusterGitTrack

func (OwnerIsClusterGitTrackPredicate) Delete added in v0.7.0

Delete returns true if the event object owner is a ClusterGitTrack

func (OwnerIsClusterGitTrackPredicate) Generic added in v0.7.0

Generic returns true if the event object owner is a ClusterGitTrack

func (OwnerIsClusterGitTrackPredicate) Update added in v0.7.0

Update returns true if the event object owner is a ClusterGitTrack

type OwnerIsGitTrackPredicate added in v0.7.0

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

OwnerIsGitTrackPredicate filters events to check the owner of the event object is a GitTrack

func NewOwnerIsGitTrackPredicate added in v0.7.0

func NewOwnerIsGitTrackPredicate(client client.Client) OwnerIsGitTrackPredicate

NewOwnerIsGitTrackPredicate constructs a new OwnerIsGitTrackPredicate

func (OwnerIsGitTrackPredicate) Create added in v0.7.0

Create returns true if the event object owner is a GitTrack

func (OwnerIsGitTrackPredicate) Delete added in v0.7.0

Delete returns true if the event object owner is a GitTrack

func (OwnerIsGitTrackPredicate) Generic added in v0.7.0

Generic returns true if the event object owner is a GitTrack

func (OwnerIsGitTrackPredicate) Update added in v0.7.0

Update returns true if the event object owner is a GitTrack

type OwnersOwnerIsClusterGitTrackPredicate added in v0.7.0

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

OwnersOwnerIsClusterGitTrackPredicate filters events to check that the owner of the event object's owner is a ClusterGitTrack

func NewOwnersOwnerIsClusterGitTrackPredicate added in v0.7.0

func NewOwnersOwnerIsClusterGitTrackPredicate(client client.Client, includeNamespaced bool) OwnersOwnerIsClusterGitTrackPredicate

NewOwnersOwnerIsClusterGitTrackPredicate constructs a new OwnersOwnerIsClusterGitTrackPredicate

func (OwnersOwnerIsClusterGitTrackPredicate) Create added in v0.7.0

Create returns true if the owner of the event object's owner is a ClusterGitTrack

func (OwnersOwnerIsClusterGitTrackPredicate) Delete added in v0.7.0

Delete returns true if the owner of the event object's owner is a ClusterGitTrack

func (OwnersOwnerIsClusterGitTrackPredicate) Generic added in v0.7.0

Generic returns true if the owner of the event object's owner is a ClusterGitTrack

func (OwnersOwnerIsClusterGitTrackPredicate) Update added in v0.7.0

Update returns true if the owner of the event object's owner is a ClusterGitTrack

type OwnersOwnerIsGitTrackPredicate added in v0.7.0

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

OwnersOwnerIsGitTrackPredicate filters events to check that the owner of the event object's owner is a GitTrack

func NewOwnersOwnerIsGitTrackPredicate added in v0.7.0

func NewOwnersOwnerIsGitTrackPredicate(client client.Client) OwnersOwnerIsGitTrackPredicate

NewOwnersOwnerIsGitTrackPredicate constructs a new OwnersOwnerIsGitTrackPredicate

func (OwnersOwnerIsGitTrackPredicate) Create added in v0.7.0

Create returns true if the owner of the event object's owner is a GitTrack

func (OwnersOwnerIsGitTrackPredicate) Delete added in v0.7.0

Delete returns true if the owner of the event object's owner is a GitTrack

func (OwnersOwnerIsGitTrackPredicate) Generic added in v0.7.0

Generic returns true if the owner of the event object's owner is a GitTrack

func (OwnersOwnerIsGitTrackPredicate) Update added in v0.7.0

Update returns true if the owner of the event object's owner is a GitTrack

Directories

Path Synopsis
Package client has been copied from kubectl code almost verbatim Some methods have been moved from k/k into the utils.go file to remove the dependency on K/K https://github.com/kubernetes/kubernetes/blob/v1.13.1/pkg/kubectl/cmd/apply/apply.go
Package client has been copied from kubectl code almost verbatim Some methods have been moved from k/k into the utils.go file to remove the dependency on K/K https://github.com/kubernetes/kubernetes/blob/v1.13.1/pkg/kubectl/cmd/apply/apply.go

Jump to

Keyboard shortcuts

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