Version: v0.11.0 Latest Latest

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 11 Imported by: 0




This section is empty.


This section is empty.


func GetK8sObjType

func GetK8sObjType(obj metav1.Object) reflect.Type

GetK8sObjType returns the type (not the pointer type) of a kubernetes object.

func GroupVersionResourceToString

func GroupVersionResourceToString(gvr metav1.GroupVersionResource) string

GroupVersionResourceToString returns a string representation. It differs from the original stringer of the object itself.

func NewK8sObj

func NewK8sObj(t reflect.Type) metav1.Object

NewK8sObj returns a new object of a Kubernetes type based on the type.

func ToAdmissionErrorResponse

func ToAdmissionErrorResponse(uid types.UID, err error, logger log.Logger) *admissionv1beta1.AdmissionResponse

ToAdmissionErrorResponse transforms an error into a admission response with error.


type ObjectCreator added in v0.10.0

type ObjectCreator interface {
	NewObject(rawJSON []byte) (runtime.Object, error)

ObjectCreator knows how to create objects from Raw JSON data into specific types.

func NewDynamicObjectCreator added in v0.10.0

func NewDynamicObjectCreator() ObjectCreator

NewDynamicObjectCreator returns a object creator that knows how to return objects from raw JSON data without the need of knowing the type.

To be able to infer the types the types need to be registered on the global client Scheme. Normally when a user tries casting the metav1.Object to a specific type, the object is already registered. In case the type is not registered and the object can't be created it will fallback to an Unstructured type.

Useful to make dynamic webhooks that expect multiple or unknown types.

func NewStaticObjectCreator added in v0.10.0

func NewStaticObjectCreator(obj metav1.Object) ObjectCreator

NewStaticObjectCreator doesn't need to infer the type, it will create a new schema and create a new object with the same type from the received object type.

Source Files

Jump to

Keyboard shortcuts

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