common

package
v0.0.0-...-b3f0fa4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KubernetesTypes

func KubernetesTypes() map[string]KubeContollerType

ResourceTypes returns a mapping of kind (e.g. "namespace") to the type information required to configure its resource.

func RegisterKubernetesType

func RegisterKubernetesType(groupName, kind, resourcePlural, controllerName string, object runtime.Object, factory AdapterFactory)

RegisterResourceType(controllerName string, runtime.Object(), factory AdapterFactory)

func RegisterKubernetesTypeWithValidation

func RegisterKubernetesTypeWithValidation(groupName, kind, resourcePlural, controllerName string,
	objectType runtime.Object,

	validation *apiextv1beta1.CustomResourceValidation,
	factory AdapterFactory)

RegisterResourceTypeWithValidation returns a resource type struct with proper validation

Types

type AdapterFactory

type AdapterFactory func(
	clientset versioned.Interface,
	kubeclient kubernetes.Interface,
	adapterSpecificArgs map[string]interface{}) KubernetesTypeAdapter

AdapterFactory defines the function signature for factory methods that create instances of ResourceTypeAdapter. Such methods should be registered with RegisterAdapterFactory to ensure the type adapter is discoverable.

type KubeContollerType

type KubeContollerType struct {
	ControllerName string
	GroupName      string
	Kind           string
	ResourcePlural string
	Type           runtime.Object
	Validation     *apiextv1beta1.CustomResourceValidation
	AdapterFactory AdapterFactory
}

ResourceType is a common type for all oci resources

type KubernetesTypeAdapter

type KubernetesTypeAdapter interface {
	ObjectType() runtime.Object
	GroupVersionWithResource() schema.GroupVersionResource

	IsExpectedType(obj interface{}) bool
	IsCompliant(obj runtime.Object) bool
	Id(obj runtime.Object) string
	//Key(obj runtime.Object) objectclient.Key
	ObjectMeta(obj runtime.Object) *metav1.ObjectMeta
	Kind() string
	Copy(obj runtime.Object) runtime.Object

	// Operations to update resources
	Create(obj runtime.Object) (runtime.Object, error)
	Get(obj runtime.Object) (runtime.Object, error)
	Update(obj runtime.Object) (runtime.Object, error)
	Delete(obj runtime.Object) (runtime.Object, error)

	// Operations to handle resource updates
	CreateObject(obj runtime.Object) (runtime.Object, error)
	UpdateObject(obj runtime.Object) (runtime.Object, error)
	DeleteObject(obj runtime.Object, options *metav1.DeleteOptions) error
}

ResourceTypeAdapter defines operations for interacting with a federated type. Code written to this interface can then target any type for which an implementation of this interface exists.

Jump to

Keyboard shortcuts

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