tpr

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 17, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServiceBindingResource = metav1.APIResource{
	Name:       ServiceBindingKind.TPRName(),
	Namespaced: true,
}

ServiceBindingResource represents the API resource for the service binding third party resource

View Source
var ServiceBrokerResource = metav1.APIResource{
	Name:       ServiceBrokerKind.TPRName(),
	Namespaced: true,
}

ServiceBrokerResource represents the API resource for the service broker third party resource

View Source
var ServiceClassResource = metav1.APIResource{

	Name:       "service-class",
	Namespaced: true,
}

ServiceClassResource represents the API resource for the service class third party resource

View Source
var ServiceInstanceResource = metav1.APIResource{
	Name:       ServiceInstanceKind.TPRName(),
	Namespaced: true,
}

ServiceInstanceResource represents the API resource for the service instance third party resource

Functions

func FromUnstructured

func FromUnstructured(in runtime.Unstructured, out runtime.Object) error

FromUnstructured converts o, a Kubernetes Third Party Resource type, into a *runtime.Unstructured and writes it to object. Returns a non-nil error is there were any issues with the conversion

func GetAccessor

func GetAccessor() meta.MetadataAccessor

GetAccessor returns a MetadataAccessor to fetch general information on metadata of runtime.Object types

func GetNamespace

func GetNamespace(obj runtime.Object) (string, error)

GetNamespace returns the namespace for the given object, if there is one. If not, returns the empty string and a non-nil error

func GetResourceClient

func GetResourceClient(cl *dynamic.Client, kind Kind, namespace string) (*dynamic.ResourceClient, error)

GetResourceClient returns the *dynamic.ResourceClient for a given resource type

func InstallTypes

InstallTypes installs all third party resource types to the cluster

func NewStorage

func NewStorage(opts Options) (storage.Interface, factory.DestroyFunc)

NewStorage creates a new TPR-based storage.Interface implementation

func ToUnstructured

func ToUnstructured(in runtime.Object) (*runtime.Unstructured, error)

ToUnstructured converts in (which should be a Service Catalog third party object type) into a runtime.Unstructured for use in writing to Kubernetes

Types

type ErrTPRInstall

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

ErrTPRInstall is returned when we fail to install TPR

func (ErrTPRInstall) Error

func (e ErrTPRInstall) Error() string

type Keyer

type Keyer struct {
	DefaultNamespace string
	ResourceName     string
	Separator        string
}

Keyer is a containing struct for

func (Keyer) Key

func (k Keyer) Key(ctx request.Context, name string) (string, error)

Key is a (k8s.io/kubernetes/pkg/registry/generic/registry).Store compatible function to get the key to be passed to a third party resource based storage Interface.

It is meant to be passed to a Store's KeyRoot field, so that a TPR based storage interface can parse the namespace and name from fields that it is later given

func (Keyer) KeyRoot

func (k Keyer) KeyRoot(ctx request.Context) string

KeyRoot is a (k8s.io/kubernetes/pkg/registry/generic/registry).Store compatible function to get the key root to be passed to a third party resource based storage Interface.

It is meant to be passed to a Store's KeyRootFunc field, so that a TPR based storage interface can parse the namespace and name from fields that it is later given.

The returned string will never be empty is k.DefaultNamespace is not empty

func (Keyer) NamespaceAndNameFromKey

func (k Keyer) NamespaceAndNameFromKey(key string) (string, string, error)

NamespaceAndNameFromKey returns the namespace (or an empty string if there wasn't one) and name for a given etcd-style key. This function is intended to be used in a TPR based storage.Interface that uses k.KeyRoot and k.Key to construct its etcd keys.

The first return value is the namespace, and may be empty if the key represents a namespace-less resource. The second return value is the name and will not be empty if the error is nil. The error will be non-nil if the key was malformed, in which case all other return values will be empty strings.

type Kind

type Kind string

Kind represents the kind of a third party resource. This type implements fmt.Stringer

const (
	// ServiceBrokerKind is the name of a Service Broker resource, a Kubernetes third party resource.
	ServiceBrokerKind Kind = "Broker"

	// ServiceBrokerListKind is the name of a list of Service Broker resources
	ServiceBrokerListKind Kind = "BrokerList"

	// ServiceBindingKind is the name of a Service Binding resource, a Kubernetes third party resource.
	ServiceBindingKind Kind = "Binding"

	// ServiceBindingListKind is the name for lists of Service Bindings
	ServiceBindingListKind Kind = "BindingList"

	// ServiceClassKind is the name of a Service Class resource, a Kubernetes third party resource.
	ServiceClassKind Kind = "ServiceClass"

	// ServiceClassListKind is the name of a list of service class resources
	ServiceClassListKind Kind = "ServiceClassList"

	// ServiceInstanceKind is the name of a Service Instance resource, a Kubernetes third party resource.
	ServiceInstanceKind Kind = "Instance"

	// ServiceInstanceListKind is the name of a list of service instance resources
	ServiceInstanceListKind Kind = "InstanceList"
)

func (Kind) String

func (k Kind) String() string

String is the fmt.Stringer interface implementation

func (Kind) TPRName

func (k Kind) TPRName() string

TPRName returns the lowercase name, suitable for creating third party resources of this kind

func (Kind) URLName

func (k Kind) URLName() string

URLName returns the URL-worthy name this TPR kind. Examples:

Kind("ServiceClass").URLName() == "serviceclasses"
Kind("Broker").URLName() == "brokers"

Note that this function is incomplete - it is only guaranteed to properly pluralize our 4 resource types ("Broker", "ServiceClass", "Instance", "Binding")

type Options

type Options struct {
	HasNamespace     bool
	RESTOptions      generic.RESTOptions
	DefaultNamespace string
	RESTClient       restclient.Interface
	SingularKind     Kind
	NewSingularFunc  func(string, string) runtime.Object
	ListKind         Kind
	NewListFunc      func() runtime.Object
	CheckObjectFunc  func(runtime.Object) error
	DestroyFunc      func()
	Keyer            Keyer
}

Options is the set of options to create a new TPR storage interface

Jump to

Keyboard shortcuts

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