utils

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: Apache-2.0 Imports: 20 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 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 OwnerInNamespacePredicate

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

OwnerInNamespacePredicate filters events to check the owner of the event object is in the controller's namespace

func NewOwnerInNamespacePredicate

func NewOwnerInNamespacePredicate(client client.Client) OwnerInNamespacePredicate

NewOwnerInNamespacePredicate constructs a new OwnerInNamespacePredicate

func (OwnerInNamespacePredicate) Create

Create returns true if the event object's owner is in the same namespace

func (OwnerInNamespacePredicate) Delete

Delete returns true if the event object's owner is in the same namespace

func (OwnerInNamespacePredicate) Generic

Generic returns true if the event object's owner is in the same namespace

func (OwnerInNamespacePredicate) Update

Update returns true if the event object's owner is in the same namespace

type OwnersOwnerInNamespacePredicate added in v0.2.2

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

OwnersOwnerInNamespacePredicate filters events to check the owners owner of the event object is in the controller's namespace

func NewOwnersOwnerInNamespacePredicate added in v0.2.2

func NewOwnersOwnerInNamespacePredicate(client client.Client) OwnersOwnerInNamespacePredicate

NewOwnersOwnerInNamespacePredicate constructs a new OwnersOwnerInNamespacePredicate

func (OwnersOwnerInNamespacePredicate) Create added in v0.2.2

Create returns true if the event object owners owner is in the same namespace

func (OwnersOwnerInNamespacePredicate) Delete added in v0.2.2

Delete returns true if the event object owners owner is in the same namespace

func (OwnersOwnerInNamespacePredicate) Generic added in v0.2.2

Generic returns true if the event object owners owner is in the same namespace

func (OwnersOwnerInNamespacePredicate) Update added in v0.2.2

Update returns true if the event object owners owner is in the same namespace

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